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 save_PolygonOffset(factor
, ctx
->DepthMaxF
* bias
);
2857 static void GLAPIENTRY
save_PopAttrib( void )
2859 GET_CURRENT_CONTEXT(ctx
);
2860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2861 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_ATTRIB
, 0 );
2862 if (ctx
->ExecuteFlag
) {
2863 (*ctx
->Exec
->PopAttrib
)();
2868 static void GLAPIENTRY
save_PopMatrix( void )
2870 GET_CURRENT_CONTEXT(ctx
);
2871 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2872 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_MATRIX
, 0 );
2873 if (ctx
->ExecuteFlag
) {
2874 (*ctx
->Exec
->PopMatrix
)();
2879 static void GLAPIENTRY
save_PopName( void )
2881 GET_CURRENT_CONTEXT(ctx
);
2882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2883 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_NAME
, 0 );
2884 if (ctx
->ExecuteFlag
) {
2885 (*ctx
->Exec
->PopName
)();
2890 static void GLAPIENTRY
save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2891 const GLclampf
*priorities
)
2893 GET_CURRENT_CONTEXT(ctx
);
2895 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2897 for (i
=0;i
<num
;i
++) {
2899 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2901 n
[1].ui
= textures
[i
];
2902 n
[2].f
= priorities
[i
];
2905 if (ctx
->ExecuteFlag
) {
2906 (*ctx
->Exec
->PrioritizeTextures
)( num
, textures
, priorities
);
2911 static void GLAPIENTRY
save_PushAttrib( GLbitfield mask
)
2913 GET_CURRENT_CONTEXT(ctx
);
2915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2916 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2920 if (ctx
->ExecuteFlag
) {
2921 (*ctx
->Exec
->PushAttrib
)( mask
);
2926 static void GLAPIENTRY
save_PushMatrix( void )
2928 GET_CURRENT_CONTEXT(ctx
);
2929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2930 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2931 if (ctx
->ExecuteFlag
) {
2932 (*ctx
->Exec
->PushMatrix
)();
2937 static void GLAPIENTRY
save_PushName( GLuint name
)
2939 GET_CURRENT_CONTEXT(ctx
);
2941 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2942 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_NAME
, 1 );
2946 if (ctx
->ExecuteFlag
) {
2947 (*ctx
->Exec
->PushName
)( name
);
2952 static void GLAPIENTRY
save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2954 GET_CURRENT_CONTEXT(ctx
);
2956 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2957 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RASTER_POS
, 4 );
2964 if (ctx
->ExecuteFlag
) {
2965 (*ctx
->Exec
->RasterPos4f
)( x
, y
, z
, w
);
2969 static void GLAPIENTRY
save_RasterPos2d(GLdouble x
, GLdouble y
)
2971 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2974 static void GLAPIENTRY
save_RasterPos2f(GLfloat x
, GLfloat y
)
2976 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2979 static void GLAPIENTRY
save_RasterPos2i(GLint x
, GLint y
)
2981 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2984 static void GLAPIENTRY
save_RasterPos2s(GLshort x
, GLshort y
)
2986 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2989 static void GLAPIENTRY
save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2991 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2994 static void GLAPIENTRY
save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2996 save_RasterPos4f(x
, y
, z
, 1.0F
);
2999 static void GLAPIENTRY
save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3001 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3004 static void GLAPIENTRY
save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3006 save_RasterPos4f(x
, y
, z
, 1.0F
);
3009 static void GLAPIENTRY
save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3011 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3014 static void GLAPIENTRY
save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3016 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3019 static void GLAPIENTRY
save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3021 save_RasterPos4f(x
, y
, z
, w
);
3024 static void GLAPIENTRY
save_RasterPos2dv(const GLdouble
*v
)
3026 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3029 static void GLAPIENTRY
save_RasterPos2fv(const GLfloat
*v
)
3031 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3034 static void GLAPIENTRY
save_RasterPos2iv(const GLint
*v
)
3036 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3039 static void GLAPIENTRY
save_RasterPos2sv(const GLshort
*v
)
3041 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3044 static void GLAPIENTRY
save_RasterPos3dv(const GLdouble
*v
)
3046 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3049 static void GLAPIENTRY
save_RasterPos3fv(const GLfloat
*v
)
3051 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3054 static void GLAPIENTRY
save_RasterPos3iv(const GLint
*v
)
3056 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3059 static void GLAPIENTRY
save_RasterPos3sv(const GLshort
*v
)
3061 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3064 static void GLAPIENTRY
save_RasterPos4dv(const GLdouble
*v
)
3066 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3067 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3070 static void GLAPIENTRY
save_RasterPos4fv(const GLfloat
*v
)
3072 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3075 static void GLAPIENTRY
save_RasterPos4iv(const GLint
*v
)
3077 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3078 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3081 static void GLAPIENTRY
save_RasterPos4sv(const GLshort
*v
)
3083 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3087 static void GLAPIENTRY
save_PassThrough( GLfloat token
)
3089 GET_CURRENT_CONTEXT(ctx
);
3091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3092 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PASSTHROUGH
, 1 );
3096 if (ctx
->ExecuteFlag
) {
3097 (*ctx
->Exec
->PassThrough
)( token
);
3102 static void GLAPIENTRY
save_ReadBuffer( GLenum mode
)
3104 GET_CURRENT_CONTEXT(ctx
);
3106 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3107 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_READ_BUFFER
, 1 );
3111 if (ctx
->ExecuteFlag
) {
3112 (*ctx
->Exec
->ReadBuffer
)( mode
);
3117 static void GLAPIENTRY
3118 save_ResetHistogram(GLenum target
)
3120 GET_CURRENT_CONTEXT(ctx
);
3122 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3123 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_HISTOGRAM
, 1 );
3127 if (ctx
->ExecuteFlag
) {
3128 (*ctx
->Exec
->ResetHistogram
)( target
);
3133 static void GLAPIENTRY
3134 save_ResetMinmax(GLenum target
)
3136 GET_CURRENT_CONTEXT(ctx
);
3138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3139 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_MIN_MAX
, 1 );
3143 if (ctx
->ExecuteFlag
) {
3144 (*ctx
->Exec
->ResetMinmax
)( target
);
3149 static void GLAPIENTRY
save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3151 GET_CURRENT_CONTEXT(ctx
);
3153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3154 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ROTATE
, 4 );
3161 if (ctx
->ExecuteFlag
) {
3162 (*ctx
->Exec
->Rotatef
)( angle
, x
, y
, z
);
3167 static void GLAPIENTRY
save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3169 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3173 static void GLAPIENTRY
save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
3175 GET_CURRENT_CONTEXT(ctx
);
3177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3178 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCALE
, 3 );
3184 if (ctx
->ExecuteFlag
) {
3185 (*ctx
->Exec
->Scalef
)( x
, y
, z
);
3190 static void GLAPIENTRY
save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
3192 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3196 static void GLAPIENTRY
save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3198 GET_CURRENT_CONTEXT(ctx
);
3200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3201 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCISSOR
, 4 );
3208 if (ctx
->ExecuteFlag
) {
3209 (*ctx
->Exec
->Scissor
)( x
, y
, width
, height
);
3214 static void GLAPIENTRY
save_ShadeModel( GLenum mode
)
3216 GET_CURRENT_CONTEXT(ctx
);
3218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3219 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SHADE_MODEL
, 1 );
3223 if (ctx
->ExecuteFlag
) {
3224 (*ctx
->Exec
->ShadeModel
)( mode
);
3229 static void GLAPIENTRY
save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
3231 GET_CURRENT_CONTEXT(ctx
);
3233 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3234 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_FUNC
, 3 );
3240 if (ctx
->ExecuteFlag
) {
3241 (*ctx
->Exec
->StencilFunc
)( func
, ref
, mask
);
3246 static void GLAPIENTRY
save_StencilMask( GLuint mask
)
3248 GET_CURRENT_CONTEXT(ctx
);
3250 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3251 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_MASK
, 1 );
3255 if (ctx
->ExecuteFlag
) {
3256 (*ctx
->Exec
->StencilMask
)( mask
);
3261 static void GLAPIENTRY
save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
3263 GET_CURRENT_CONTEXT(ctx
);
3265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3266 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_OP
, 3 );
3272 if (ctx
->ExecuteFlag
) {
3273 (*ctx
->Exec
->StencilOp
)( fail
, zfail
, zpass
);
3278 static void GLAPIENTRY
3279 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3281 GET_CURRENT_CONTEXT(ctx
);
3283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3284 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3291 if (ctx
->ExecuteFlag
) {
3292 ctx
->Exec
->StencilFuncSeparate(face
, func
, ref
, mask
);
3297 static void GLAPIENTRY
3298 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3300 GET_CURRENT_CONTEXT(ctx
);
3302 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3303 n
= ALLOC_INSTRUCTION(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3308 if (ctx
->ExecuteFlag
) {
3309 ctx
->Exec
->StencilMaskSeparate(face
, mask
);
3314 static void GLAPIENTRY
3315 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3317 GET_CURRENT_CONTEXT(ctx
);
3319 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3320 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4 );
3327 if (ctx
->ExecuteFlag
) {
3328 ctx
->Exec
->StencilOpSeparate(face
, fail
, zfail
, zpass
);
3333 static void GLAPIENTRY
save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
3335 GET_CURRENT_CONTEXT(ctx
);
3337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3338 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXENV
, 6 );
3342 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3350 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3353 if (ctx
->ExecuteFlag
) {
3354 (*ctx
->Exec
->TexEnvfv
)( target
, pname
, params
);
3359 static void GLAPIENTRY
save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
3361 save_TexEnvfv( target
, pname
, ¶m
);
3365 static void GLAPIENTRY
save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
3368 p
[0] = (GLfloat
) param
;
3369 p
[1] = p
[2] = p
[3] = 0.0;
3370 save_TexEnvfv( target
, pname
, p
);
3374 static void GLAPIENTRY
save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
3377 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3378 p
[0] = INT_TO_FLOAT( param
[0] );
3379 p
[1] = INT_TO_FLOAT( param
[1] );
3380 p
[2] = INT_TO_FLOAT( param
[2] );
3381 p
[3] = INT_TO_FLOAT( param
[3] );
3384 p
[0] = (GLfloat
) param
[0];
3385 p
[1] = p
[2] = p
[3] = 0.0F
;
3387 save_TexEnvfv( target
, pname
, p
);
3391 static void GLAPIENTRY
save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
3393 GET_CURRENT_CONTEXT(ctx
);
3395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3396 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXGEN
, 6 );
3405 if (ctx
->ExecuteFlag
) {
3406 (*ctx
->Exec
->TexGenfv
)( coord
, pname
, params
);
3411 static void GLAPIENTRY
save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3414 p
[0] = (GLfloat
) params
[0];
3415 p
[1] = (GLfloat
) params
[1];
3416 p
[2] = (GLfloat
) params
[2];
3417 p
[3] = (GLfloat
) params
[3];
3418 save_TexGenfv(coord
, pname
, p
);
3422 static void GLAPIENTRY
save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3424 GLfloat p
= (GLfloat
) param
;
3425 save_TexGenfv( coord
, pname
, &p
);
3429 static void GLAPIENTRY
save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3432 p
[0] = (GLfloat
) params
[0];
3433 p
[1] = (GLfloat
) params
[1];
3434 p
[2] = (GLfloat
) params
[2];
3435 p
[3] = (GLfloat
) params
[3];
3436 save_TexGenfv( coord
, pname
, p
);
3440 static void GLAPIENTRY
save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
3442 save_TexGenfv(coord
, pname
, ¶m
);
3446 static void GLAPIENTRY
save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
3448 save_TexGeniv( coord
, pname
, ¶m
);
3452 static void GLAPIENTRY
save_TexParameterfv( GLenum target
,
3453 GLenum pname
, const GLfloat
*params
)
3455 GET_CURRENT_CONTEXT(ctx
);
3457 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3458 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXPARAMETER
, 6 );
3467 if (ctx
->ExecuteFlag
) {
3468 (*ctx
->Exec
->TexParameterfv
)( target
, pname
, params
);
3473 static void GLAPIENTRY
save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
3475 save_TexParameterfv(target
, pname
, ¶m
);
3479 static void GLAPIENTRY
save_TexParameteri( GLenum target
, GLenum pname
, GLint param
)
3482 fparam
[0] = (GLfloat
) param
;
3483 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3484 save_TexParameterfv(target
, pname
, fparam
);
3488 static void GLAPIENTRY
save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
3491 fparam
[0] = (GLfloat
) params
[0];
3492 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3493 save_TexParameterfv(target
, pname
, fparam
);
3497 static void GLAPIENTRY
save_TexImage1D( GLenum target
,
3498 GLint level
, GLint components
,
3499 GLsizei width
, GLint border
,
3500 GLenum format
, GLenum type
,
3501 const GLvoid
*pixels
)
3503 GET_CURRENT_CONTEXT(ctx
);
3504 if (target
== GL_PROXY_TEXTURE_1D
) {
3505 /* don't compile, execute immediately */
3506 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3507 border
, format
, type
, pixels
);
3510 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3511 pixels
, &ctx
->Unpack
);
3513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3514 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
3518 n
[3].i
= components
;
3519 n
[4].i
= (GLint
) width
;
3528 if (ctx
->ExecuteFlag
) {
3529 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3530 border
, format
, type
, pixels
);
3536 static void GLAPIENTRY
save_TexImage2D( GLenum target
,
3537 GLint level
, GLint components
,
3538 GLsizei width
, GLsizei height
, GLint border
,
3539 GLenum format
, GLenum type
,
3540 const GLvoid
*pixels
)
3542 GET_CURRENT_CONTEXT(ctx
);
3543 if (target
== GL_PROXY_TEXTURE_2D
) {
3544 /* don't compile, execute immediately */
3545 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3546 height
, border
, format
, type
, pixels
);
3549 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3550 pixels
, &ctx
->Unpack
);
3552 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3553 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
3557 n
[3].i
= components
;
3558 n
[4].i
= (GLint
) width
;
3559 n
[5].i
= (GLint
) height
;
3568 if (ctx
->ExecuteFlag
) {
3569 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3570 height
, border
, format
, type
, pixels
);
3576 static void GLAPIENTRY
save_TexImage3D( GLenum target
,
3577 GLint level
, GLint internalFormat
,
3578 GLsizei width
, GLsizei height
, GLsizei depth
,
3580 GLenum format
, GLenum type
,
3581 const GLvoid
*pixels
)
3583 GET_CURRENT_CONTEXT(ctx
);
3584 if (target
== GL_PROXY_TEXTURE_3D
) {
3585 /* don't compile, execute immediately */
3586 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3587 height
, depth
, border
, format
, type
, pixels
);
3591 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3592 pixels
, &ctx
->Unpack
);
3593 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3594 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
3598 n
[3].i
= (GLint
) internalFormat
;
3599 n
[4].i
= (GLint
) width
;
3600 n
[5].i
= (GLint
) height
;
3601 n
[6].i
= (GLint
) depth
;
3610 if (ctx
->ExecuteFlag
) {
3611 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3612 height
, depth
, border
, format
, type
, pixels
);
3618 static void GLAPIENTRY
save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
3619 GLsizei width
, GLenum format
, GLenum type
,
3620 const GLvoid
*pixels
)
3622 GET_CURRENT_CONTEXT(ctx
);
3624 GLvoid
*image
= unpack_image(1, width
, 1, 1, format
, type
,
3625 pixels
, &ctx
->Unpack
);
3626 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3627 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
3632 n
[4].i
= (GLint
) width
;
3640 if (ctx
->ExecuteFlag
) {
3641 (*ctx
->Exec
->TexSubImage1D
)( target
, level
, xoffset
, width
,
3642 format
, type
, pixels
);
3647 static void GLAPIENTRY
save_TexSubImage2D( GLenum target
, GLint level
,
3648 GLint xoffset
, GLint yoffset
,
3649 GLsizei width
, GLsizei height
,
3650 GLenum format
, GLenum type
,
3651 const GLvoid
*pixels
)
3653 GET_CURRENT_CONTEXT(ctx
);
3655 GLvoid
*image
= unpack_image(2, width
, height
, 1, format
, type
,
3656 pixels
, &ctx
->Unpack
);
3657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3658 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
3664 n
[5].i
= (GLint
) width
;
3665 n
[6].i
= (GLint
) height
;
3673 if (ctx
->ExecuteFlag
) {
3674 (*ctx
->Exec
->TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
3675 width
, height
, format
, type
, pixels
);
3680 static void GLAPIENTRY
save_TexSubImage3D( GLenum target
, GLint level
,
3681 GLint xoffset
, GLint yoffset
,GLint zoffset
,
3682 GLsizei width
, GLsizei height
, GLsizei depth
,
3683 GLenum format
, GLenum type
,
3684 const GLvoid
*pixels
)
3686 GET_CURRENT_CONTEXT(ctx
);
3688 GLvoid
*image
= unpack_image(3, width
, height
, depth
, format
, type
,
3689 pixels
, &ctx
->Unpack
);
3690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3691 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
3698 n
[6].i
= (GLint
) width
;
3699 n
[7].i
= (GLint
) height
;
3700 n
[8].i
= (GLint
) depth
;
3708 if (ctx
->ExecuteFlag
) {
3709 (*ctx
->Exec
->TexSubImage3D
)( target
, level
,
3710 xoffset
, yoffset
, zoffset
,
3711 width
, height
, depth
, format
, type
, pixels
);
3716 static void GLAPIENTRY
save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
3718 GET_CURRENT_CONTEXT(ctx
);
3720 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3721 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRANSLATE
, 3 );
3727 if (ctx
->ExecuteFlag
) {
3728 (*ctx
->Exec
->Translatef
)( x
, y
, z
);
3733 static void GLAPIENTRY
save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3735 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3740 static void GLAPIENTRY
save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3742 GET_CURRENT_CONTEXT(ctx
);
3744 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3745 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_VIEWPORT
, 4 );
3749 n
[3].i
= (GLint
) width
;
3750 n
[4].i
= (GLint
) height
;
3752 if (ctx
->ExecuteFlag
) {
3753 (*ctx
->Exec
->Viewport
)( x
, y
, width
, height
);
3758 static void GLAPIENTRY
save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3760 GET_CURRENT_CONTEXT(ctx
);
3762 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3763 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_WINDOW_POS
, 4 );
3770 if (ctx
->ExecuteFlag
) {
3771 (*ctx
->Exec
->WindowPos4fMESA
)( x
, y
, z
, w
);
3775 static void GLAPIENTRY
save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3777 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3780 static void GLAPIENTRY
save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3782 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3785 static void GLAPIENTRY
save_WindowPos2iMESA(GLint x
, GLint y
)
3787 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3790 static void GLAPIENTRY
save_WindowPos2sMESA(GLshort x
, GLshort y
)
3792 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3795 static void GLAPIENTRY
save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3797 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3800 static void GLAPIENTRY
save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3802 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3805 static void GLAPIENTRY
save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3807 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3810 static void GLAPIENTRY
save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3812 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3815 static void GLAPIENTRY
save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3817 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3820 static void GLAPIENTRY
save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3822 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3825 static void GLAPIENTRY
save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3827 save_WindowPos4fMESA(x
, y
, z
, w
);
3830 static void GLAPIENTRY
save_WindowPos2dvMESA(const GLdouble
*v
)
3832 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3835 static void GLAPIENTRY
save_WindowPos2fvMESA(const GLfloat
*v
)
3837 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3840 static void GLAPIENTRY
save_WindowPos2ivMESA(const GLint
*v
)
3842 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3845 static void GLAPIENTRY
save_WindowPos2svMESA(const GLshort
*v
)
3847 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3850 static void GLAPIENTRY
save_WindowPos3dvMESA(const GLdouble
*v
)
3852 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3855 static void GLAPIENTRY
save_WindowPos3fvMESA(const GLfloat
*v
)
3857 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3860 static void GLAPIENTRY
save_WindowPos3ivMESA(const GLint
*v
)
3862 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3865 static void GLAPIENTRY
save_WindowPos3svMESA(const GLshort
*v
)
3867 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3870 static void GLAPIENTRY
save_WindowPos4dvMESA(const GLdouble
*v
)
3872 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3873 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3876 static void GLAPIENTRY
save_WindowPos4fvMESA(const GLfloat
*v
)
3878 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3881 static void GLAPIENTRY
save_WindowPos4ivMESA(const GLint
*v
)
3883 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3884 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3887 static void GLAPIENTRY
save_WindowPos4svMESA(const GLshort
*v
)
3889 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3894 /* GL_ARB_multitexture */
3895 static void GLAPIENTRY
save_ActiveTextureARB( GLenum target
)
3897 GET_CURRENT_CONTEXT(ctx
);
3899 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3900 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3904 if (ctx
->ExecuteFlag
) {
3905 (*ctx
->Exec
->ActiveTextureARB
)( target
);
3910 /* GL_ARB_transpose_matrix */
3912 static void GLAPIENTRY
save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3915 _math_transposefd(tm
, m
);
3916 save_LoadMatrixf(tm
);
3920 static void GLAPIENTRY
save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3923 _math_transposef(tm
, m
);
3924 save_LoadMatrixf(tm
);
3928 static void GLAPIENTRY
3929 save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3932 _math_transposefd(tm
, m
);
3933 save_MultMatrixf(tm
);
3937 static void GLAPIENTRY
3938 save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3941 _math_transposef(tm
, m
);
3942 save_MultMatrixf(tm
);
3946 static void GLAPIENTRY
3947 save_PixelTexGenSGIX(GLenum mode
)
3949 GET_CURRENT_CONTEXT(ctx
);
3951 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3952 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_SGIX
, 1 );
3956 if (ctx
->ExecuteFlag
) {
3957 (*ctx
->Exec
->PixelTexGenSGIX
)( mode
);
3962 /* GL_ARB_texture_compression */
3963 static void GLAPIENTRY
3964 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3965 GLenum internalFormat
, GLsizei width
,
3966 GLint border
, GLsizei imageSize
,
3969 GET_CURRENT_CONTEXT(ctx
);
3970 if (target
== GL_PROXY_TEXTURE_1D
) {
3971 /* don't compile, execute immediately */
3972 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3973 width
, border
, imageSize
, data
);
3978 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3979 /* make copy of image */
3980 image
= MALLOC(imageSize
);
3982 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3985 MEMCPY(image
, data
, imageSize
);
3986 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7 );
3990 n
[3].e
= internalFormat
;
3991 n
[4].i
= (GLint
) width
;
3999 if (ctx
->ExecuteFlag
) {
4000 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
4001 width
, border
, imageSize
, data
);
4007 static void GLAPIENTRY
4008 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4009 GLenum internalFormat
, GLsizei width
,
4010 GLsizei height
, GLint border
, GLsizei imageSize
,
4013 GET_CURRENT_CONTEXT(ctx
);
4014 if (target
== GL_PROXY_TEXTURE_2D
) {
4015 /* don't compile, execute immediately */
4016 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
4017 width
, height
, border
, imageSize
, data
);
4022 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4023 /* make copy of image */
4024 image
= MALLOC(imageSize
);
4026 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
4029 MEMCPY(image
, data
, imageSize
);
4030 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8 );
4034 n
[3].e
= internalFormat
;
4035 n
[4].i
= (GLint
) width
;
4036 n
[5].i
= (GLint
) height
;
4044 if (ctx
->ExecuteFlag
) {
4045 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
4046 width
, height
, border
, imageSize
, data
);
4052 static void GLAPIENTRY
4053 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4054 GLenum internalFormat
, GLsizei width
,
4055 GLsizei height
, GLsizei depth
, GLint border
,
4056 GLsizei imageSize
, const GLvoid
*data
)
4058 GET_CURRENT_CONTEXT(ctx
);
4059 if (target
== GL_PROXY_TEXTURE_3D
) {
4060 /* don't compile, execute immediately */
4061 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
4062 width
, height
, depth
, border
, imageSize
, data
);
4067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4068 /* make copy of image */
4069 image
= MALLOC(imageSize
);
4071 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
4074 MEMCPY(image
, data
, imageSize
);
4075 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9 );
4079 n
[3].e
= internalFormat
;
4080 n
[4].i
= (GLint
) width
;
4081 n
[5].i
= (GLint
) height
;
4082 n
[6].i
= (GLint
) depth
;
4090 if (ctx
->ExecuteFlag
) {
4091 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
4092 width
, height
, depth
, border
, imageSize
, data
);
4098 static void GLAPIENTRY
4099 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4100 GLsizei width
, GLenum format
,
4101 GLsizei imageSize
, const GLvoid
*data
)
4106 GET_CURRENT_CONTEXT(ctx
);
4107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4109 /* make copy of image */
4110 image
= MALLOC(imageSize
);
4112 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
4115 MEMCPY(image
, data
, imageSize
);
4116 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7 );
4121 n
[4].i
= (GLint
) width
;
4129 if (ctx
->ExecuteFlag
) {
4130 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(target
, level
, xoffset
,
4131 width
, format
, imageSize
, data
);
4136 static void GLAPIENTRY
4137 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4138 GLint yoffset
, GLsizei width
, GLsizei height
,
4139 GLenum format
, GLsizei imageSize
,
4145 GET_CURRENT_CONTEXT(ctx
);
4146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4148 /* make copy of image */
4149 image
= MALLOC(imageSize
);
4151 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
4154 MEMCPY(image
, data
, imageSize
);
4155 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9 );
4161 n
[5].i
= (GLint
) width
;
4162 n
[6].i
= (GLint
) height
;
4170 if (ctx
->ExecuteFlag
) {
4171 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(target
, level
, xoffset
, yoffset
,
4172 width
, height
, format
, imageSize
, data
);
4177 static void GLAPIENTRY
4178 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4179 GLint yoffset
, GLint zoffset
, GLsizei width
,
4180 GLsizei height
, GLsizei depth
, GLenum format
,
4181 GLsizei imageSize
, const GLvoid
*data
)
4186 GET_CURRENT_CONTEXT(ctx
);
4187 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4189 /* make copy of image */
4190 image
= MALLOC(imageSize
);
4192 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
4195 MEMCPY(image
, data
, imageSize
);
4196 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11 );
4203 n
[6].i
= (GLint
) width
;
4204 n
[7].i
= (GLint
) height
;
4205 n
[8].i
= (GLint
) depth
;
4207 n
[10].i
= imageSize
;
4213 if (ctx
->ExecuteFlag
) {
4214 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(target
, level
, xoffset
, yoffset
,
4215 zoffset
, width
, height
, depth
, format
, imageSize
, data
);
4220 /* GL_ARB_multisample */
4221 static void GLAPIENTRY
4222 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4224 GET_CURRENT_CONTEXT(ctx
);
4226 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4227 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SAMPLE_COVERAGE
, 2 );
4232 if (ctx
->ExecuteFlag
) {
4233 (*ctx
->Exec
->SampleCoverageARB
)( value
, invert
);
4238 /* GL_SGIS_pixel_texture */
4240 static void GLAPIENTRY
4241 save_PixelTexGenParameteriSGIS(GLenum target
, GLint value
)
4243 GET_CURRENT_CONTEXT(ctx
);
4245 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4246 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
, 2 );
4251 if (ctx
->ExecuteFlag
) {
4252 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( target
, value
);
4257 static void GLAPIENTRY
4258 save_PixelTexGenParameterfSGIS(GLenum target
, GLfloat value
)
4260 save_PixelTexGenParameteriSGIS(target
, (GLint
) value
);
4264 static void GLAPIENTRY
4265 save_PixelTexGenParameterivSGIS(GLenum target
, const GLint
*value
)
4267 save_PixelTexGenParameteriSGIS(target
, *value
);
4271 static void GLAPIENTRY
4272 save_PixelTexGenParameterfvSGIS(GLenum target
, const GLfloat
*value
)
4274 save_PixelTexGenParameteriSGIS(target
, (GLint
) *value
);
4279 * GL_NV_vertex_program
4281 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4282 static void GLAPIENTRY
4283 save_BindProgramNV(GLenum target
, GLuint id
)
4285 GET_CURRENT_CONTEXT(ctx
);
4287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4288 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_PROGRAM_NV
, 2 );
4293 if (ctx
->ExecuteFlag
) {
4294 (*ctx
->Exec
->BindProgramNV
)( target
, id
);
4297 #endif /* FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4299 #if FEATURE_NV_vertex_program
4300 static void GLAPIENTRY
4301 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4303 GET_CURRENT_CONTEXT(ctx
);
4305 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4306 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6 );
4315 if (ctx
->ExecuteFlag
) {
4316 (*ctx
->Exec
->ExecuteProgramNV
)(target
, id
, params
);
4321 static void GLAPIENTRY
4322 save_ProgramParameter4fNV(GLenum target
, GLuint index
,
4323 GLfloat x
, GLfloat y
,
4324 GLfloat z
, GLfloat w
)
4326 GET_CURRENT_CONTEXT(ctx
);
4328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4329 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_PARAMETER4F_NV
, 6 );
4338 if (ctx
->ExecuteFlag
) {
4339 (*ctx
->Exec
->ProgramParameter4fNV
)(target
, index
, x
, y
, z
, w
);
4344 static void GLAPIENTRY
4345 save_ProgramParameter4fvNV(GLenum target
, GLuint index
, const GLfloat
*params
)
4347 save_ProgramParameter4fNV(target
, index
, params
[0], params
[1],
4348 params
[2], params
[3]);
4352 static void GLAPIENTRY
4353 save_ProgramParameter4dNV(GLenum target
, GLuint index
,
4354 GLdouble x
, GLdouble y
,
4355 GLdouble z
, GLdouble w
)
4357 save_ProgramParameter4fNV(target
, index
, (GLfloat
) x
, (GLfloat
) y
,
4358 (GLfloat
) z
, (GLfloat
) w
);
4362 static void GLAPIENTRY
4363 save_ProgramParameter4dvNV(GLenum target
, GLuint index
,
4364 const GLdouble
*params
)
4366 save_ProgramParameter4fNV(target
, index
, (GLfloat
) params
[0],
4367 (GLfloat
) params
[1], (GLfloat
) params
[2],
4368 (GLfloat
) params
[3]);
4372 static void GLAPIENTRY
4373 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4374 GLuint num
, const GLdouble
*params
)
4377 for (i
= 0; i
< num
; i
++) {
4378 save_ProgramParameter4dvNV(target
, index
+ i
, params
+ 4 * i
);
4383 static void GLAPIENTRY
4384 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4385 GLuint num
, const GLfloat
*params
)
4388 for (i
= 0; i
< num
; i
++) {
4389 save_ProgramParameter4fvNV(target
, index
+ i
, params
+ 4 * i
);
4394 static void GLAPIENTRY
4395 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4396 const GLubyte
*program
)
4398 GET_CURRENT_CONTEXT(ctx
);
4400 GLubyte
*programCopy
;
4402 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4404 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4407 _mesa_memcpy(programCopy
, program
, len
);
4409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4410 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_PROGRAM_NV
, 4 );
4415 n
[4].data
= programCopy
;
4417 if (ctx
->ExecuteFlag
) {
4418 (*ctx
->Exec
->LoadProgramNV
)(target
, id
, len
, program
);
4423 static void GLAPIENTRY
4424 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
*ids
)
4426 GET_CURRENT_CONTEXT(ctx
);
4428 GLuint
*idCopy
= (GLuint
*) _mesa_malloc(num
* sizeof(GLuint
));
4430 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4433 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4434 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4435 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRACK_MATRIX_NV
, 2 );
4440 if (ctx
->ExecuteFlag
) {
4441 (*ctx
->Exec
->RequestResidentProgramsNV
)(num
, ids
);
4446 static void GLAPIENTRY
4447 save_TrackMatrixNV(GLenum target
, GLuint address
,
4448 GLenum matrix
, GLenum transform
)
4450 GET_CURRENT_CONTEXT(ctx
);
4452 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4453 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRACK_MATRIX_NV
, 4 );
4460 if (ctx
->ExecuteFlag
) {
4461 (*ctx
->Exec
->TrackMatrixNV
)(target
, address
, matrix
, transform
);
4464 #endif /* FEATURE_NV_vertex_program */
4468 * GL_NV_fragment_program
4470 #if FEATURE_NV_fragment_program
4471 static void GLAPIENTRY
4472 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4473 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4475 GET_CURRENT_CONTEXT(ctx
);
4477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4478 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6 );
4487 if (ctx
->ExecuteFlag
) {
4488 (*ctx
->Exec
->ProgramLocalParameter4fARB
)(target
, index
, x
, y
, z
, w
);
4493 static void GLAPIENTRY
4494 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4495 const GLfloat
*params
)
4497 GET_CURRENT_CONTEXT(ctx
);
4499 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4500 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6 );
4509 if (ctx
->ExecuteFlag
) {
4510 (*ctx
->Exec
->ProgramLocalParameter4fvARB
)(target
, index
, params
);
4515 static void GLAPIENTRY
4516 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4517 GLdouble x
, GLdouble y
,
4518 GLdouble z
, GLdouble w
)
4520 GET_CURRENT_CONTEXT(ctx
);
4522 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4523 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6 );
4527 n
[3].f
= (GLfloat
) x
;
4528 n
[4].f
= (GLfloat
) y
;
4529 n
[5].f
= (GLfloat
) z
;
4530 n
[6].f
= (GLfloat
) w
;
4532 if (ctx
->ExecuteFlag
) {
4533 (*ctx
->Exec
->ProgramLocalParameter4dARB
)(target
, index
, x
, y
, z
, w
);
4538 static void GLAPIENTRY
4539 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4540 const GLdouble
*params
)
4542 GET_CURRENT_CONTEXT(ctx
);
4544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4545 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6 );
4549 n
[3].f
= (GLfloat
) params
[0];
4550 n
[4].f
= (GLfloat
) params
[1];
4551 n
[5].f
= (GLfloat
) params
[2];
4552 n
[6].f
= (GLfloat
) params
[3];
4554 if (ctx
->ExecuteFlag
) {
4555 (*ctx
->Exec
->ProgramLocalParameter4dvARB
)(target
, index
, params
);
4559 static void GLAPIENTRY
4560 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
4561 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4563 GET_CURRENT_CONTEXT(ctx
);
4565 GLubyte
*nameCopy
= (GLubyte
*) _mesa_malloc(len
);
4567 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4570 _mesa_memcpy(nameCopy
, name
, len
);
4572 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4573 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6 );
4577 n
[3].data
= nameCopy
;
4583 if (ctx
->ExecuteFlag
) {
4584 (*ctx
->Exec
->ProgramNamedParameter4fNV
)(id
, len
, name
, x
, y
, z
, w
);
4589 static void GLAPIENTRY
4590 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
4593 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4597 static void GLAPIENTRY
4598 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
4599 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4601 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4602 (GLfloat
) z
,(GLfloat
) w
);
4606 static void GLAPIENTRY
4607 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
4610 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4611 (GLfloat
) v
[1], (GLfloat
) v
[2],
4615 #endif /* FEATURE_NV_fragment_program */
4619 /* GL_EXT_stencil_two_side */
4620 static void GLAPIENTRY
save_ActiveStencilFaceEXT( GLenum face
)
4622 GET_CURRENT_CONTEXT(ctx
);
4624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4625 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1 );
4629 if (ctx
->ExecuteFlag
) {
4630 (*ctx
->Exec
->ActiveStencilFaceEXT
)( face
);
4635 /* GL_EXT_depth_bounds_test */
4636 static void GLAPIENTRY
save_DepthBoundsEXT( GLclampd zmin
, GLclampd zmax
)
4638 GET_CURRENT_CONTEXT(ctx
);
4640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4641 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2 );
4643 n
[1].f
= (GLfloat
) zmin
;
4644 n
[2].f
= (GLfloat
) zmax
;
4646 if (ctx
->ExecuteFlag
) {
4647 (*ctx
->Exec
->DepthBoundsEXT
)( zmin
, zmax
);
4653 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4655 static void GLAPIENTRY
4656 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4657 const GLvoid
*string
)
4659 GET_CURRENT_CONTEXT(ctx
);
4661 GLubyte
*programCopy
;
4663 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4665 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4668 _mesa_memcpy(programCopy
, string
, len
);
4670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4671 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_STRING_ARB
, 4 );
4676 n
[4].data
= programCopy
;
4678 if (ctx
->ExecuteFlag
) {
4679 (*ctx
->Exec
->ProgramStringARB
)(target
, format
, len
, string
);
4684 static void GLAPIENTRY
4685 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4686 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4688 GET_CURRENT_CONTEXT(ctx
);
4690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4691 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6 );
4700 if (ctx
->ExecuteFlag
) {
4701 (*ctx
->Exec
->ProgramEnvParameter4fARB
)( target
, index
, x
, y
, z
, w
);
4706 static void GLAPIENTRY
4707 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4708 const GLfloat
*params
)
4710 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4711 params
[2], params
[3]);
4715 static void GLAPIENTRY
4716 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4717 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4719 save_ProgramEnvParameter4fARB(target
, index
,
4727 static void GLAPIENTRY
4728 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4729 const GLdouble
*params
)
4731 save_ProgramEnvParameter4fARB(target
, index
,
4732 (GLfloat
) params
[0],
4733 (GLfloat
) params
[1],
4734 (GLfloat
) params
[2],
4735 (GLfloat
) params
[3]);
4738 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4741 #ifdef FEATURE_ARB_occlusion_query
4743 static void GLAPIENTRY
4744 save_BeginQueryARB(GLenum target
, GLuint id
)
4746 GET_CURRENT_CONTEXT(ctx
);
4748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4749 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BEGIN_QUERY_ARB
, 2 );
4754 if (ctx
->ExecuteFlag
) {
4755 (*ctx
->Exec
->BeginQueryARB
)( target
, id
);
4760 static void GLAPIENTRY
4761 save_EndQueryARB(GLenum target
)
4763 GET_CURRENT_CONTEXT(ctx
);
4765 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4766 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_END_QUERY_ARB
, 1 );
4770 if (ctx
->ExecuteFlag
) {
4771 (*ctx
->Exec
->EndQueryARB
)( target
);
4775 #endif /* FEATURE_ARB_occlusion_query */
4778 static void GLAPIENTRY
4779 save_DrawBuffersARB(GLsizei count
, const GLenum
*buffers
)
4781 GET_CURRENT_CONTEXT(ctx
);
4783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4784 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4788 if (count
> MAX_DRAW_BUFFERS
)
4789 count
= MAX_DRAW_BUFFERS
;
4790 for (i
= 0; i
< count
; i
++) {
4791 n
[2 + i
].e
= buffers
[i
];
4794 if (ctx
->ExecuteFlag
) {
4795 (*ctx
->Exec
->DrawBuffersARB
)(count
, buffers
);
4799 #if FEATURE_ATI_fragment_shader
4800 static void GLAPIENTRY
4801 save_BindFragmentShaderATI(GLuint id
)
4803 GET_CURRENT_CONTEXT(ctx
);
4806 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4810 if (ctx
->ExecuteFlag
) {
4811 (*ctx
->Exec
->BindFragmentShaderATI
)(id
);
4815 static void GLAPIENTRY
4816 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4818 GET_CURRENT_CONTEXT(ctx
);
4821 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4829 if (ctx
->ExecuteFlag
) {
4830 (*ctx
->Exec
->SetFragmentShaderConstantATI
)(dst
, value
);
4835 static void save_Attr1fNV( GLenum attr
, GLfloat x
)
4837 GET_CURRENT_CONTEXT(ctx
);
4839 SAVE_FLUSH_VERTICES( ctx
);
4840 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_1F_NV
, 2 );
4846 ASSERT(attr
< VERT_ATTRIB_MAX
);
4847 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4848 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4850 if (ctx
->ExecuteFlag
) {
4851 (*ctx
->Exec
->VertexAttrib1fNV
)( attr
, x
);
4855 static void save_Attr2fNV( GLenum attr
, GLfloat x
, GLfloat y
)
4857 GET_CURRENT_CONTEXT(ctx
);
4859 SAVE_FLUSH_VERTICES( ctx
);
4860 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_2F_NV
, 3 );
4867 ASSERT(attr
< VERT_ATTRIB_MAX
);
4868 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4869 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4871 if (ctx
->ExecuteFlag
) {
4872 (*ctx
->Exec
->VertexAttrib2fNV
)( attr
, x
, y
);
4876 static void save_Attr3fNV( GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4878 GET_CURRENT_CONTEXT(ctx
);
4880 SAVE_FLUSH_VERTICES( ctx
);
4881 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_3F_NV
, 4 );
4889 ASSERT(attr
< VERT_ATTRIB_MAX
);
4890 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4891 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4893 if (ctx
->ExecuteFlag
) {
4894 (*ctx
->Exec
->VertexAttrib3fNV
)( attr
, x
, y
, z
);
4898 static void save_Attr4fNV( GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
,
4901 GET_CURRENT_CONTEXT(ctx
);
4903 SAVE_FLUSH_VERTICES( ctx
);
4904 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_4F_NV
, 5 );
4913 ASSERT(attr
< VERT_ATTRIB_MAX
);
4914 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4915 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4917 if (ctx
->ExecuteFlag
) {
4918 (*ctx
->Exec
->VertexAttrib4fNV
)( attr
, x
, y
, z
, w
);
4923 static void save_Attr1fARB( GLenum attr
, GLfloat x
)
4925 GET_CURRENT_CONTEXT(ctx
);
4927 SAVE_FLUSH_VERTICES( ctx
);
4928 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_1F_ARB
, 2 );
4934 ASSERT(attr
< VERT_ATTRIB_MAX
);
4935 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4936 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4938 if (ctx
->ExecuteFlag
) {
4939 (*ctx
->Exec
->VertexAttrib1fARB
)( attr
, x
);
4943 static void save_Attr2fARB( GLenum attr
, GLfloat x
, GLfloat y
)
4945 GET_CURRENT_CONTEXT(ctx
);
4947 SAVE_FLUSH_VERTICES( ctx
);
4948 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_2F_ARB
, 3 );
4955 ASSERT(attr
< VERT_ATTRIB_MAX
);
4956 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4957 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4959 if (ctx
->ExecuteFlag
) {
4960 (*ctx
->Exec
->VertexAttrib2fARB
)( attr
, x
, y
);
4964 static void save_Attr3fARB( GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4966 GET_CURRENT_CONTEXT(ctx
);
4968 SAVE_FLUSH_VERTICES( ctx
);
4969 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_3F_ARB
, 4 );
4977 ASSERT(attr
< VERT_ATTRIB_MAX
);
4978 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4979 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4981 if (ctx
->ExecuteFlag
) {
4982 (*ctx
->Exec
->VertexAttrib3fARB
)( attr
, x
, y
, z
);
4986 static void save_Attr4fARB( GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
,
4989 GET_CURRENT_CONTEXT(ctx
);
4991 SAVE_FLUSH_VERTICES( ctx
);
4992 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ATTR_4F_ARB
, 5 );
5001 ASSERT(attr
< VERT_ATTRIB_MAX
);
5002 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5003 ASSIGN_4V( ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5005 if (ctx
->ExecuteFlag
) {
5006 (*ctx
->Exec
->VertexAttrib4fARB
)( attr
, x
, y
, z
, w
);
5011 static void GLAPIENTRY
save_EvalCoord1f( GLfloat x
)
5013 GET_CURRENT_CONTEXT(ctx
);
5015 SAVE_FLUSH_VERTICES( ctx
);
5016 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVAL_C1
, 1 );
5020 if (ctx
->ExecuteFlag
) {
5021 (*ctx
->Exec
->EvalCoord1f
)( x
);
5025 static void GLAPIENTRY
save_EvalCoord1fv( const GLfloat
*v
)
5027 save_EvalCoord1f( v
[0] );
5030 static void GLAPIENTRY
save_EvalCoord2f( GLfloat x
, GLfloat y
)
5032 GET_CURRENT_CONTEXT(ctx
);
5034 SAVE_FLUSH_VERTICES( ctx
);
5035 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVAL_C2
, 2 );
5040 if (ctx
->ExecuteFlag
) {
5041 (*ctx
->Exec
->EvalCoord2f
)( x
, y
);
5045 static void GLAPIENTRY
save_EvalCoord2fv( const GLfloat
*v
)
5047 save_EvalCoord2f( v
[0], v
[1] );
5051 static void GLAPIENTRY
save_EvalPoint1( GLint x
)
5053 GET_CURRENT_CONTEXT(ctx
);
5055 SAVE_FLUSH_VERTICES( ctx
);
5056 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVAL_P1
, 1 );
5060 if (ctx
->ExecuteFlag
) {
5061 (*ctx
->Exec
->EvalPoint1
)( x
);
5065 static void GLAPIENTRY
save_EvalPoint2( GLint x
, GLint y
)
5067 GET_CURRENT_CONTEXT(ctx
);
5069 SAVE_FLUSH_VERTICES( ctx
);
5070 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVAL_P2
, 2 );
5075 if (ctx
->ExecuteFlag
) {
5076 (*ctx
->Exec
->EvalPoint2
)( x
, y
);
5080 static void GLAPIENTRY
save_Indexf( GLfloat x
)
5082 GET_CURRENT_CONTEXT(ctx
);
5084 SAVE_FLUSH_VERTICES( ctx
);
5085 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_INDEX
, 1 );
5090 ctx
->ListState
.ActiveIndex
= 1;
5091 ctx
->ListState
.CurrentIndex
= x
;
5093 if (ctx
->ExecuteFlag
) {
5094 (*ctx
->Exec
->Indexi
)( (GLint
) x
);
5098 static void GLAPIENTRY
save_Indexfv( const GLfloat
*v
)
5100 save_Indexf( v
[0] );
5103 static void GLAPIENTRY
save_EdgeFlag( GLboolean x
)
5105 GET_CURRENT_CONTEXT(ctx
);
5107 SAVE_FLUSH_VERTICES( ctx
);
5108 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EDGEFLAG
, 1 );
5113 ctx
->ListState
.ActiveEdgeFlag
= 1;
5114 ctx
->ListState
.CurrentEdgeFlag
= x
;
5116 if (ctx
->ExecuteFlag
) {
5117 (*ctx
->Exec
->EdgeFlag
)( x
);
5121 static void GLAPIENTRY
save_EdgeFlagv( const GLboolean
*v
)
5123 save_EdgeFlag( v
[0] );
5126 static void GLAPIENTRY
save_Materialfv( GLenum face
, GLenum pname
, const GLfloat
*param
)
5128 GET_CURRENT_CONTEXT(ctx
);
5132 SAVE_FLUSH_VERTICES( ctx
);
5137 case GL_FRONT_AND_BACK
:
5140 _mesa_compile_error( ctx
, GL_INVALID_ENUM
, "material(face)" );
5149 case GL_AMBIENT_AND_DIFFUSE
:
5155 case GL_COLOR_INDEXES
:
5159 _mesa_compile_error( ctx
, GL_INVALID_ENUM
, "material(pname)" );
5163 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MATERIAL
, 6 );
5167 for (i
= 0 ; i
< args
; i
++)
5168 n
[3+i
].f
= param
[i
];
5172 GLuint bitmask
= _mesa_material_bitmask( ctx
, face
, pname
, ~0, NULL
);
5173 for (i
= 0 ; i
< MAT_ATTRIB_MAX
; i
++)
5174 if (bitmask
& (1<<i
)) {
5175 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5176 COPY_SZ_4V( ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5180 if (ctx
->ExecuteFlag
) {
5181 (*ctx
->Exec
->Materialfv
)( face
, pname
, param
);
5185 static void GLAPIENTRY
save_Begin( GLenum mode
)
5187 GET_CURRENT_CONTEXT(ctx
);
5189 GLboolean error
= GL_FALSE
;
5191 if (/*mode < GL_POINTS ||*/ mode
> GL_POLYGON
) {
5192 _mesa_compile_error( ctx
, GL_INVALID_ENUM
, "Begin (mode)");
5195 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5196 /* Typically the first begin. This may raise an error on
5197 * playback, depending on whether CallList is issued from inside
5198 * a begin/end or not.
5200 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5202 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5203 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5206 _mesa_compile_error( ctx
, GL_INVALID_OPERATION
, "recursive begin" );
5211 /* Give the driver an opportunity to hook in an optimized
5212 * display list compiler.
5214 if (ctx
->Driver
.NotifySaveBegin( ctx
, mode
))
5217 SAVE_FLUSH_VERTICES( ctx
);
5218 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BEGIN
, 1 );
5224 if (ctx
->ExecuteFlag
) {
5225 (*ctx
->Exec
->Begin
)( mode
);
5229 static void GLAPIENTRY
save_End( void )
5231 GET_CURRENT_CONTEXT(ctx
);
5232 SAVE_FLUSH_VERTICES( ctx
);
5233 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_END
, 0 );
5234 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5235 if (ctx
->ExecuteFlag
) {
5236 (*ctx
->Exec
->End
)( );
5240 static void GLAPIENTRY
save_Rectf( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5242 GET_CURRENT_CONTEXT(ctx
);
5244 SAVE_FLUSH_VERTICES( ctx
);
5245 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RECTF
, 4 );
5252 if (ctx
->ExecuteFlag
) {
5253 (*ctx
->Exec
->Rectf
)( a
, b
, c
, d
);
5258 static void GLAPIENTRY
save_Vertex2f( GLfloat x
, GLfloat y
)
5260 save_Attr2fNV( VERT_ATTRIB_POS
, x
, y
);
5263 static void GLAPIENTRY
save_Vertex2fv( const GLfloat
*v
)
5265 save_Attr2fNV( VERT_ATTRIB_POS
, v
[0], v
[1] );
5268 static void GLAPIENTRY
save_Vertex3f( GLfloat x
, GLfloat y
, GLfloat z
)
5270 save_Attr3fNV( VERT_ATTRIB_POS
, x
, y
, z
);
5273 static void GLAPIENTRY
save_Vertex3fv( const GLfloat
*v
)
5275 save_Attr3fNV( VERT_ATTRIB_POS
, v
[0], v
[1], v
[2] );
5278 static void GLAPIENTRY
save_Vertex4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5280 save_Attr4fNV( VERT_ATTRIB_POS
, x
, y
, z
, w
);
5283 static void GLAPIENTRY
save_Vertex4fv( const GLfloat
*v
)
5285 save_Attr4fNV( VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3] );
5288 static void GLAPIENTRY
save_TexCoord1f( GLfloat x
)
5290 save_Attr1fNV( VERT_ATTRIB_TEX0
, x
);
5293 static void GLAPIENTRY
save_TexCoord1fv( const GLfloat
*v
)
5295 save_Attr1fNV( VERT_ATTRIB_TEX0
, v
[0] );
5298 static void GLAPIENTRY
save_TexCoord2f( GLfloat x
, GLfloat y
)
5300 save_Attr2fNV( VERT_ATTRIB_TEX0
, x
, y
);
5303 static void GLAPIENTRY
save_TexCoord2fv( const GLfloat
*v
)
5305 save_Attr2fNV( VERT_ATTRIB_TEX0
, v
[0], v
[1] );
5308 static void GLAPIENTRY
save_TexCoord3f( GLfloat x
, GLfloat y
, GLfloat z
)
5310 save_Attr3fNV( VERT_ATTRIB_TEX0
, x
, y
, z
);
5313 static void GLAPIENTRY
save_TexCoord3fv( const GLfloat
*v
)
5315 save_Attr3fNV( VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2] );
5318 static void GLAPIENTRY
save_TexCoord4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5320 save_Attr4fNV( VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5323 static void GLAPIENTRY
save_TexCoord4fv( const GLfloat
*v
)
5325 save_Attr4fNV( VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3] );
5328 static void GLAPIENTRY
save_Normal3f( GLfloat x
, GLfloat y
, GLfloat z
)
5330 save_Attr3fNV( VERT_ATTRIB_NORMAL
, x
, y
, z
);
5333 static void GLAPIENTRY
save_Normal3fv( const GLfloat
*v
)
5335 save_Attr3fNV( VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2] );
5338 static void GLAPIENTRY
save_FogCoordfEXT( GLfloat x
)
5340 save_Attr1fNV( VERT_ATTRIB_FOG
, x
);
5343 static void GLAPIENTRY
save_FogCoordfvEXT( const GLfloat
*v
)
5345 save_Attr1fNV( VERT_ATTRIB_FOG
, v
[0] );
5348 static void GLAPIENTRY
save_Color3f( GLfloat x
, GLfloat y
, GLfloat z
)
5350 save_Attr3fNV( VERT_ATTRIB_COLOR0
, x
, y
, z
);
5353 static void GLAPIENTRY
save_Color3fv( const GLfloat
*v
)
5355 save_Attr3fNV( VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2] );
5358 static void GLAPIENTRY
save_Color4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5360 save_Attr4fNV( VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5363 static void GLAPIENTRY
save_Color4fv( const GLfloat
*v
)
5365 save_Attr4fNV( VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3] );
5368 static void GLAPIENTRY
save_SecondaryColor3fEXT( GLfloat x
, GLfloat y
, GLfloat z
)
5370 save_Attr3fNV( VERT_ATTRIB_COLOR1
, x
, y
, z
);
5373 static void GLAPIENTRY
save_SecondaryColor3fvEXT( const GLfloat
*v
)
5375 save_Attr3fNV( VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2] );
5379 /* Just call the respective ATTR for texcoord
5381 static void GLAPIENTRY
save_MultiTexCoord1f( GLenum target
, GLfloat x
)
5383 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5384 save_Attr1fNV( attr
, x
);
5387 static void GLAPIENTRY
save_MultiTexCoord1fv( GLenum target
, const GLfloat
*v
)
5389 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5390 save_Attr1fNV( attr
, v
[0] );
5393 static void GLAPIENTRY
save_MultiTexCoord2f( GLenum target
, GLfloat x
, GLfloat y
)
5395 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5396 save_Attr2fNV( attr
, x
, y
);
5399 static void GLAPIENTRY
save_MultiTexCoord2fv( GLenum target
, const GLfloat
*v
)
5401 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5402 save_Attr2fNV( attr
, v
[0], v
[1] );
5405 static void GLAPIENTRY
save_MultiTexCoord3f( GLenum target
, GLfloat x
, GLfloat y
,
5408 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5409 save_Attr3fNV( attr
, x
, y
, z
);
5412 static void GLAPIENTRY
save_MultiTexCoord3fv( GLenum target
, const GLfloat
*v
)
5414 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5415 save_Attr3fNV( attr
, v
[0], v
[1], v
[2] );
5418 static void GLAPIENTRY
save_MultiTexCoord4f( GLenum target
, GLfloat x
, GLfloat y
,
5419 GLfloat z
, GLfloat w
)
5421 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5422 save_Attr4fNV( attr
, x
, y
, z
, w
);
5425 static void GLAPIENTRY
save_MultiTexCoord4fv( GLenum target
, const GLfloat
*v
)
5427 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5428 save_Attr4fNV( attr
, v
[0], v
[1], v
[2], v
[3] );
5432 static void enum_error( void )
5434 GET_CURRENT_CONTEXT( ctx
);
5435 _mesa_error( ctx
, GL_INVALID_ENUM
, "VertexAttribfNV" );
5438 /* First level for NV_vertex_program:
5440 * Check for errors at compile time?.
5442 static void GLAPIENTRY
save_VertexAttrib1fNV( GLuint index
, GLfloat x
)
5444 if (index
< VERT_ATTRIB_MAX
)
5445 save_Attr1fNV( index
, x
);
5450 static void GLAPIENTRY
save_VertexAttrib1fvNV( GLuint index
, const GLfloat
*v
)
5452 if (index
< VERT_ATTRIB_MAX
)
5453 save_Attr1fNV( index
, v
[0] );
5458 static void GLAPIENTRY
save_VertexAttrib2fNV( GLuint index
, GLfloat x
, GLfloat y
)
5460 if (index
< VERT_ATTRIB_MAX
)
5461 save_Attr2fNV( index
, x
, y
);
5466 static void GLAPIENTRY
save_VertexAttrib2fvNV( GLuint index
, const GLfloat
*v
)
5468 if (index
< VERT_ATTRIB_MAX
)
5469 save_Attr2fNV( index
, v
[0], v
[1] );
5474 static void GLAPIENTRY
save_VertexAttrib3fNV( GLuint index
, GLfloat x
, GLfloat y
,
5477 if (index
< VERT_ATTRIB_MAX
)
5478 save_Attr3fNV( index
, x
, y
, z
);
5483 static void GLAPIENTRY
save_VertexAttrib3fvNV( GLuint index
, const GLfloat
*v
)
5485 if (index
< VERT_ATTRIB_MAX
)
5486 save_Attr3fNV( index
, v
[0], v
[1], v
[2] );
5491 static void GLAPIENTRY
save_VertexAttrib4fNV( GLuint index
, GLfloat x
, GLfloat y
,
5492 GLfloat z
, GLfloat w
)
5494 if (index
< VERT_ATTRIB_MAX
)
5495 save_Attr4fNV( index
, x
, y
, z
, w
);
5500 static void GLAPIENTRY
save_VertexAttrib4fvNV( GLuint index
, const GLfloat
*v
)
5502 if (index
< VERT_ATTRIB_MAX
)
5503 save_Attr4fNV( index
, v
[0], v
[1], v
[2], v
[3] );
5511 static void GLAPIENTRY
5512 save_VertexAttrib1fARB( GLuint index
, GLfloat x
)
5514 if (index
< VERT_ATTRIB_MAX
)
5515 save_Attr1fARB( index
, x
);
5520 static void GLAPIENTRY
5521 save_VertexAttrib1fvARB( GLuint index
, const GLfloat
*v
)
5523 if (index
< VERT_ATTRIB_MAX
)
5524 save_Attr1fARB( index
, v
[0] );
5529 static void GLAPIENTRY
5530 save_VertexAttrib2fARB( GLuint index
, GLfloat x
, GLfloat y
)
5532 if (index
< VERT_ATTRIB_MAX
)
5533 save_Attr2fARB( index
, x
, y
);
5538 static void GLAPIENTRY
5539 save_VertexAttrib2fvARB( GLuint index
, const GLfloat
*v
)
5541 if (index
< VERT_ATTRIB_MAX
)
5542 save_Attr2fARB( index
, v
[0], v
[1] );
5547 static void GLAPIENTRY
5548 save_VertexAttrib3fARB( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5550 if (index
< VERT_ATTRIB_MAX
)
5551 save_Attr3fARB( index
, x
, y
, z
);
5556 static void GLAPIENTRY
5557 save_VertexAttrib3fvARB( GLuint index
, const GLfloat
*v
)
5559 if (index
< VERT_ATTRIB_MAX
)
5560 save_Attr3fARB( index
, v
[0], v
[1], v
[2] );
5565 static void GLAPIENTRY
5566 save_VertexAttrib4fARB( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5568 if (index
< VERT_ATTRIB_MAX
)
5569 save_Attr4fARB( index
, x
, y
, z
, w
);
5574 static void GLAPIENTRY
5575 save_VertexAttrib4fvARB( GLuint index
, const GLfloat
*v
)
5577 if (index
< VERT_ATTRIB_MAX
)
5578 save_Attr4fARB( index
, v
[0], v
[1], v
[2], v
[3] );
5587 /* KW: Compile commands
5589 * Will appear in the list before the vertex buffer containing the
5590 * command that provoked the error. I don't see this as a problem.
5593 _mesa_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
5596 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ERROR
, 2 );
5599 n
[2].data
= (void *) s
;
5601 /* execute already done */
5606 * Compile an error into current display list.
5609 _mesa_compile_error( GLcontext
*ctx
, GLenum error
, const char *s
)
5611 if (ctx
->CompileFlag
)
5612 _mesa_save_error( ctx
, error
, s
);
5614 if (ctx
->ExecuteFlag
)
5615 _mesa_error( ctx
, error
, s
);
5621 islist(GLcontext
*ctx
, GLuint list
)
5623 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
5633 /**********************************************************************/
5634 /* Display list execution */
5635 /**********************************************************************/
5639 * Execute a display list. Note that the ListBase offset must have already
5640 * been added before calling this function. I.e. the list argument is
5641 * the absolute list number, not relative to ListBase.
5642 * \param list - display list number
5644 static void GLAPIENTRY
5645 execute_list( GLcontext
*ctx
, GLuint list
)
5647 struct mesa_display_list
*dlist
;
5651 if (list
== 0 || !islist(ctx
,list
))
5654 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
5655 /* raise an error? */
5660 dlist
= (struct mesa_display_list
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
5664 ctx
->ListState
.CallStack
[ctx
->ListState
.CallDepth
++] = dlist
;
5666 if (ctx
->Driver
.BeginCallList
)
5667 ctx
->Driver
.BeginCallList( ctx
, dlist
);
5673 OpCode opcode
= n
[0].opcode
;
5674 int i
= (int)n
[0].opcode
- (int)OPCODE_EXT_0
;
5676 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
5677 /* this is a driver-extended opcode */
5678 ctx
->ListExt
.Opcode
[i
].Execute(ctx
, &n
[1]);
5679 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
5684 _mesa_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
5687 (*ctx
->Exec
->Accum
)( n
[1].e
, n
[2].f
);
5689 case OPCODE_ALPHA_FUNC
:
5690 (*ctx
->Exec
->AlphaFunc
)( n
[1].e
, n
[2].f
);
5692 case OPCODE_BIND_TEXTURE
:
5693 (*ctx
->Exec
->BindTexture
)( n
[1].e
, n
[2].ui
);
5697 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5698 ctx
->Unpack
= ctx
->DefaultPacking
;
5699 (*ctx
->Exec
->Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
5700 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (const GLubyte
*) n
[7].data
);
5701 ctx
->Unpack
= save
; /* restore */
5704 case OPCODE_BLEND_COLOR
:
5705 (*ctx
->Exec
->BlendColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
5707 case OPCODE_BLEND_EQUATION
:
5708 (*ctx
->Exec
->BlendEquation
)( n
[1].e
);
5710 case OPCODE_BLEND_EQUATION_SEPARATE
:
5711 (*ctx
->Exec
->BlendEquationSeparateEXT
)( n
[1].e
, n
[2].e
);
5713 case OPCODE_BLEND_FUNC_SEPARATE
:
5714 (*ctx
->Exec
->BlendFuncSeparateEXT
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
5716 case OPCODE_CALL_LIST
:
5717 /* Generated by glCallList(), don't add ListBase */
5718 if (ctx
->ListState
.CallDepth
<MAX_LIST_NESTING
) {
5719 execute_list( ctx
, n
[1].ui
);
5722 case OPCODE_CALL_LIST_OFFSET
:
5723 /* Generated by glCallLists() so we must add ListBase */
5725 /* user specified a bad data type at compile time */
5726 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5728 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
5729 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
5733 (*ctx
->Exec
->Clear
)( n
[1].bf
);
5735 case OPCODE_CLEAR_COLOR
:
5736 (*ctx
->Exec
->ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
5738 case OPCODE_CLEAR_ACCUM
:
5739 (*ctx
->Exec
->ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
5741 case OPCODE_CLEAR_DEPTH
:
5742 (*ctx
->Exec
->ClearDepth
)( (GLclampd
) n
[1].f
);
5744 case OPCODE_CLEAR_INDEX
:
5745 (*ctx
->Exec
->ClearIndex
)( (GLfloat
) n
[1].ui
);
5747 case OPCODE_CLEAR_STENCIL
:
5748 (*ctx
->Exec
->ClearStencil
)( n
[1].i
);
5750 case OPCODE_CLIP_PLANE
:
5757 (*ctx
->Exec
->ClipPlane
)( n
[1].e
, eq
);
5760 case OPCODE_COLOR_MASK
:
5761 (*ctx
->Exec
->ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
5763 case OPCODE_COLOR_MATERIAL
:
5764 (*ctx
->Exec
->ColorMaterial
)( n
[1].e
, n
[2].e
);
5766 case OPCODE_COLOR_TABLE
:
5768 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5769 ctx
->Unpack
= ctx
->DefaultPacking
;
5770 (*ctx
->Exec
->ColorTable
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
5771 n
[5].e
, n
[6].data
);
5772 ctx
->Unpack
= save
; /* restore */
5775 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5782 (*ctx
->Exec
->ColorTableParameterfv
)( n
[1].e
, n
[2].e
, params
);
5785 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5792 (*ctx
->Exec
->ColorTableParameteriv
)( n
[1].e
, n
[2].e
, params
);
5795 case OPCODE_COLOR_SUB_TABLE
:
5797 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5798 ctx
->Unpack
= ctx
->DefaultPacking
;
5799 (*ctx
->Exec
->ColorSubTable
)( n
[1].e
, n
[2].i
, n
[3].i
,
5800 n
[4].e
, n
[5].e
, n
[6].data
);
5801 ctx
->Unpack
= save
; /* restore */
5804 case OPCODE_CONVOLUTION_FILTER_1D
:
5806 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5807 ctx
->Unpack
= ctx
->DefaultPacking
;
5808 (*ctx
->Exec
->ConvolutionFilter1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
5809 n
[4].e
, n
[5].e
, n
[6].data
);
5810 ctx
->Unpack
= save
; /* restore */
5813 case OPCODE_CONVOLUTION_FILTER_2D
:
5815 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5816 ctx
->Unpack
= ctx
->DefaultPacking
;
5817 (*ctx
->Exec
->ConvolutionFilter2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
5818 n
[4].i
, n
[5].e
, n
[6].e
, n
[7].data
);
5819 ctx
->Unpack
= save
; /* restore */
5822 case OPCODE_CONVOLUTION_PARAMETER_I
:
5823 (*ctx
->Exec
->ConvolutionParameteri
)( n
[1].e
, n
[2].e
, n
[3].i
);
5825 case OPCODE_CONVOLUTION_PARAMETER_IV
:
5832 (*ctx
->Exec
->ConvolutionParameteriv
)( n
[1].e
, n
[2].e
, params
);
5835 case OPCODE_CONVOLUTION_PARAMETER_F
:
5836 (*ctx
->Exec
->ConvolutionParameterf
)( n
[1].e
, n
[2].e
, n
[3].f
);
5838 case OPCODE_CONVOLUTION_PARAMETER_FV
:
5845 (*ctx
->Exec
->ConvolutionParameterfv
)( n
[1].e
, n
[2].e
, params
);
5848 case OPCODE_COPY_COLOR_SUB_TABLE
:
5849 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
5850 n
[3].i
, n
[4].i
, n
[5].i
);
5852 case OPCODE_COPY_COLOR_TABLE
:
5853 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
5854 n
[3].i
, n
[4].i
, n
[5].i
);
5856 case OPCODE_COPY_PIXELS
:
5857 (*ctx
->Exec
->CopyPixels
)( n
[1].i
, n
[2].i
,
5858 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
5860 case OPCODE_COPY_TEX_IMAGE1D
:
5861 (*ctx
->Exec
->CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5862 n
[5].i
, n
[6].i
, n
[7].i
);
5864 case OPCODE_COPY_TEX_IMAGE2D
:
5865 (*ctx
->Exec
->CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
5866 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
5868 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
5869 (*ctx
->Exec
->CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
5870 n
[4].i
, n
[5].i
, n
[6].i
);
5872 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
5873 (*ctx
->Exec
->CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
5874 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
5876 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
5877 (*ctx
->Exec
->CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
5878 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
5880 case OPCODE_CULL_FACE
:
5881 (*ctx
->Exec
->CullFace
)( n
[1].e
);
5883 case OPCODE_DEPTH_FUNC
:
5884 (*ctx
->Exec
->DepthFunc
)( n
[1].e
);
5886 case OPCODE_DEPTH_MASK
:
5887 (*ctx
->Exec
->DepthMask
)( n
[1].b
);
5889 case OPCODE_DEPTH_RANGE
:
5890 (*ctx
->Exec
->DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
5892 case OPCODE_DISABLE
:
5893 (*ctx
->Exec
->Disable
)( n
[1].e
);
5895 case OPCODE_DRAW_BUFFER
:
5896 (*ctx
->Exec
->DrawBuffer
)( n
[1].e
);
5898 case OPCODE_DRAW_PIXELS
:
5900 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5901 ctx
->Unpack
= ctx
->DefaultPacking
;
5902 (*ctx
->Exec
->DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
5904 ctx
->Unpack
= save
; /* restore */
5908 (*ctx
->Exec
->Enable
)( n
[1].e
);
5910 case OPCODE_EVALMESH1
:
5911 (*ctx
->Exec
->EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
5913 case OPCODE_EVALMESH2
:
5914 (*ctx
->Exec
->EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
5923 (*ctx
->Exec
->Fogfv
)( n
[1].e
, p
);
5926 case OPCODE_FRONT_FACE
:
5927 (*ctx
->Exec
->FrontFace
)( n
[1].e
);
5929 case OPCODE_FRUSTUM
:
5930 (*ctx
->Exec
->Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5933 (*ctx
->Exec
->Hint
)( n
[1].e
, n
[2].e
);
5935 case OPCODE_HISTOGRAM
:
5936 (*ctx
->Exec
->Histogram
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
);
5938 case OPCODE_INDEX_MASK
:
5939 (*ctx
->Exec
->IndexMask
)( n
[1].ui
);
5941 case OPCODE_INIT_NAMES
:
5942 (*ctx
->Exec
->InitNames
)();
5951 (*ctx
->Exec
->Lightfv
)( n
[1].e
, n
[2].e
, p
);
5954 case OPCODE_LIGHT_MODEL
:
5961 (*ctx
->Exec
->LightModelfv
)( n
[1].e
, p
);
5964 case OPCODE_LINE_STIPPLE
:
5965 (*ctx
->Exec
->LineStipple
)( n
[1].i
, n
[2].us
);
5967 case OPCODE_LINE_WIDTH
:
5968 (*ctx
->Exec
->LineWidth
)( n
[1].f
);
5970 case OPCODE_LIST_BASE
:
5971 (*ctx
->Exec
->ListBase
)( n
[1].ui
);
5973 case OPCODE_LOAD_IDENTITY
:
5974 (*ctx
->Exec
->LoadIdentity
)();
5976 case OPCODE_LOAD_MATRIX
:
5977 if (sizeof(Node
)==sizeof(GLfloat
)) {
5978 (*ctx
->Exec
->LoadMatrixf
)( &n
[1].f
);
5983 for (i
=0;i
<16;i
++) {
5986 (*ctx
->Exec
->LoadMatrixf
)( m
);
5989 case OPCODE_LOAD_NAME
:
5990 (*ctx
->Exec
->LoadName
)( n
[1].ui
);
5992 case OPCODE_LOGIC_OP
:
5993 (*ctx
->Exec
->LogicOp
)( n
[1].e
);
5997 GLenum target
= n
[1].e
;
5998 GLint ustride
= _mesa_evaluator_components(target
);
5999 GLint uorder
= n
[5].i
;
6000 GLfloat u1
= n
[2].f
;
6001 GLfloat u2
= n
[3].f
;
6002 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, ustride
, uorder
,
6003 (GLfloat
*) n
[6].data
);
6008 GLenum target
= n
[1].e
;
6009 GLfloat u1
= n
[2].f
;
6010 GLfloat u2
= n
[3].f
;
6011 GLfloat v1
= n
[4].f
;
6012 GLfloat v2
= n
[5].f
;
6013 GLint ustride
= n
[6].i
;
6014 GLint vstride
= n
[7].i
;
6015 GLint uorder
= n
[8].i
;
6016 GLint vorder
= n
[9].i
;
6017 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
6018 v1
, v2
, vstride
, vorder
,
6019 (GLfloat
*) n
[10].data
);
6022 case OPCODE_MAPGRID1
:
6023 (*ctx
->Exec
->MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
6025 case OPCODE_MAPGRID2
:
6026 (*ctx
->Exec
->MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
6028 case OPCODE_MATRIX_MODE
:
6029 (*ctx
->Exec
->MatrixMode
)( n
[1].e
);
6031 case OPCODE_MIN_MAX
:
6032 (*ctx
->Exec
->Minmax
)(n
[1].e
, n
[2].e
, n
[3].b
);
6034 case OPCODE_MULT_MATRIX
:
6035 if (sizeof(Node
)==sizeof(GLfloat
)) {
6036 (*ctx
->Exec
->MultMatrixf
)( &n
[1].f
);
6041 for (i
=0;i
<16;i
++) {
6044 (*ctx
->Exec
->MultMatrixf
)( m
);
6048 (*ctx
->Exec
->Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6050 case OPCODE_PASSTHROUGH
:
6051 (*ctx
->Exec
->PassThrough
)( n
[1].f
);
6053 case OPCODE_PIXEL_MAP
:
6054 (*ctx
->Exec
->PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
6056 case OPCODE_PIXEL_TRANSFER
:
6057 (*ctx
->Exec
->PixelTransferf
)( n
[1].e
, n
[2].f
);
6059 case OPCODE_PIXEL_ZOOM
:
6060 (*ctx
->Exec
->PixelZoom
)( n
[1].f
, n
[2].f
);
6062 case OPCODE_POINT_SIZE
:
6063 (*ctx
->Exec
->PointSize
)( n
[1].f
);
6065 case OPCODE_POINT_PARAMETERS
:
6071 (*ctx
->Exec
->PointParameterfvEXT
)( n
[1].e
, params
);
6074 case OPCODE_POLYGON_MODE
:
6075 (*ctx
->Exec
->PolygonMode
)( n
[1].e
, n
[2].e
);
6077 case OPCODE_POLYGON_STIPPLE
:
6078 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) n
[1].data
);
6080 case OPCODE_POLYGON_OFFSET
:
6081 (*ctx
->Exec
->PolygonOffset
)( n
[1].f
, n
[2].f
);
6083 case OPCODE_POP_ATTRIB
:
6084 (*ctx
->Exec
->PopAttrib
)();
6086 case OPCODE_POP_MATRIX
:
6087 (*ctx
->Exec
->PopMatrix
)();
6089 case OPCODE_POP_NAME
:
6090 (*ctx
->Exec
->PopName
)();
6092 case OPCODE_PRIORITIZE_TEXTURE
:
6093 (*ctx
->Exec
->PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
6095 case OPCODE_PUSH_ATTRIB
:
6096 (*ctx
->Exec
->PushAttrib
)( n
[1].bf
);
6098 case OPCODE_PUSH_MATRIX
:
6099 (*ctx
->Exec
->PushMatrix
)();
6101 case OPCODE_PUSH_NAME
:
6102 (*ctx
->Exec
->PushName
)( n
[1].ui
);
6104 case OPCODE_RASTER_POS
:
6105 (*ctx
->Exec
->RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6107 case OPCODE_READ_BUFFER
:
6108 (*ctx
->Exec
->ReadBuffer
)( n
[1].e
);
6110 case OPCODE_RESET_HISTOGRAM
:
6111 (*ctx
->Exec
->ResetHistogram
)( n
[1].e
);
6113 case OPCODE_RESET_MIN_MAX
:
6114 (*ctx
->Exec
->ResetMinmax
)( n
[1].e
);
6117 (*ctx
->Exec
->Rotatef
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6120 (*ctx
->Exec
->Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
6122 case OPCODE_SCISSOR
:
6123 (*ctx
->Exec
->Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
6125 case OPCODE_SHADE_MODEL
:
6126 (*ctx
->Exec
->ShadeModel
)( n
[1].e
);
6128 case OPCODE_STENCIL_FUNC
:
6129 (*ctx
->Exec
->StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
6131 case OPCODE_STENCIL_MASK
:
6132 (*ctx
->Exec
->StencilMask
)( n
[1].ui
);
6134 case OPCODE_STENCIL_OP
:
6135 (*ctx
->Exec
->StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
6137 case OPCODE_STENCIL_FUNC_SEPARATE
:
6138 ctx
->Exec
->StencilFuncSeparate( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
);
6140 case OPCODE_STENCIL_MASK_SEPARATE
:
6141 ctx
->Exec
->StencilMaskSeparate( n
[1].e
, n
[2].ui
);
6143 case OPCODE_STENCIL_OP_SEPARATE
:
6144 ctx
->Exec
->StencilOpSeparate( n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
6153 (*ctx
->Exec
->TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
6163 (*ctx
->Exec
->TexGenfv
)( n
[1].e
, n
[2].e
, params
);
6166 case OPCODE_TEXPARAMETER
:
6173 (*ctx
->Exec
->TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
6176 case OPCODE_TEX_IMAGE1D
:
6178 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6179 ctx
->Unpack
= ctx
->DefaultPacking
;
6180 (*ctx
->Exec
->TexImage1D
)(
6181 n
[1].e
, /* target */
6183 n
[3].i
, /* components */
6185 n
[5].e
, /* border */
6186 n
[6].e
, /* format */
6189 ctx
->Unpack
= save
; /* restore */
6192 case OPCODE_TEX_IMAGE2D
:
6194 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6195 ctx
->Unpack
= ctx
->DefaultPacking
;
6196 (*ctx
->Exec
->TexImage2D
)(
6197 n
[1].e
, /* target */
6199 n
[3].i
, /* components */
6201 n
[5].i
, /* height */
6202 n
[6].e
, /* border */
6203 n
[7].e
, /* format */
6206 ctx
->Unpack
= save
; /* restore */
6209 case OPCODE_TEX_IMAGE3D
:
6211 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6212 ctx
->Unpack
= ctx
->DefaultPacking
;
6213 (*ctx
->Exec
->TexImage3D
)(
6214 n
[1].e
, /* target */
6216 n
[3].i
, /* components */
6218 n
[5].i
, /* height */
6220 n
[7].e
, /* border */
6221 n
[8].e
, /* format */
6224 ctx
->Unpack
= save
; /* restore */
6227 case OPCODE_TEX_SUB_IMAGE1D
:
6229 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6230 ctx
->Unpack
= ctx
->DefaultPacking
;
6231 (*ctx
->Exec
->TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
6233 n
[6].e
, n
[7].data
);
6234 ctx
->Unpack
= save
; /* restore */
6237 case OPCODE_TEX_SUB_IMAGE2D
:
6239 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6240 ctx
->Unpack
= ctx
->DefaultPacking
;
6241 (*ctx
->Exec
->TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
6243 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
6244 ctx
->Unpack
= save
; /* restore */
6247 case OPCODE_TEX_SUB_IMAGE3D
:
6249 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6250 ctx
->Unpack
= ctx
->DefaultPacking
;
6251 (*ctx
->Exec
->TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
6252 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
6253 n
[8].i
, n
[9].e
, n
[10].e
,
6255 ctx
->Unpack
= save
; /* restore */
6258 case OPCODE_TRANSLATE
:
6259 (*ctx
->Exec
->Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
6261 case OPCODE_VIEWPORT
:
6262 (*ctx
->Exec
->Viewport
)(n
[1].i
, n
[2].i
,
6263 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
6265 case OPCODE_WINDOW_POS
:
6266 (*ctx
->Exec
->WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6268 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
6269 (*ctx
->Exec
->ActiveTextureARB
)( n
[1].e
);
6271 case OPCODE_PIXEL_TEXGEN_SGIX
: /* GL_SGIX_pixel_texture */
6272 (*ctx
->Exec
->PixelTexGenSGIX
)( n
[1].e
);
6274 case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
: /* GL_SGIS_pixel_texture */
6275 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( n
[1].e
, n
[2].i
);
6277 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
6278 (*ctx
->Exec
->CompressedTexImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
6279 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].data
);
6281 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
6282 (*ctx
->Exec
->CompressedTexImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
6283 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].data
);
6285 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
6286 (*ctx
->Exec
->CompressedTexImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
6287 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].data
);
6289 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
6290 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
6291 n
[4].i
, n
[5].e
, n
[6].i
, n
[7].data
);
6293 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
6294 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
6295 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
, n
[9].data
);
6297 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
6298 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
6299 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
6300 n
[9].e
, n
[10].i
, n
[11].data
);
6302 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
6303 (*ctx
->Exec
->SampleCoverageARB
)(n
[1].f
, n
[2].b
);
6305 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
6306 (*ctx
->Exec
->WindowPos3fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
);
6308 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6309 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
6310 (*ctx
->Exec
->BindProgramNV
)( n
[1].e
, n
[2].ui
);
6313 #if FEATURE_NV_vertex_program
6314 case OPCODE_EXECUTE_PROGRAM_NV
:
6321 (*ctx
->Exec
->ExecuteProgramNV
)(n
[1].e
, n
[2].ui
, v
);
6324 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
6325 (*ctx
->Exec
->RequestResidentProgramsNV
)(n
[1].ui
,
6326 (GLuint
*) n
[2].data
);
6328 case OPCODE_LOAD_PROGRAM_NV
:
6329 (*ctx
->Exec
->LoadProgramNV
)(n
[1].e
, n
[2].ui
, n
[3].i
,
6330 (const GLubyte
*) n
[4].data
);
6332 case OPCODE_PROGRAM_PARAMETER4F_NV
:
6333 (*ctx
->Exec
->ProgramParameter4fNV
)(n
[1].e
, n
[2].ui
, n
[3].f
,
6334 n
[4].f
, n
[5].f
, n
[6].f
);
6336 case OPCODE_TRACK_MATRIX_NV
:
6337 (*ctx
->Exec
->TrackMatrixNV
)(n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
);
6341 #if FEATURE_NV_fragment_program
6342 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
6343 (*ctx
->Exec
->ProgramLocalParameter4fARB
)(n
[1].e
, n
[2].ui
, n
[3].f
,
6344 n
[4].f
, n
[5].f
, n
[6].f
);
6346 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
6347 (*ctx
->Exec
->ProgramNamedParameter4fNV
)(n
[1].ui
, n
[2].i
,
6348 (const GLubyte
*) n
[3].data
,
6349 n
[4].f
, n
[5].f
, n
[6].f
, n
[7].f
);
6353 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
6354 (*ctx
->Exec
->ActiveStencilFaceEXT
)(n
[1].e
);
6356 case OPCODE_DEPTH_BOUNDS_EXT
:
6357 (*ctx
->Exec
->DepthBoundsEXT
)(n
[1].f
, n
[2].f
);
6359 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6360 case OPCODE_PROGRAM_STRING_ARB
:
6361 (*ctx
->Exec
->ProgramStringARB
)(n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
);
6363 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
6364 (*ctx
->Exec
->ProgramEnvParameter4fARB
)(n
[1].e
, n
[2].ui
, n
[3].f
,
6365 n
[4].f
, n
[5].f
, n
[6].f
);
6368 #if FEATURE_ARB_occlusion_query
6369 case OPCODE_BEGIN_QUERY_ARB
:
6370 ctx
->Exec
->BeginQueryARB(n
[1].e
, n
[2].ui
);
6372 case OPCODE_END_QUERY_ARB
:
6373 ctx
->Exec
->EndQueryARB(n
[1].e
);
6376 case OPCODE_DRAW_BUFFERS_ARB
:
6378 GLenum buffers
[MAX_DRAW_BUFFERS
];
6379 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
6380 for (i
= 0; i
< count
; i
++)
6381 buffers
[i
] = n
[2 + i
].e
;
6382 ctx
->Exec
->DrawBuffersARB(n
[1].i
, buffers
);
6385 #if FEATURE_ATI_fragment_shader
6386 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
6387 ctx
->Exec
->BindFragmentShaderATI(n
[1].i
);
6389 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
6392 GLuint i
, dst
= n
[1].ui
;
6394 for (i
= 0; i
< 4; i
++)
6395 values
[i
] = n
[1+i
].f
;
6396 ctx
->Exec
->SetFragmentShaderConstantATI(dst
, values
);
6400 case OPCODE_ATTR_1F_NV
:
6401 (*ctx
->Exec
->VertexAttrib1fNV
)(n
[1].e
, n
[2].f
);
6403 case OPCODE_ATTR_2F_NV
:
6404 /* Really shouldn't have to do this - the Node structure
6405 * is convenient, but it would be better to store the data
6406 * packed appropriately so that it can be sent directly
6407 * on. With x86_64 becoming common, this will start to
6410 if (sizeof(Node
)==sizeof(GLfloat
))
6411 (*ctx
->Exec
->VertexAttrib2fvNV
)(n
[1].e
, &n
[2].f
);
6413 (*ctx
->Exec
->VertexAttrib2fNV
)(n
[1].e
, n
[2].f
, n
[3].f
);
6415 case OPCODE_ATTR_3F_NV
:
6416 if (sizeof(Node
)==sizeof(GLfloat
))
6417 (*ctx
->Exec
->VertexAttrib3fvNV
)(n
[1].e
, &n
[2].f
);
6419 (*ctx
->Exec
->VertexAttrib3fNV
)(n
[1].e
, n
[2].f
, n
[3].f
,
6422 case OPCODE_ATTR_4F_NV
:
6423 if (sizeof(Node
)==sizeof(GLfloat
))
6424 (*ctx
->Exec
->VertexAttrib4fvNV
)(n
[1].e
, &n
[2].f
);
6426 (*ctx
->Exec
->VertexAttrib4fNV
)(n
[1].e
, n
[2].f
, n
[3].f
,
6429 case OPCODE_ATTR_1F_ARB
:
6430 (*ctx
->Exec
->VertexAttrib1fARB
)(n
[1].e
, n
[2].f
);
6432 case OPCODE_ATTR_2F_ARB
:
6433 /* Really shouldn't have to do this - the Node structure
6434 * is convenient, but it would be better to store the data
6435 * packed appropriately so that it can be sent directly
6436 * on. With x86_64 becoming common, this will start to
6439 if (sizeof(Node
)==sizeof(GLfloat
))
6440 (*ctx
->Exec
->VertexAttrib2fvARB
)(n
[1].e
, &n
[2].f
);
6442 (*ctx
->Exec
->VertexAttrib2fARB
)(n
[1].e
, n
[2].f
, n
[3].f
);
6444 case OPCODE_ATTR_3F_ARB
:
6445 if (sizeof(Node
)==sizeof(GLfloat
))
6446 (*ctx
->Exec
->VertexAttrib3fvARB
)(n
[1].e
, &n
[2].f
);
6448 (*ctx
->Exec
->VertexAttrib3fARB
)(n
[1].e
, n
[2].f
, n
[3].f
,
6451 case OPCODE_ATTR_4F_ARB
:
6452 if (sizeof(Node
)==sizeof(GLfloat
))
6453 (*ctx
->Exec
->VertexAttrib4fvARB
)(n
[1].e
, &n
[2].f
);
6455 (*ctx
->Exec
->VertexAttrib4fARB
)(n
[1].e
, n
[2].f
, n
[3].f
,
6458 case OPCODE_MATERIAL
:
6459 if (sizeof(Node
)==sizeof(GLfloat
))
6460 (*ctx
->Exec
->Materialfv
)(n
[1].e
, n
[2].e
, &n
[3].f
);
6467 (*ctx
->Exec
->Materialfv
)(n
[1].e
, n
[2].e
, f
);
6471 (*ctx
->Exec
->Indexi
)(n
[1].i
);
6473 case OPCODE_EDGEFLAG
:
6474 (*ctx
->Exec
->EdgeFlag
)(n
[1].b
);
6477 (*ctx
->Exec
->Begin
)(n
[1].e
);
6480 (*ctx
->Exec
->End
)();
6483 (*ctx
->Exec
->Rectf
)(n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6485 case OPCODE_EVAL_C1
:
6486 (*ctx
->Exec
->EvalCoord1f
)(n
[1].f
);
6488 case OPCODE_EVAL_C2
:
6489 (*ctx
->Exec
->EvalCoord2f
)(n
[1].f
, n
[2].f
);
6491 case OPCODE_EVAL_P1
:
6492 (*ctx
->Exec
->EvalPoint1
)(n
[1].i
);
6494 case OPCODE_EVAL_P2
:
6495 (*ctx
->Exec
->EvalPoint2
)(n
[1].i
, n
[2].i
);
6501 case OPCODE_CONTINUE
:
6502 n
= (Node
*) n
[1].next
;
6504 case OPCODE_END_OF_LIST
:
6510 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
6511 _mesa_problem(ctx
, msg
);
6516 /* increment n to point to next compiled command */
6517 if (opcode
!=OPCODE_CONTINUE
) {
6518 n
+= InstSize
[opcode
];
6523 if (ctx
->Driver
.EndCallList
)
6524 ctx
->Driver
.EndCallList( ctx
);
6526 ctx
->ListState
.CallStack
[ctx
->ListState
.CallDepth
--] = NULL
;
6533 /**********************************************************************/
6535 /**********************************************************************/
6541 * Test if a display list number is valid.
6543 GLboolean GLAPIENTRY
6544 _mesa_IsList( GLuint list
)
6546 GET_CURRENT_CONTEXT(ctx
);
6547 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6548 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
6549 return islist(ctx
, list
);
6554 * Delete a sequence of consecutive display lists.
6557 _mesa_DeleteLists( GLuint list
, GLsizei range
)
6559 GET_CURRENT_CONTEXT(ctx
);
6561 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6562 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6565 _mesa_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
6568 for (i
=list
;i
<list
+range
;i
++) {
6569 _mesa_destroy_list( ctx
, i
);
6576 * Return a display list number, n, such that lists n through n+range-1
6580 _mesa_GenLists(GLsizei range
)
6582 GET_CURRENT_CONTEXT(ctx
);
6584 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6585 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
6588 _mesa_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
6596 * Make this an atomic operation
6598 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
6600 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
6602 /* reserve the list IDs by with empty/dummy lists */
6604 for (i
=0; i
<range
; i
++) {
6605 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_list(base
+i
, 1));
6609 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
6617 * Begin a new display list.
6620 _mesa_NewList( GLuint list
, GLenum mode
)
6622 GET_CURRENT_CONTEXT(ctx
);
6625 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
6626 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6628 if (MESA_VERBOSE
&VERBOSE_API
)
6629 _mesa_debug(ctx
, "glNewList %u %s\n", list
,
6630 _mesa_lookup_enum_by_nr(mode
));
6633 _mesa_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
6637 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
6638 _mesa_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
6642 if (ctx
->ListState
.CurrentListPtr
) {
6643 /* already compiling a display list */
6644 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
6648 ctx
->CompileFlag
= GL_TRUE
;
6649 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
6651 /* Allocate new display list */
6652 ctx
->ListState
.CurrentListNum
= list
;
6653 ctx
->ListState
.CurrentList
= make_list( list
, BLOCK_SIZE
);
6654 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->node
;
6655 ctx
->ListState
.CurrentListPtr
= ctx
->ListState
.CurrentBlock
;
6656 ctx
->ListState
.CurrentPos
= 0;
6658 /* Reset acumulated list state:
6660 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
6661 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
6663 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
6664 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
6666 ctx
->ListState
.ActiveIndex
= 0;
6667 ctx
->ListState
.ActiveEdgeFlag
= 0;
6669 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
6670 ctx
->Driver
.NewList( ctx
, list
, mode
);
6672 ctx
->CurrentDispatch
= ctx
->Save
;
6673 _glapi_set_dispatch( ctx
->CurrentDispatch
);
6679 * End definition of current display list.
6682 _mesa_EndList( void )
6684 GET_CURRENT_CONTEXT(ctx
);
6685 SAVE_FLUSH_VERTICES(ctx
);
6686 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
6688 if (MESA_VERBOSE
&VERBOSE_API
)
6689 _mesa_debug(ctx
, "glEndList\n");
6691 /* Check that a list is under construction */
6692 if (!ctx
->ListState
.CurrentListPtr
) {
6693 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
6697 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_END_OF_LIST
, 0 );
6699 /* Destroy old list, if any */
6700 _mesa_destroy_list(ctx
, ctx
->ListState
.CurrentListNum
);
6701 /* Install the list */
6702 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->ListState
.CurrentListNum
, ctx
->ListState
.CurrentList
);
6705 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
6706 mesa_print_display_list(ctx
->ListState
.CurrentListNum
);
6708 ctx
->Driver
.EndList( ctx
);
6710 ctx
->ListState
.CurrentList
= NULL
;
6711 ctx
->ListState
.CurrentListNum
= 0;
6712 ctx
->ListState
.CurrentListPtr
= NULL
;
6713 ctx
->ExecuteFlag
= GL_TRUE
;
6714 ctx
->CompileFlag
= GL_FALSE
;
6716 ctx
->CurrentDispatch
= ctx
->Exec
;
6717 _glapi_set_dispatch( ctx
->CurrentDispatch
);
6723 _mesa_CallList( GLuint list
)
6725 GLboolean save_compile_flag
;
6726 GET_CURRENT_CONTEXT(ctx
);
6727 FLUSH_CURRENT(ctx
, 0);
6728 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
6729 /* execute the display list, and restore the CompileFlag. */
6731 if (MESA_VERBOSE
& VERBOSE_API
)
6732 _mesa_debug(ctx
, "glCallList %d\n", list
);
6735 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
6739 /* mesa_print_display_list( list ); */
6741 save_compile_flag
= ctx
->CompileFlag
;
6742 if (save_compile_flag
) {
6743 ctx
->CompileFlag
= GL_FALSE
;
6746 execute_list( ctx
, list
);
6747 ctx
->CompileFlag
= save_compile_flag
;
6749 /* also restore API function pointers to point to "save" versions */
6750 if (save_compile_flag
) {
6751 ctx
->CurrentDispatch
= ctx
->Save
;
6752 _glapi_set_dispatch( ctx
->CurrentDispatch
);
6759 * Execute glCallLists: call multiple display lists.
6762 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
6764 GET_CURRENT_CONTEXT(ctx
);
6767 GLboolean save_compile_flag
;
6769 if (MESA_VERBOSE
& VERBOSE_API
)
6770 _mesa_debug(ctx
, "glCallLists %d\n", n
);
6774 case GL_UNSIGNED_BYTE
:
6776 case GL_UNSIGNED_SHORT
:
6778 case GL_UNSIGNED_INT
:
6786 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6790 /* Save the CompileFlag status, turn it off, execute display list,
6791 * and restore the CompileFlag.
6793 save_compile_flag
= ctx
->CompileFlag
;
6794 ctx
->CompileFlag
= GL_FALSE
;
6797 list
= translate_id( i
, type
, lists
);
6798 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
6801 ctx
->CompileFlag
= save_compile_flag
;
6803 /* also restore API function pointers to point to "save" versions */
6804 if (save_compile_flag
) {
6805 ctx
->CurrentDispatch
= ctx
->Save
;
6806 _glapi_set_dispatch( ctx
->CurrentDispatch
);
6813 * Set the offset added to list numbers in glCallLists.
6816 _mesa_ListBase( GLuint base
)
6818 GET_CURRENT_CONTEXT(ctx
);
6819 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
6820 ASSERT_OUTSIDE_BEGIN_END(ctx
);
6821 ctx
->List
.ListBase
= base
;
6825 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
6827 static void GLAPIENTRY
exec_Finish( void )
6829 GET_CURRENT_CONTEXT(ctx
);
6830 FLUSH_VERTICES(ctx
, 0);
6831 ctx
->Exec
->Finish();
6834 static void GLAPIENTRY
exec_Flush( void )
6836 GET_CURRENT_CONTEXT(ctx
);
6837 FLUSH_VERTICES(ctx
, 0);
6838 ctx
->Exec
->Flush( );
6841 static void GLAPIENTRY
exec_GetBooleanv( GLenum pname
, GLboolean
*params
)
6843 GET_CURRENT_CONTEXT(ctx
);
6844 FLUSH_VERTICES(ctx
, 0);
6845 ctx
->Exec
->GetBooleanv( pname
, params
);
6848 static void GLAPIENTRY
exec_GetClipPlane( GLenum plane
, GLdouble
*equation
)
6850 GET_CURRENT_CONTEXT(ctx
);
6851 FLUSH_VERTICES(ctx
, 0);
6852 ctx
->Exec
->GetClipPlane( plane
, equation
);
6855 static void GLAPIENTRY
exec_GetDoublev( GLenum pname
, GLdouble
*params
)
6857 GET_CURRENT_CONTEXT(ctx
);
6858 FLUSH_VERTICES(ctx
, 0);
6859 ctx
->Exec
->GetDoublev( pname
, params
);
6862 static GLenum GLAPIENTRY
exec_GetError( void )
6864 GET_CURRENT_CONTEXT(ctx
);
6865 FLUSH_VERTICES(ctx
, 0);
6866 return ctx
->Exec
->GetError( );
6869 static void GLAPIENTRY
exec_GetFloatv( GLenum pname
, GLfloat
*params
)
6871 GET_CURRENT_CONTEXT(ctx
);
6872 FLUSH_VERTICES(ctx
, 0);
6873 ctx
->Exec
->GetFloatv( pname
, params
);
6876 static void GLAPIENTRY
exec_GetIntegerv( GLenum pname
, GLint
*params
)
6878 GET_CURRENT_CONTEXT(ctx
);
6879 FLUSH_VERTICES(ctx
, 0);
6880 ctx
->Exec
->GetIntegerv( pname
, params
);
6883 static void GLAPIENTRY
exec_GetLightfv( GLenum light
, GLenum pname
, GLfloat
*params
)
6885 GET_CURRENT_CONTEXT(ctx
);
6886 FLUSH_VERTICES(ctx
, 0);
6887 ctx
->Exec
->GetLightfv( light
, pname
, params
);
6890 static void GLAPIENTRY
exec_GetLightiv( GLenum light
, GLenum pname
, GLint
*params
)
6892 GET_CURRENT_CONTEXT(ctx
);
6893 FLUSH_VERTICES(ctx
, 0);
6894 ctx
->Exec
->GetLightiv( light
, pname
, params
);
6897 static void GLAPIENTRY
exec_GetMapdv( GLenum target
, GLenum query
, GLdouble
*v
)
6899 GET_CURRENT_CONTEXT(ctx
);
6900 FLUSH_VERTICES(ctx
, 0);
6901 ctx
->Exec
->GetMapdv( target
, query
, v
);
6904 static void GLAPIENTRY
exec_GetMapfv( GLenum target
, GLenum query
, GLfloat
*v
)
6906 GET_CURRENT_CONTEXT(ctx
);
6907 FLUSH_VERTICES(ctx
, 0);
6908 ctx
->Exec
->GetMapfv( target
, query
, v
);
6911 static void GLAPIENTRY
exec_GetMapiv( GLenum target
, GLenum query
, GLint
*v
)
6913 GET_CURRENT_CONTEXT(ctx
);
6914 FLUSH_VERTICES(ctx
, 0);
6915 ctx
->Exec
->GetMapiv( target
, query
, v
);
6918 static void GLAPIENTRY
exec_GetMaterialfv( GLenum face
, GLenum pname
, GLfloat
*params
)
6920 GET_CURRENT_CONTEXT(ctx
);
6921 FLUSH_VERTICES(ctx
, 0);
6922 ctx
->Exec
->GetMaterialfv( face
, pname
, params
);
6925 static void GLAPIENTRY
exec_GetMaterialiv( GLenum face
, GLenum pname
, GLint
*params
)
6927 GET_CURRENT_CONTEXT(ctx
);
6928 FLUSH_VERTICES(ctx
, 0);
6929 ctx
->Exec
->GetMaterialiv( face
, pname
, params
);
6932 static void GLAPIENTRY
exec_GetPixelMapfv( GLenum map
, GLfloat
*values
)
6934 GET_CURRENT_CONTEXT(ctx
);
6935 FLUSH_VERTICES(ctx
, 0);
6936 ctx
->Exec
->GetPixelMapfv( map
, values
);
6939 static void GLAPIENTRY
exec_GetPixelMapuiv( GLenum map
, GLuint
*values
)
6941 GET_CURRENT_CONTEXT(ctx
);
6942 FLUSH_VERTICES(ctx
, 0);
6943 ctx
->Exec
->GetPixelMapuiv( map
, values
);
6946 static void GLAPIENTRY
exec_GetPixelMapusv( GLenum map
, GLushort
*values
)
6948 GET_CURRENT_CONTEXT(ctx
);
6949 FLUSH_VERTICES(ctx
, 0);
6950 ctx
->Exec
->GetPixelMapusv( map
, values
);
6953 static void GLAPIENTRY
exec_GetPolygonStipple( GLubyte
*dest
)
6955 GET_CURRENT_CONTEXT(ctx
);
6956 FLUSH_VERTICES(ctx
, 0);
6957 ctx
->Exec
->GetPolygonStipple( dest
);
6960 static const GLubyte
* GLAPIENTRY
exec_GetString( GLenum name
)
6962 GET_CURRENT_CONTEXT(ctx
);
6963 FLUSH_VERTICES(ctx
, 0);
6964 return ctx
->Exec
->GetString( name
);
6967 static void GLAPIENTRY
exec_GetTexEnvfv( GLenum target
, GLenum pname
, GLfloat
*params
)
6969 GET_CURRENT_CONTEXT(ctx
);
6970 FLUSH_VERTICES(ctx
, 0);
6971 ctx
->Exec
->GetTexEnvfv( target
, pname
, params
);
6974 static void GLAPIENTRY
exec_GetTexEnviv( GLenum target
, GLenum pname
, GLint
*params
)
6976 GET_CURRENT_CONTEXT(ctx
);
6977 FLUSH_VERTICES(ctx
, 0);
6978 ctx
->Exec
->GetTexEnviv( target
, pname
, params
);
6981 static void GLAPIENTRY
exec_GetTexGendv( GLenum coord
, GLenum pname
, GLdouble
*params
)
6983 GET_CURRENT_CONTEXT(ctx
);
6984 FLUSH_VERTICES(ctx
, 0);
6985 ctx
->Exec
->GetTexGendv( coord
, pname
, params
);
6988 static void GLAPIENTRY
exec_GetTexGenfv( GLenum coord
, GLenum pname
, GLfloat
*params
)
6990 GET_CURRENT_CONTEXT(ctx
);
6991 FLUSH_VERTICES(ctx
, 0);
6992 ctx
->Exec
->GetTexGenfv( coord
, pname
, params
);
6995 static void GLAPIENTRY
exec_GetTexGeniv( GLenum coord
, GLenum pname
, GLint
*params
)
6997 GET_CURRENT_CONTEXT(ctx
);
6998 FLUSH_VERTICES(ctx
, 0);
6999 ctx
->Exec
->GetTexGeniv( coord
, pname
, params
);
7002 static void GLAPIENTRY
exec_GetTexImage( GLenum target
, GLint level
, GLenum format
,
7003 GLenum type
, GLvoid
*pixels
)
7005 GET_CURRENT_CONTEXT(ctx
);
7006 FLUSH_VERTICES(ctx
, 0);
7007 ctx
->Exec
->GetTexImage( target
, level
, format
, type
, pixels
);
7010 static void GLAPIENTRY
exec_GetTexLevelParameterfv( GLenum target
, GLint level
,
7011 GLenum pname
, GLfloat
*params
)
7013 GET_CURRENT_CONTEXT(ctx
);
7014 FLUSH_VERTICES(ctx
, 0);
7015 ctx
->Exec
->GetTexLevelParameterfv( target
, level
, pname
, params
);
7018 static void GLAPIENTRY
exec_GetTexLevelParameteriv( GLenum target
, GLint level
,
7019 GLenum pname
, GLint
*params
)
7021 GET_CURRENT_CONTEXT(ctx
);
7022 FLUSH_VERTICES(ctx
, 0);
7023 ctx
->Exec
->GetTexLevelParameteriv( target
, level
, pname
, params
);
7026 static void GLAPIENTRY
exec_GetTexParameterfv( GLenum target
, GLenum pname
,
7029 GET_CURRENT_CONTEXT(ctx
);
7030 FLUSH_VERTICES(ctx
, 0);
7031 ctx
->Exec
->GetTexParameterfv( target
, pname
, params
);
7034 static void GLAPIENTRY
exec_GetTexParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
7036 GET_CURRENT_CONTEXT(ctx
);
7037 FLUSH_VERTICES(ctx
, 0);
7038 ctx
->Exec
->GetTexParameteriv( target
, pname
, params
);
7041 static GLboolean GLAPIENTRY
exec_IsEnabled( GLenum cap
)
7043 GET_CURRENT_CONTEXT(ctx
);
7044 FLUSH_VERTICES(ctx
, 0);
7045 return ctx
->Exec
->IsEnabled( cap
);
7048 static void GLAPIENTRY
exec_PixelStoref( GLenum pname
, GLfloat param
)
7050 GET_CURRENT_CONTEXT(ctx
);
7051 FLUSH_VERTICES(ctx
, 0);
7052 ctx
->Exec
->PixelStoref( pname
, param
);
7055 static void GLAPIENTRY
exec_PixelStorei( GLenum pname
, GLint param
)
7057 GET_CURRENT_CONTEXT(ctx
);
7058 FLUSH_VERTICES(ctx
, 0);
7059 ctx
->Exec
->PixelStorei( pname
, param
);
7062 static void GLAPIENTRY
exec_ReadPixels( GLint x
, GLint y
, GLsizei width
, GLsizei height
,
7063 GLenum format
, GLenum type
, GLvoid
*pixels
)
7065 GET_CURRENT_CONTEXT(ctx
);
7066 FLUSH_VERTICES(ctx
, 0);
7067 ctx
->Exec
->ReadPixels( x
, y
, width
, height
, format
, type
, pixels
);
7070 static GLint GLAPIENTRY
exec_RenderMode( GLenum mode
)
7072 GET_CURRENT_CONTEXT(ctx
);
7073 FLUSH_VERTICES(ctx
, 0);
7074 return ctx
->Exec
->RenderMode( mode
);
7077 static void GLAPIENTRY
exec_FeedbackBuffer( GLsizei size
, GLenum type
, GLfloat
*buffer
)
7079 GET_CURRENT_CONTEXT(ctx
);
7080 FLUSH_VERTICES(ctx
, 0);
7081 ctx
->Exec
->FeedbackBuffer( size
, type
, buffer
);
7084 static void GLAPIENTRY
exec_SelectBuffer( GLsizei size
, GLuint
*buffer
)
7086 GET_CURRENT_CONTEXT(ctx
);
7087 FLUSH_VERTICES(ctx
, 0);
7088 ctx
->Exec
->SelectBuffer( size
, buffer
);
7091 static GLboolean GLAPIENTRY
exec_AreTexturesResident(GLsizei n
, const GLuint
*texName
,
7092 GLboolean
*residences
)
7094 GET_CURRENT_CONTEXT(ctx
);
7095 FLUSH_VERTICES(ctx
, 0);
7096 return ctx
->Exec
->AreTexturesResident( n
, texName
, residences
);
7099 static void GLAPIENTRY
exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
,
7102 GET_CURRENT_CONTEXT(ctx
);
7103 FLUSH_VERTICES(ctx
, 0);
7104 ctx
->Exec
->ColorPointer( size
, type
, stride
, ptr
);
7107 static void GLAPIENTRY
exec_DeleteTextures( GLsizei n
, const GLuint
*texName
)
7109 GET_CURRENT_CONTEXT(ctx
);
7110 FLUSH_VERTICES(ctx
, 0);
7111 ctx
->Exec
->DeleteTextures( n
, texName
);
7114 static void GLAPIENTRY
exec_DisableClientState( GLenum cap
)
7116 GET_CURRENT_CONTEXT(ctx
);
7117 FLUSH_VERTICES(ctx
, 0);
7118 ctx
->Exec
->DisableClientState( cap
);
7121 static void GLAPIENTRY
exec_EdgeFlagPointer(GLsizei stride
, const GLvoid
*vptr
)
7123 GET_CURRENT_CONTEXT(ctx
);
7124 FLUSH_VERTICES(ctx
, 0);
7125 ctx
->Exec
->EdgeFlagPointer( stride
, vptr
);
7128 static void GLAPIENTRY
exec_EnableClientState( GLenum cap
)
7130 GET_CURRENT_CONTEXT(ctx
);
7131 FLUSH_VERTICES(ctx
, 0);
7132 ctx
->Exec
->EnableClientState( cap
);
7135 static void GLAPIENTRY
exec_GenTextures( GLsizei n
, GLuint
*texName
)
7137 GET_CURRENT_CONTEXT(ctx
);
7138 FLUSH_VERTICES(ctx
, 0);
7139 ctx
->Exec
->GenTextures( n
, texName
);
7142 static void GLAPIENTRY
exec_GetPointerv( GLenum pname
, GLvoid
**params
)
7144 GET_CURRENT_CONTEXT(ctx
);
7145 FLUSH_VERTICES(ctx
, 0);
7146 ctx
->Exec
->GetPointerv( pname
, params
);
7149 static void GLAPIENTRY
exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7151 GET_CURRENT_CONTEXT(ctx
);
7152 FLUSH_VERTICES(ctx
, 0);
7153 ctx
->Exec
->IndexPointer( type
, stride
, ptr
);
7156 static void GLAPIENTRY
exec_InterleavedArrays(GLenum format
, GLsizei stride
,
7157 const GLvoid
*pointer
)
7159 GET_CURRENT_CONTEXT(ctx
);
7160 FLUSH_VERTICES(ctx
, 0);
7161 ctx
->Exec
->InterleavedArrays( format
, stride
, pointer
);
7164 static GLboolean GLAPIENTRY
exec_IsTexture( GLuint texture
)
7166 GET_CURRENT_CONTEXT(ctx
);
7167 FLUSH_VERTICES(ctx
, 0);
7168 return ctx
->Exec
->IsTexture( texture
);
7171 static void GLAPIENTRY
exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
7173 GET_CURRENT_CONTEXT(ctx
);
7174 FLUSH_VERTICES(ctx
, 0);
7175 ctx
->Exec
->NormalPointer( type
, stride
, ptr
);
7178 static void GLAPIENTRY
exec_PopClientAttrib(void)
7180 GET_CURRENT_CONTEXT(ctx
);
7181 FLUSH_VERTICES(ctx
, 0);
7182 ctx
->Exec
->PopClientAttrib();
7185 static void GLAPIENTRY
exec_PushClientAttrib(GLbitfield mask
)
7187 GET_CURRENT_CONTEXT(ctx
);
7188 FLUSH_VERTICES(ctx
, 0);
7189 ctx
->Exec
->PushClientAttrib( mask
);
7192 static void GLAPIENTRY
exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
7195 GET_CURRENT_CONTEXT(ctx
);
7196 FLUSH_VERTICES(ctx
, 0);
7197 ctx
->Exec
->TexCoordPointer( size
, type
, stride
, ptr
);
7200 static void GLAPIENTRY
exec_GetCompressedTexImageARB(GLenum target
, GLint level
,
7203 GET_CURRENT_CONTEXT(ctx
);
7204 FLUSH_VERTICES(ctx
, 0);
7205 ctx
->Exec
->GetCompressedTexImageARB( target
, level
, img
);
7208 static void GLAPIENTRY
exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
7211 GET_CURRENT_CONTEXT(ctx
);
7212 FLUSH_VERTICES(ctx
, 0);
7213 ctx
->Exec
->VertexPointer( size
, type
, stride
, ptr
);
7216 static void GLAPIENTRY
exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
7217 GLint x
, GLint y
, GLsizei width
)
7219 GET_CURRENT_CONTEXT(ctx
);
7220 FLUSH_VERTICES(ctx
, 0);
7221 ctx
->Exec
->CopyConvolutionFilter1D( target
, internalFormat
, x
, y
, width
);
7224 static void GLAPIENTRY
exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
7225 GLint x
, GLint y
, GLsizei width
,
7228 GET_CURRENT_CONTEXT(ctx
);
7229 FLUSH_VERTICES(ctx
, 0);
7230 ctx
->Exec
->CopyConvolutionFilter2D( target
, internalFormat
, x
, y
, width
,
7234 static void GLAPIENTRY
exec_GetColorTable( GLenum target
, GLenum format
,
7235 GLenum type
, GLvoid
*data
)
7237 GET_CURRENT_CONTEXT(ctx
);
7238 FLUSH_VERTICES(ctx
, 0);
7239 ctx
->Exec
->GetColorTable( target
, format
, type
, data
);
7242 static void GLAPIENTRY
exec_GetColorTableParameterfv( GLenum target
, GLenum pname
,
7245 GET_CURRENT_CONTEXT(ctx
);
7246 FLUSH_VERTICES(ctx
, 0);
7247 ctx
->Exec
->GetColorTableParameterfv( target
, pname
, params
);
7250 static void GLAPIENTRY
exec_GetColorTableParameteriv( GLenum target
, GLenum pname
,
7253 GET_CURRENT_CONTEXT(ctx
);
7254 FLUSH_VERTICES(ctx
, 0);
7255 ctx
->Exec
->GetColorTableParameteriv( target
, pname
, params
);
7258 static void GLAPIENTRY
exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
7261 GET_CURRENT_CONTEXT(ctx
);
7262 FLUSH_VERTICES(ctx
, 0);
7263 ctx
->Exec
->GetConvolutionFilter( target
, format
, type
, image
);
7266 static void GLAPIENTRY
exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
,
7269 GET_CURRENT_CONTEXT(ctx
);
7270 FLUSH_VERTICES(ctx
, 0);
7271 ctx
->Exec
->GetConvolutionParameterfv( target
, pname
, params
);
7274 static void GLAPIENTRY
exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
,
7277 GET_CURRENT_CONTEXT(ctx
);
7278 FLUSH_VERTICES(ctx
, 0);
7279 ctx
->Exec
->GetConvolutionParameteriv( target
, pname
, params
);
7282 static void GLAPIENTRY
exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
7283 GLenum type
, GLvoid
*values
)
7285 GET_CURRENT_CONTEXT(ctx
);
7286 FLUSH_VERTICES(ctx
, 0);
7287 ctx
->Exec
->GetHistogram( target
, reset
, format
, type
, values
);
7290 static void GLAPIENTRY
exec_GetHistogramParameterfv(GLenum target
, GLenum pname
,
7293 GET_CURRENT_CONTEXT(ctx
);
7294 FLUSH_VERTICES(ctx
, 0);
7295 ctx
->Exec
->GetHistogramParameterfv( target
, pname
, params
);
7298 static void GLAPIENTRY
exec_GetHistogramParameteriv(GLenum target
, GLenum pname
,
7301 GET_CURRENT_CONTEXT(ctx
);
7302 FLUSH_VERTICES(ctx
, 0);
7303 ctx
->Exec
->GetHistogramParameteriv( target
, pname
, params
);
7306 static void GLAPIENTRY
exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
7307 GLenum type
, GLvoid
*values
)
7309 GET_CURRENT_CONTEXT(ctx
);
7310 FLUSH_VERTICES(ctx
, 0);
7311 ctx
->Exec
->GetMinmax( target
, reset
, format
, type
, values
);
7314 static void GLAPIENTRY
exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
,
7317 GET_CURRENT_CONTEXT(ctx
);
7318 FLUSH_VERTICES(ctx
, 0);
7319 ctx
->Exec
->GetMinmaxParameterfv( target
, pname
, params
);
7322 static void GLAPIENTRY
exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
,
7325 GET_CURRENT_CONTEXT(ctx
);
7326 FLUSH_VERTICES(ctx
, 0);
7327 ctx
->Exec
->GetMinmaxParameteriv( target
, pname
, params
);
7330 static void GLAPIENTRY
exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
7331 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
7333 GET_CURRENT_CONTEXT(ctx
);
7334 FLUSH_VERTICES(ctx
, 0);
7335 ctx
->Exec
->GetSeparableFilter( target
, format
, type
, row
, column
, span
);
7338 static void GLAPIENTRY
exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
7339 GLsizei width
, GLsizei height
, GLenum format
,
7340 GLenum type
, const GLvoid
*row
,
7341 const GLvoid
*column
)
7343 GET_CURRENT_CONTEXT(ctx
);
7344 FLUSH_VERTICES(ctx
, 0);
7345 ctx
->Exec
->SeparableFilter2D( target
, internalFormat
, width
, height
, format
,
7349 static void GLAPIENTRY
exec_GetPixelTexGenParameterivSGIS(GLenum target
, GLint
*value
)
7351 GET_CURRENT_CONTEXT(ctx
);
7352 FLUSH_VERTICES(ctx
, 0);
7353 ctx
->Exec
->GetPixelTexGenParameterivSGIS( target
, value
);
7356 static void GLAPIENTRY
exec_GetPixelTexGenParameterfvSGIS(GLenum target
, GLfloat
*value
)
7358 GET_CURRENT_CONTEXT(ctx
);
7359 FLUSH_VERTICES(ctx
, 0);
7360 ctx
->Exec
->GetPixelTexGenParameterfvSGIS( target
, value
);
7363 static void GLAPIENTRY
exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7364 GLsizei count
, const GLvoid
*ptr
)
7366 GET_CURRENT_CONTEXT(ctx
);
7367 FLUSH_VERTICES(ctx
, 0);
7368 ctx
->Exec
->ColorPointerEXT( size
, type
, stride
, count
, ptr
);
7371 static void GLAPIENTRY
exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
,
7372 const GLboolean
*ptr
)
7374 GET_CURRENT_CONTEXT(ctx
);
7375 FLUSH_VERTICES(ctx
, 0);
7376 ctx
->Exec
->EdgeFlagPointerEXT( stride
, count
, ptr
);
7379 static void GLAPIENTRY
exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7382 GET_CURRENT_CONTEXT(ctx
);
7383 FLUSH_VERTICES(ctx
, 0);
7384 ctx
->Exec
->IndexPointerEXT( type
, stride
, count
, ptr
);
7387 static void GLAPIENTRY
exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
7390 GET_CURRENT_CONTEXT(ctx
);
7391 FLUSH_VERTICES(ctx
, 0);
7392 ctx
->Exec
->NormalPointerEXT( type
, stride
, count
, ptr
);
7395 static void GLAPIENTRY
exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7396 GLsizei count
, const GLvoid
*ptr
)
7398 GET_CURRENT_CONTEXT(ctx
);
7399 FLUSH_VERTICES(ctx
, 0);
7400 ctx
->Exec
->TexCoordPointerEXT( size
, type
, stride
, count
, ptr
);
7403 static void GLAPIENTRY
exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
7404 GLsizei count
, const GLvoid
*ptr
)
7406 GET_CURRENT_CONTEXT(ctx
);
7407 FLUSH_VERTICES(ctx
, 0);
7408 ctx
->Exec
->VertexPointerEXT( size
, type
, stride
, count
, ptr
);
7411 static void GLAPIENTRY
exec_LockArraysEXT(GLint first
, GLsizei count
)
7413 GET_CURRENT_CONTEXT(ctx
);
7414 FLUSH_VERTICES(ctx
, 0);
7415 ctx
->Exec
->LockArraysEXT( first
, count
);
7418 static void GLAPIENTRY
exec_UnlockArraysEXT( void )
7420 GET_CURRENT_CONTEXT(ctx
);
7421 FLUSH_VERTICES(ctx
, 0);
7422 ctx
->Exec
->UnlockArraysEXT( );
7425 static void GLAPIENTRY
exec_ResizeBuffersMESA( void )
7427 GET_CURRENT_CONTEXT(ctx
);
7428 FLUSH_VERTICES(ctx
, 0);
7429 ctx
->Exec
->ResizeBuffersMESA( );
7433 static void GLAPIENTRY
exec_ClientActiveTextureARB( GLenum target
)
7435 GET_CURRENT_CONTEXT(ctx
);
7436 FLUSH_VERTICES(ctx
, 0);
7437 ctx
->Exec
->ClientActiveTextureARB(target
);
7440 static void GLAPIENTRY
exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
7441 GLsizei stride
, const GLvoid
*ptr
)
7443 GET_CURRENT_CONTEXT(ctx
);
7444 FLUSH_VERTICES(ctx
, 0);
7445 ctx
->Exec
->SecondaryColorPointerEXT( size
, type
, stride
, ptr
);
7448 static void GLAPIENTRY
exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
,
7451 GET_CURRENT_CONTEXT(ctx
);
7452 FLUSH_VERTICES(ctx
, 0);
7453 ctx
->Exec
->FogCoordPointerEXT( type
, stride
, ptr
);
7456 /* GL_EXT_multi_draw_arrays */
7457 static void GLAPIENTRY
exec_MultiDrawArraysEXT(GLenum mode
, GLint
*first
,
7458 GLsizei
*count
, GLsizei primcount
)
7460 GET_CURRENT_CONTEXT(ctx
);
7461 FLUSH_VERTICES(ctx
, 0);
7462 ctx
->Exec
->MultiDrawArraysEXT( mode
, first
, count
, primcount
);
7465 /* GL_EXT_multi_draw_arrays */
7466 static void GLAPIENTRY
exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
*count
,
7467 GLenum type
, const GLvoid
**indices
,
7470 GET_CURRENT_CONTEXT(ctx
);
7471 FLUSH_VERTICES(ctx
, 0);
7472 ctx
->Exec
->MultiDrawElementsEXT(mode
, count
, type
, indices
, primcount
);
7475 /* GL_IBM_multimode_draw_arrays */
7476 static void GLAPIENTRY
exec_MultiModeDrawArraysIBM(const GLenum
*mode
, const GLint
*first
,
7477 const GLsizei
*count
, GLsizei primcount
,
7480 GET_CURRENT_CONTEXT(ctx
);
7481 FLUSH_VERTICES(ctx
, 0);
7482 ctx
->Exec
->MultiModeDrawArraysIBM(mode
, first
, count
, primcount
, modestride
);
7485 /* GL_IBM_multimode_draw_arrays */
7486 static void GLAPIENTRY
exec_MultiModeDrawElementsIBM(const GLenum
*mode
,
7487 const GLsizei
*count
,
7489 const GLvoid
* const *indices
,
7490 GLsizei primcount
, GLint modestride
)
7492 GET_CURRENT_CONTEXT(ctx
);
7493 FLUSH_VERTICES(ctx
, 0);
7494 ctx
->Exec
->MultiModeDrawElementsIBM(mode
, count
, type
, indices
, primcount
,
7502 * Setup the given dispatch table to point to Mesa's display list
7503 * building functions.
7505 * This does not include any of the tnl functions - they are
7506 * initialized from _mesa_init_api_defaults and from the active vtxfmt
7510 _mesa_init_dlist_table( struct _glapi_table
*table
)
7512 _mesa_loopback_init_api_table( table
);
7515 table
->Accum
= save_Accum
;
7516 table
->AlphaFunc
= save_AlphaFunc
;
7517 table
->Bitmap
= save_Bitmap
;
7518 table
->BlendFunc
= _mesa_BlendFunc
; /* loops-back to BlendFuncSeparate */
7519 table
->CallList
= _mesa_save_CallList
;
7520 table
->CallLists
= _mesa_save_CallLists
;
7521 table
->Clear
= save_Clear
;
7522 table
->ClearAccum
= save_ClearAccum
;
7523 table
->ClearColor
= save_ClearColor
;
7524 table
->ClearDepth
= save_ClearDepth
;
7525 table
->ClearIndex
= save_ClearIndex
;
7526 table
->ClearStencil
= save_ClearStencil
;
7527 table
->ClipPlane
= save_ClipPlane
;
7528 table
->ColorMask
= save_ColorMask
;
7529 table
->ColorMaterial
= save_ColorMaterial
;
7530 table
->CopyPixels
= save_CopyPixels
;
7531 table
->CullFace
= save_CullFace
;
7532 table
->DeleteLists
= _mesa_DeleteLists
;
7533 table
->DepthFunc
= save_DepthFunc
;
7534 table
->DepthMask
= save_DepthMask
;
7535 table
->DepthRange
= save_DepthRange
;
7536 table
->Disable
= save_Disable
;
7537 table
->DrawBuffer
= save_DrawBuffer
;
7538 table
->DrawPixels
= save_DrawPixels
;
7539 table
->Enable
= save_Enable
;
7540 table
->EndList
= _mesa_EndList
;
7541 table
->EvalMesh1
= _mesa_save_EvalMesh1
;
7542 table
->EvalMesh2
= _mesa_save_EvalMesh2
;
7543 table
->Finish
= exec_Finish
;
7544 table
->Flush
= exec_Flush
;
7545 table
->Fogf
= save_Fogf
;
7546 table
->Fogfv
= save_Fogfv
;
7547 table
->Fogi
= save_Fogi
;
7548 table
->Fogiv
= save_Fogiv
;
7549 table
->FrontFace
= save_FrontFace
;
7550 table
->Frustum
= save_Frustum
;
7551 table
->GenLists
= _mesa_GenLists
;
7552 table
->GetBooleanv
= exec_GetBooleanv
;
7553 table
->GetClipPlane
= exec_GetClipPlane
;
7554 table
->GetDoublev
= exec_GetDoublev
;
7555 table
->GetError
= exec_GetError
;
7556 table
->GetFloatv
= exec_GetFloatv
;
7557 table
->GetIntegerv
= exec_GetIntegerv
;
7558 table
->GetLightfv
= exec_GetLightfv
;
7559 table
->GetLightiv
= exec_GetLightiv
;
7560 table
->GetMapdv
= exec_GetMapdv
;
7561 table
->GetMapfv
= exec_GetMapfv
;
7562 table
->GetMapiv
= exec_GetMapiv
;
7563 table
->GetMaterialfv
= exec_GetMaterialfv
;
7564 table
->GetMaterialiv
= exec_GetMaterialiv
;
7565 table
->GetPixelMapfv
= exec_GetPixelMapfv
;
7566 table
->GetPixelMapuiv
= exec_GetPixelMapuiv
;
7567 table
->GetPixelMapusv
= exec_GetPixelMapusv
;
7568 table
->GetPolygonStipple
= exec_GetPolygonStipple
;
7569 table
->GetString
= exec_GetString
;
7570 table
->GetTexEnvfv
= exec_GetTexEnvfv
;
7571 table
->GetTexEnviv
= exec_GetTexEnviv
;
7572 table
->GetTexGendv
= exec_GetTexGendv
;
7573 table
->GetTexGenfv
= exec_GetTexGenfv
;
7574 table
->GetTexGeniv
= exec_GetTexGeniv
;
7575 table
->GetTexImage
= exec_GetTexImage
;
7576 table
->GetTexLevelParameterfv
= exec_GetTexLevelParameterfv
;
7577 table
->GetTexLevelParameteriv
= exec_GetTexLevelParameteriv
;
7578 table
->GetTexParameterfv
= exec_GetTexParameterfv
;
7579 table
->GetTexParameteriv
= exec_GetTexParameteriv
;
7580 table
->Hint
= save_Hint
;
7581 table
->IndexMask
= save_IndexMask
;
7582 table
->InitNames
= save_InitNames
;
7583 table
->IsEnabled
= exec_IsEnabled
;
7584 table
->IsList
= _mesa_IsList
;
7585 table
->LightModelf
= save_LightModelf
;
7586 table
->LightModelfv
= save_LightModelfv
;
7587 table
->LightModeli
= save_LightModeli
;
7588 table
->LightModeliv
= save_LightModeliv
;
7589 table
->Lightf
= save_Lightf
;
7590 table
->Lightfv
= save_Lightfv
;
7591 table
->Lighti
= save_Lighti
;
7592 table
->Lightiv
= save_Lightiv
;
7593 table
->LineStipple
= save_LineStipple
;
7594 table
->LineWidth
= save_LineWidth
;
7595 table
->ListBase
= save_ListBase
;
7596 table
->LoadIdentity
= save_LoadIdentity
;
7597 table
->LoadMatrixd
= save_LoadMatrixd
;
7598 table
->LoadMatrixf
= save_LoadMatrixf
;
7599 table
->LoadName
= save_LoadName
;
7600 table
->LogicOp
= save_LogicOp
;
7601 table
->Map1d
= save_Map1d
;
7602 table
->Map1f
= save_Map1f
;
7603 table
->Map2d
= save_Map2d
;
7604 table
->Map2f
= save_Map2f
;
7605 table
->MapGrid1d
= save_MapGrid1d
;
7606 table
->MapGrid1f
= save_MapGrid1f
;
7607 table
->MapGrid2d
= save_MapGrid2d
;
7608 table
->MapGrid2f
= save_MapGrid2f
;
7609 table
->MatrixMode
= save_MatrixMode
;
7610 table
->MultMatrixd
= save_MultMatrixd
;
7611 table
->MultMatrixf
= save_MultMatrixf
;
7612 table
->NewList
= save_NewList
;
7613 table
->Ortho
= save_Ortho
;
7614 table
->PassThrough
= save_PassThrough
;
7615 table
->PixelMapfv
= save_PixelMapfv
;
7616 table
->PixelMapuiv
= save_PixelMapuiv
;
7617 table
->PixelMapusv
= save_PixelMapusv
;
7618 table
->PixelStoref
= exec_PixelStoref
;
7619 table
->PixelStorei
= exec_PixelStorei
;
7620 table
->PixelTransferf
= save_PixelTransferf
;
7621 table
->PixelTransferi
= save_PixelTransferi
;
7622 table
->PixelZoom
= save_PixelZoom
;
7623 table
->PointSize
= save_PointSize
;
7624 table
->PolygonMode
= save_PolygonMode
;
7625 table
->PolygonOffset
= save_PolygonOffset
;
7626 table
->PolygonStipple
= save_PolygonStipple
;
7627 table
->PopAttrib
= save_PopAttrib
;
7628 table
->PopMatrix
= save_PopMatrix
;
7629 table
->PopName
= save_PopName
;
7630 table
->PushAttrib
= save_PushAttrib
;
7631 table
->PushMatrix
= save_PushMatrix
;
7632 table
->PushName
= save_PushName
;
7633 table
->RasterPos2d
= save_RasterPos2d
;
7634 table
->RasterPos2dv
= save_RasterPos2dv
;
7635 table
->RasterPos2f
= save_RasterPos2f
;
7636 table
->RasterPos2fv
= save_RasterPos2fv
;
7637 table
->RasterPos2i
= save_RasterPos2i
;
7638 table
->RasterPos2iv
= save_RasterPos2iv
;
7639 table
->RasterPos2s
= save_RasterPos2s
;
7640 table
->RasterPos2sv
= save_RasterPos2sv
;
7641 table
->RasterPos3d
= save_RasterPos3d
;
7642 table
->RasterPos3dv
= save_RasterPos3dv
;
7643 table
->RasterPos3f
= save_RasterPos3f
;
7644 table
->RasterPos3fv
= save_RasterPos3fv
;
7645 table
->RasterPos3i
= save_RasterPos3i
;
7646 table
->RasterPos3iv
= save_RasterPos3iv
;
7647 table
->RasterPos3s
= save_RasterPos3s
;
7648 table
->RasterPos3sv
= save_RasterPos3sv
;
7649 table
->RasterPos4d
= save_RasterPos4d
;
7650 table
->RasterPos4dv
= save_RasterPos4dv
;
7651 table
->RasterPos4f
= save_RasterPos4f
;
7652 table
->RasterPos4fv
= save_RasterPos4fv
;
7653 table
->RasterPos4i
= save_RasterPos4i
;
7654 table
->RasterPos4iv
= save_RasterPos4iv
;
7655 table
->RasterPos4s
= save_RasterPos4s
;
7656 table
->RasterPos4sv
= save_RasterPos4sv
;
7657 table
->ReadBuffer
= save_ReadBuffer
;
7658 table
->ReadPixels
= exec_ReadPixels
;
7659 table
->RenderMode
= exec_RenderMode
;
7660 table
->Rotated
= save_Rotated
;
7661 table
->Rotatef
= save_Rotatef
;
7662 table
->Scaled
= save_Scaled
;
7663 table
->Scalef
= save_Scalef
;
7664 table
->Scissor
= save_Scissor
;
7665 table
->FeedbackBuffer
= exec_FeedbackBuffer
;
7666 table
->SelectBuffer
= exec_SelectBuffer
;
7667 table
->ShadeModel
= save_ShadeModel
;
7668 table
->StencilFunc
= save_StencilFunc
;
7669 table
->StencilMask
= save_StencilMask
;
7670 table
->StencilOp
= save_StencilOp
;
7671 table
->TexEnvf
= save_TexEnvf
;
7672 table
->TexEnvfv
= save_TexEnvfv
;
7673 table
->TexEnvi
= save_TexEnvi
;
7674 table
->TexEnviv
= save_TexEnviv
;
7675 table
->TexGend
= save_TexGend
;
7676 table
->TexGendv
= save_TexGendv
;
7677 table
->TexGenf
= save_TexGenf
;
7678 table
->TexGenfv
= save_TexGenfv
;
7679 table
->TexGeni
= save_TexGeni
;
7680 table
->TexGeniv
= save_TexGeniv
;
7681 table
->TexImage1D
= save_TexImage1D
;
7682 table
->TexImage2D
= save_TexImage2D
;
7683 table
->TexParameterf
= save_TexParameterf
;
7684 table
->TexParameterfv
= save_TexParameterfv
;
7685 table
->TexParameteri
= save_TexParameteri
;
7686 table
->TexParameteriv
= save_TexParameteriv
;
7687 table
->Translated
= save_Translated
;
7688 table
->Translatef
= save_Translatef
;
7689 table
->Viewport
= save_Viewport
;
7692 table
->AreTexturesResident
= exec_AreTexturesResident
;
7693 table
->AreTexturesResidentEXT
= exec_AreTexturesResident
;
7694 table
->BindTexture
= save_BindTexture
;
7695 table
->ColorPointer
= exec_ColorPointer
;
7696 table
->CopyTexImage1D
= save_CopyTexImage1D
;
7697 table
->CopyTexImage2D
= save_CopyTexImage2D
;
7698 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
7699 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
7700 table
->DeleteTextures
= exec_DeleteTextures
;
7701 table
->DisableClientState
= exec_DisableClientState
;
7702 table
->EdgeFlagPointer
= exec_EdgeFlagPointer
;
7703 table
->EnableClientState
= exec_EnableClientState
;
7704 table
->GenTextures
= exec_GenTextures
;
7705 table
->GenTexturesEXT
= exec_GenTextures
;
7706 table
->GetPointerv
= exec_GetPointerv
;
7707 table
->IndexPointer
= exec_IndexPointer
;
7708 table
->InterleavedArrays
= exec_InterleavedArrays
;
7709 table
->IsTexture
= exec_IsTexture
;
7710 table
->IsTextureEXT
= exec_IsTexture
;
7711 table
->NormalPointer
= exec_NormalPointer
;
7712 table
->PopClientAttrib
= exec_PopClientAttrib
;
7713 table
->PrioritizeTextures
= save_PrioritizeTextures
;
7714 table
->PushClientAttrib
= exec_PushClientAttrib
;
7715 table
->TexCoordPointer
= exec_TexCoordPointer
;
7716 table
->TexSubImage1D
= save_TexSubImage1D
;
7717 table
->TexSubImage2D
= save_TexSubImage2D
;
7718 table
->VertexPointer
= exec_VertexPointer
;
7721 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
7722 table
->TexImage3D
= save_TexImage3D
;
7723 table
->TexSubImage3D
= save_TexSubImage3D
;
7726 table
->StencilFuncSeparate
= save_StencilFuncSeparate
;
7727 table
->StencilMaskSeparate
= save_StencilMaskSeparate
;
7728 table
->StencilOpSeparate
= save_StencilOpSeparate
;
7730 /* GL_ARB_imaging */
7731 /* Not all are supported */
7732 table
->BlendColor
= save_BlendColor
;
7733 table
->BlendEquation
= save_BlendEquation
;
7734 table
->ColorSubTable
= save_ColorSubTable
;
7735 table
->ColorTable
= save_ColorTable
;
7736 table
->ColorTableParameterfv
= save_ColorTableParameterfv
;
7737 table
->ColorTableParameteriv
= save_ColorTableParameteriv
;
7738 table
->ConvolutionFilter1D
= save_ConvolutionFilter1D
;
7739 table
->ConvolutionFilter2D
= save_ConvolutionFilter2D
;
7740 table
->ConvolutionParameterf
= save_ConvolutionParameterf
;
7741 table
->ConvolutionParameterfv
= save_ConvolutionParameterfv
;
7742 table
->ConvolutionParameteri
= save_ConvolutionParameteri
;
7743 table
->ConvolutionParameteriv
= save_ConvolutionParameteriv
;
7744 table
->CopyColorSubTable
= save_CopyColorSubTable
;
7745 table
->CopyColorTable
= save_CopyColorTable
;
7746 table
->CopyConvolutionFilter1D
= exec_CopyConvolutionFilter1D
;
7747 table
->CopyConvolutionFilter2D
= exec_CopyConvolutionFilter2D
;
7748 table
->GetColorTable
= exec_GetColorTable
;
7749 table
->GetColorTableEXT
= exec_GetColorTable
;
7750 table
->GetColorTableParameterfv
= exec_GetColorTableParameterfv
;
7751 table
->GetColorTableParameterfvEXT
= exec_GetColorTableParameterfv
;
7752 table
->GetColorTableParameteriv
= exec_GetColorTableParameteriv
;
7753 table
->GetColorTableParameterivEXT
= exec_GetColorTableParameteriv
;
7754 table
->GetConvolutionFilter
= exec_GetConvolutionFilter
;
7755 table
->GetConvolutionFilterEXT
= exec_GetConvolutionFilter
;
7756 table
->GetConvolutionParameterfv
= exec_GetConvolutionParameterfv
;
7757 table
->GetConvolutionParameterfvEXT
= exec_GetConvolutionParameterfv
;
7758 table
->GetConvolutionParameteriv
= exec_GetConvolutionParameteriv
;
7759 table
->GetConvolutionParameterivEXT
= exec_GetConvolutionParameteriv
;
7760 table
->GetHistogram
= exec_GetHistogram
;
7761 table
->GetHistogramEXT
= exec_GetHistogram
;
7762 table
->GetHistogramParameterfv
= exec_GetHistogramParameterfv
;
7763 table
->GetHistogramParameterfvEXT
= exec_GetHistogramParameterfv
;
7764 table
->GetHistogramParameteriv
= exec_GetHistogramParameteriv
;
7765 table
->GetHistogramParameterivEXT
= exec_GetHistogramParameteriv
;
7766 table
->GetMinmax
= exec_GetMinmax
;
7767 table
->GetMinmaxEXT
= exec_GetMinmax
;
7768 table
->GetMinmaxParameterfv
= exec_GetMinmaxParameterfv
;
7769 table
->GetMinmaxParameterfvEXT
= exec_GetMinmaxParameterfv
;
7770 table
->GetMinmaxParameteriv
= exec_GetMinmaxParameteriv
;
7771 table
->GetMinmaxParameterivEXT
= exec_GetMinmaxParameteriv
;
7772 table
->GetSeparableFilter
= exec_GetSeparableFilter
;
7773 table
->GetSeparableFilterEXT
= exec_GetSeparableFilter
;
7774 table
->Histogram
= save_Histogram
;
7775 table
->Minmax
= save_Minmax
;
7776 table
->ResetHistogram
= save_ResetHistogram
;
7777 table
->ResetMinmax
= save_ResetMinmax
;
7778 table
->SeparableFilter2D
= exec_SeparableFilter2D
;
7780 /* 2. GL_EXT_blend_color */
7782 table
->BlendColorEXT
= save_BlendColorEXT
;
7785 /* 3. GL_EXT_polygon_offset */
7786 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
7788 /* 6. GL_EXT_texture3d */
7790 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
7791 table
->TexImage3DEXT
= save_TexImage3DEXT
;
7792 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
7795 /* 15. GL_SGIX_pixel_texture */
7796 table
->PixelTexGenSGIX
= save_PixelTexGenSGIX
;
7798 /* 15. GL_SGIS_pixel_texture */
7799 table
->PixelTexGenParameteriSGIS
= save_PixelTexGenParameteriSGIS
;
7800 table
->PixelTexGenParameterfSGIS
= save_PixelTexGenParameterfSGIS
;
7801 table
->PixelTexGenParameterivSGIS
= save_PixelTexGenParameterivSGIS
;
7802 table
->PixelTexGenParameterfvSGIS
= save_PixelTexGenParameterfvSGIS
;
7803 table
->GetPixelTexGenParameterivSGIS
= exec_GetPixelTexGenParameterivSGIS
;
7804 table
->GetPixelTexGenParameterfvSGIS
= exec_GetPixelTexGenParameterfvSGIS
;
7806 /* 30. GL_EXT_vertex_array */
7807 table
->ColorPointerEXT
= exec_ColorPointerEXT
;
7808 table
->EdgeFlagPointerEXT
= exec_EdgeFlagPointerEXT
;
7809 table
->IndexPointerEXT
= exec_IndexPointerEXT
;
7810 table
->NormalPointerEXT
= exec_NormalPointerEXT
;
7811 table
->TexCoordPointerEXT
= exec_TexCoordPointerEXT
;
7812 table
->VertexPointerEXT
= exec_VertexPointerEXT
;
7814 /* 37. GL_EXT_blend_minmax */
7816 table
->BlendEquationEXT
= save_BlendEquationEXT
;
7819 /* 54. GL_EXT_point_parameters */
7820 table
->PointParameterfEXT
= save_PointParameterfEXT
;
7821 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
7823 /* 78. GL_EXT_paletted_texture */
7825 table
->ColorTableEXT
= save_ColorTable
;
7826 table
->ColorSubTableEXT
= save_ColorSubTable
;
7828 table
->GetColorTableEXT
= exec_GetColorTable
;
7829 table
->GetColorTableParameterfvEXT
= exec_GetColorTableParameterfv
;
7830 table
->GetColorTableParameterivEXT
= exec_GetColorTableParameteriv
;
7832 /* 97. GL_EXT_compiled_vertex_array */
7833 table
->LockArraysEXT
= exec_LockArraysEXT
;
7834 table
->UnlockArraysEXT
= exec_UnlockArraysEXT
;
7836 /* 145. GL_EXT_secondary_color */
7837 table
->SecondaryColorPointerEXT
= exec_SecondaryColorPointerEXT
;
7839 /* 148. GL_EXT_multi_draw_arrays */
7840 table
->MultiDrawArraysEXT
= exec_MultiDrawArraysEXT
;
7841 table
->MultiDrawElementsEXT
= exec_MultiDrawElementsEXT
;
7843 /* 149. GL_EXT_fog_coord */
7844 table
->FogCoordPointerEXT
= exec_FogCoordPointerEXT
;
7846 /* 173. GL_EXT_blend_func_separate */
7847 table
->BlendFuncSeparateEXT
= save_BlendFuncSeparateEXT
;
7849 /* 196. GL_MESA_resize_buffers */
7850 table
->ResizeBuffersMESA
= exec_ResizeBuffersMESA
;
7852 /* 197. GL_MESA_window_pos */
7853 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
7854 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
7855 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
7856 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
7857 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
7858 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
7859 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
7860 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
7861 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
7862 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
7863 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
7864 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
7865 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
7866 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
7867 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
7868 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
7869 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
7870 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
7871 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
7872 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
7873 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
7874 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
7875 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
7876 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
7878 /* 200. GL_IBM_multimode_draw_arrays */
7879 table
->MultiModeDrawArraysIBM
= exec_MultiModeDrawArraysIBM
;
7880 table
->MultiModeDrawElementsIBM
= exec_MultiModeDrawElementsIBM
;
7882 #if FEATURE_NV_vertex_program
7883 /* 233. GL_NV_vertex_program */
7884 /* The following commands DO NOT go into display lists:
7885 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
7886 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
7888 table
->BindProgramNV
= save_BindProgramNV
;
7889 table
->DeleteProgramsNV
= _mesa_DeletePrograms
;
7890 table
->ExecuteProgramNV
= save_ExecuteProgramNV
;
7891 table
->GenProgramsNV
= _mesa_GenPrograms
;
7892 table
->AreProgramsResidentNV
= _mesa_AreProgramsResidentNV
;
7893 table
->RequestResidentProgramsNV
= save_RequestResidentProgramsNV
;
7894 table
->GetProgramParameterfvNV
= _mesa_GetProgramParameterfvNV
;
7895 table
->GetProgramParameterdvNV
= _mesa_GetProgramParameterdvNV
;
7896 table
->GetProgramivNV
= _mesa_GetProgramivNV
;
7897 table
->GetProgramStringNV
= _mesa_GetProgramStringNV
;
7898 table
->GetTrackMatrixivNV
= _mesa_GetTrackMatrixivNV
;
7899 table
->GetVertexAttribdvNV
= _mesa_GetVertexAttribdvNV
;
7900 table
->GetVertexAttribfvNV
= _mesa_GetVertexAttribfvNV
;
7901 table
->GetVertexAttribivNV
= _mesa_GetVertexAttribivNV
;
7902 table
->GetVertexAttribPointervNV
= _mesa_GetVertexAttribPointervNV
;
7903 table
->IsProgramNV
= _mesa_IsProgram
;
7904 table
->LoadProgramNV
= save_LoadProgramNV
;
7905 table
->ProgramParameter4dNV
= save_ProgramParameter4dNV
;
7906 table
->ProgramParameter4dvNV
= save_ProgramParameter4dvNV
;
7907 table
->ProgramParameter4fNV
= save_ProgramParameter4fNV
;
7908 table
->ProgramParameter4fvNV
= save_ProgramParameter4fvNV
;
7909 table
->ProgramParameters4dvNV
= save_ProgramParameters4dvNV
;
7910 table
->ProgramParameters4fvNV
= save_ProgramParameters4fvNV
;
7911 table
->TrackMatrixNV
= save_TrackMatrixNV
;
7912 table
->VertexAttribPointerNV
= _mesa_VertexAttribPointerNV
;
7915 /* 245. GL_ATI_fragment_shader */
7916 #if FEATURE_ATI_fragment_shader
7917 table
->BindFragmentShaderATI
= save_BindFragmentShaderATI
;
7918 table
->SetFragmentShaderConstantATI
= save_SetFragmentShaderConstantATI
;
7921 /* 282. GL_NV_fragment_program */
7922 #if FEATURE_NV_fragment_program
7923 table
->ProgramNamedParameter4fNV
= save_ProgramNamedParameter4fNV
;
7924 table
->ProgramNamedParameter4dNV
= save_ProgramNamedParameter4dNV
;
7925 table
->ProgramNamedParameter4fvNV
= save_ProgramNamedParameter4fvNV
;
7926 table
->ProgramNamedParameter4dvNV
= save_ProgramNamedParameter4dvNV
;
7927 table
->GetProgramNamedParameterfvNV
= _mesa_GetProgramNamedParameterfvNV
;
7928 table
->GetProgramNamedParameterdvNV
= _mesa_GetProgramNamedParameterdvNV
;
7929 table
->ProgramLocalParameter4dARB
= save_ProgramLocalParameter4dARB
;
7930 table
->ProgramLocalParameter4dvARB
= save_ProgramLocalParameter4dvARB
;
7931 table
->ProgramLocalParameter4fARB
= save_ProgramLocalParameter4fARB
;
7932 table
->ProgramLocalParameter4fvARB
= save_ProgramLocalParameter4fvARB
;
7933 table
->GetProgramLocalParameterdvARB
= _mesa_GetProgramLocalParameterdvARB
;
7934 table
->GetProgramLocalParameterfvARB
= _mesa_GetProgramLocalParameterfvARB
;
7937 /* 262. GL_NV_point_sprite */
7938 table
->PointParameteriNV
= save_PointParameteriNV
;
7939 table
->PointParameterivNV
= save_PointParameterivNV
;
7941 /* 268. GL_EXT_stencil_two_side */
7942 table
->ActiveStencilFaceEXT
= save_ActiveStencilFaceEXT
;
7944 /* ???. GL_EXT_depth_bounds_test */
7945 table
->DepthBoundsEXT
= save_DepthBoundsEXT
;
7947 /* ARB 1. GL_ARB_multitexture */
7948 table
->ActiveTextureARB
= save_ActiveTextureARB
;
7949 table
->ClientActiveTextureARB
= exec_ClientActiveTextureARB
;
7951 /* ARB 3. GL_ARB_transpose_matrix */
7952 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
7953 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
7954 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
7955 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
7957 /* ARB 5. GL_ARB_multisample */
7958 table
->SampleCoverageARB
= save_SampleCoverageARB
;
7960 /* ARB 12. GL_ARB_texture_compression */
7961 table
->CompressedTexImage3DARB
= save_CompressedTexImage3DARB
;
7962 table
->CompressedTexImage2DARB
= save_CompressedTexImage2DARB
;
7963 table
->CompressedTexImage1DARB
= save_CompressedTexImage1DARB
;
7964 table
->CompressedTexSubImage3DARB
= save_CompressedTexSubImage3DARB
;
7965 table
->CompressedTexSubImage2DARB
= save_CompressedTexSubImage2DARB
;
7966 table
->CompressedTexSubImage1DARB
= save_CompressedTexSubImage1DARB
;
7967 table
->GetCompressedTexImageARB
= exec_GetCompressedTexImageARB
;
7969 /* ARB 14. GL_ARB_point_parameters */
7970 /* aliased with EXT_point_parameters functions */
7972 /* ARB 25. GL_ARB_window_pos */
7973 /* aliased with MESA_window_pos functions */
7975 /* ARB 26. GL_ARB_vertex_program */
7976 /* ARB 27. GL_ARB_fragment_program */
7977 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
7978 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
7979 table
->VertexAttribPointerARB
= _mesa_VertexAttribPointerARB
;
7980 table
->EnableVertexAttribArrayARB
= _mesa_EnableVertexAttribArrayARB
;
7981 table
->DisableVertexAttribArrayARB
= _mesa_DisableVertexAttribArrayARB
;
7982 table
->ProgramStringARB
= save_ProgramStringARB
;
7983 table
->BindProgramNV
= save_BindProgramNV
;
7984 table
->DeleteProgramsNV
= _mesa_DeletePrograms
;
7985 table
->GenProgramsNV
= _mesa_GenPrograms
;
7986 table
->IsProgramNV
= _mesa_IsProgram
;
7987 table
->GetVertexAttribdvNV
= _mesa_GetVertexAttribdvNV
;
7988 table
->GetVertexAttribfvNV
= _mesa_GetVertexAttribfvNV
;
7989 table
->GetVertexAttribivNV
= _mesa_GetVertexAttribivNV
;
7990 table
->GetVertexAttribPointervNV
= _mesa_GetVertexAttribPointervNV
;
7991 table
->ProgramEnvParameter4dARB
= save_ProgramEnvParameter4dARB
;
7992 table
->ProgramEnvParameter4dvARB
= save_ProgramEnvParameter4dvARB
;
7993 table
->ProgramEnvParameter4fARB
= save_ProgramEnvParameter4fARB
;
7994 table
->ProgramEnvParameter4fvARB
= save_ProgramEnvParameter4fvARB
;
7995 table
->ProgramLocalParameter4dARB
= save_ProgramLocalParameter4dARB
;
7996 table
->ProgramLocalParameter4dvARB
= save_ProgramLocalParameter4dvARB
;
7997 table
->ProgramLocalParameter4fARB
= save_ProgramLocalParameter4fARB
;
7998 table
->ProgramLocalParameter4fvARB
= save_ProgramLocalParameter4fvARB
;
7999 table
->GetProgramEnvParameterdvARB
= _mesa_GetProgramEnvParameterdvARB
;
8000 table
->GetProgramEnvParameterfvARB
= _mesa_GetProgramEnvParameterfvARB
;
8001 table
->GetProgramLocalParameterdvARB
= _mesa_GetProgramLocalParameterdvARB
;
8002 table
->GetProgramLocalParameterfvARB
= _mesa_GetProgramLocalParameterfvARB
;
8003 table
->GetProgramivARB
= _mesa_GetProgramivARB
;
8004 table
->GetProgramStringARB
= _mesa_GetProgramStringARB
;
8007 /* ARB 28. GL_ARB_vertex_buffer_object */
8008 #if FEATURE_ARB_vertex_buffer_object
8009 /* None of the extension's functions get compiled */
8010 table
->BindBufferARB
= _mesa_BindBufferARB
;
8011 table
->BufferDataARB
= _mesa_BufferDataARB
;
8012 table
->BufferSubDataARB
= _mesa_BufferSubDataARB
;
8013 table
->DeleteBuffersARB
= _mesa_DeleteBuffersARB
;
8014 table
->GenBuffersARB
= _mesa_GenBuffersARB
;
8015 table
->GetBufferParameterivARB
= _mesa_GetBufferParameterivARB
;
8016 table
->GetBufferPointervARB
= _mesa_GetBufferPointervARB
;
8017 table
->GetBufferSubDataARB
= _mesa_GetBufferSubDataARB
;
8018 table
->IsBufferARB
= _mesa_IsBufferARB
;
8019 table
->MapBufferARB
= _mesa_MapBufferARB
;
8020 table
->UnmapBufferARB
= _mesa_UnmapBufferARB
;
8023 #if FEATURE_ARB_occlusion_query
8024 table
->BeginQueryARB
= save_BeginQueryARB
;
8025 table
->EndQueryARB
= save_EndQueryARB
;
8026 table
->GenQueriesARB
= _mesa_GenQueriesARB
;
8027 table
->DeleteQueriesARB
= _mesa_DeleteQueriesARB
;
8028 table
->IsQueryARB
= _mesa_IsQueryARB
;
8029 table
->GetQueryivARB
= _mesa_GetQueryivARB
;
8030 table
->GetQueryObjectivARB
= _mesa_GetQueryObjectivARB
;
8031 table
->GetQueryObjectuivARB
= _mesa_GetQueryObjectuivARB
;
8033 table
->DrawBuffersARB
= save_DrawBuffersARB
;
8035 /* 299. GL_EXT_blend_equation_separate */
8036 table
->BlendEquationSeparateEXT
= save_BlendEquationSeparateEXT
;
8044 static const char *enum_string( GLenum k
)
8046 return _mesa_lookup_enum_by_nr( k
);
8051 * Print the commands in a display list. For debugging only.
8052 * TODO: many commands aren't handled yet.
8054 static void GLAPIENTRY
print_list( GLcontext
*ctx
, GLuint list
)
8056 struct mesa_display_list
*dlist
;
8060 if (!GL_CALL(IsList
)(list
)) {
8061 _mesa_printf("%u is not a display list ID\n", list
);
8065 dlist
= (struct mesa_display_list
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
8071 _mesa_printf("START-LIST %u, address %p\n", list
, (void*)n
);
8073 done
= n
? GL_FALSE
: GL_TRUE
;
8075 OpCode opcode
= n
[0].opcode
;
8076 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_EXT_0
;
8078 if (i
>= 0 && i
< (GLint
) ctx
->ListExt
.NumOpcodes
) {
8079 /* this is a driver-extended opcode */
8080 ctx
->ListExt
.Opcode
[i
].Print(ctx
, &n
[1]);
8081 n
+= ctx
->ListExt
.Opcode
[i
].Size
;
8086 _mesa_printf("accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8089 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8090 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8092 case OPCODE_CALL_LIST
:
8093 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
8095 case OPCODE_CALL_LIST_OFFSET
:
8096 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8097 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8099 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
8100 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
8101 enum_string(n
[1].e
), enum_string(n
[2].e
),
8102 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8104 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
8105 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
8106 enum_string(n
[1].e
), enum_string(n
[2].e
),
8107 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
8109 case OPCODE_DISABLE
:
8110 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
8113 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
8115 case OPCODE_FRUSTUM
:
8116 _mesa_printf("Frustum %g %g %g %g %g %g\n",
8117 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8119 case OPCODE_LINE_STIPPLE
:
8120 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8122 case OPCODE_LOAD_IDENTITY
:
8123 _mesa_printf("LoadIdentity\n");
8125 case OPCODE_LOAD_MATRIX
:
8126 _mesa_printf("LoadMatrix\n");
8127 _mesa_printf(" %8f %8f %8f %8f\n",
8128 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8129 _mesa_printf(" %8f %8f %8f %8f\n",
8130 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8131 _mesa_printf(" %8f %8f %8f %8f\n",
8132 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8133 _mesa_printf(" %8f %8f %8f %8f\n",
8134 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8136 case OPCODE_MULT_MATRIX
:
8137 _mesa_printf("MultMatrix (or Rotate)\n");
8138 _mesa_printf(" %8f %8f %8f %8f\n",
8139 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8140 _mesa_printf(" %8f %8f %8f %8f\n",
8141 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8142 _mesa_printf(" %8f %8f %8f %8f\n",
8143 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8144 _mesa_printf(" %8f %8f %8f %8f\n",
8145 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8148 _mesa_printf("Ortho %g %g %g %g %g %g\n",
8149 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8151 case OPCODE_POP_ATTRIB
:
8152 _mesa_printf("PopAttrib\n");
8154 case OPCODE_POP_MATRIX
:
8155 _mesa_printf("PopMatrix\n");
8157 case OPCODE_POP_NAME
:
8158 _mesa_printf("PopName\n");
8160 case OPCODE_PUSH_ATTRIB
:
8161 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
8163 case OPCODE_PUSH_MATRIX
:
8164 _mesa_printf("PushMatrix\n");
8166 case OPCODE_PUSH_NAME
:
8167 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
8169 case OPCODE_RASTER_POS
:
8170 _mesa_printf("RasterPos %g %g %g %g\n",
8171 n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
8174 _mesa_printf("Rotate %g %g %g %g\n",
8175 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8178 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8180 case OPCODE_TRANSLATE
:
8181 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8183 case OPCODE_BIND_TEXTURE
:
8184 _mesa_printf("BindTexture %s %d\n",
8185 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8187 case OPCODE_SHADE_MODEL
:
8188 _mesa_printf("ShadeModel %s\n",
8189 _mesa_lookup_enum_by_nr(n
[1].ui
));
8192 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
8193 _mesa_lookup_enum_by_nr(n
[1].ui
),
8194 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8197 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8198 _mesa_lookup_enum_by_nr(n
[1].ui
),
8199 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8200 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8202 case OPCODE_MAPGRID1
:
8203 _mesa_printf("MapGrid1 %d %.3f %.3f\n",
8204 n
[1].i
, n
[2].f
, n
[3].f
);
8206 case OPCODE_MAPGRID2
:
8207 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8208 n
[1].i
, n
[2].f
, n
[3].f
,
8209 n
[4].i
, n
[5].f
, n
[6].f
);
8211 case OPCODE_EVALMESH1
:
8212 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8214 case OPCODE_EVALMESH2
:
8215 _mesa_printf("EvalMesh2 %d %d %d %d\n",
8216 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8219 case OPCODE_ATTR_1F_NV
:
8220 _mesa_printf("ATTR_1F_NV attr %d: %f\n",
8223 case OPCODE_ATTR_2F_NV
:
8224 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
8225 n
[1].i
, n
[2].f
, n
[3].f
);
8227 case OPCODE_ATTR_3F_NV
:
8228 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
8229 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8231 case OPCODE_ATTR_4F_NV
:
8232 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8233 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8235 case OPCODE_ATTR_1F_ARB
:
8236 _mesa_printf("ATTR_1F_ARB attr %d: %f\n",
8239 case OPCODE_ATTR_2F_ARB
:
8240 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
8241 n
[1].i
, n
[2].f
, n
[3].f
);
8243 case OPCODE_ATTR_3F_ARB
:
8244 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8245 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8247 case OPCODE_ATTR_4F_ARB
:
8248 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8249 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8252 case OPCODE_MATERIAL
:
8253 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
8254 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8257 _mesa_printf("INDEX: %f\n", n
[1].f
);
8259 case OPCODE_EDGEFLAG
:
8260 _mesa_printf("EDGEFLAG: %d\n", n
[1].i
);
8263 _mesa_printf("BEGIN %x\n", n
[1].i
);
8266 _mesa_printf("END\n");
8269 _mesa_printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8271 case OPCODE_EVAL_C1
:
8272 _mesa_printf("EVAL_C1 %f\n", n
[1].f
);
8274 case OPCODE_EVAL_C2
:
8275 _mesa_printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8277 case OPCODE_EVAL_P1
:
8278 _mesa_printf("EVAL_P1 %d\n", n
[1].i
);
8280 case OPCODE_EVAL_P2
:
8281 _mesa_printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8287 * meta opcodes/commands
8290 _mesa_printf("Error: %s %s\n",
8291 enum_string(n
[1].e
), (const char *)n
[2].data
);
8293 case OPCODE_CONTINUE
:
8294 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
8295 n
= (Node
*) n
[1].next
;
8297 case OPCODE_END_OF_LIST
:
8298 _mesa_printf("END-LIST %u\n", list
);
8302 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8303 _mesa_printf("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8308 _mesa_printf("command %d, %u operands\n", opcode
, InstSize
[opcode
]);
8311 /* increment n to point to next compiled command */
8312 if (opcode
!=OPCODE_CONTINUE
) {
8313 n
+= InstSize
[opcode
];
8322 * Clients may call this function to help debug display list problems.
8323 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
8324 * changed, or break in the future without notice.
8326 void mesa_print_display_list( GLuint list
)
8328 GET_CURRENT_CONTEXT(ctx
);
8329 print_list( ctx
, list
);
8333 /**********************************************************************/
8334 /***** Initialization *****/
8335 /**********************************************************************/
8338 void _mesa_save_vtxfmt_init( GLvertexformat
*vfmt
)
8340 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
8341 vfmt
->Begin
= save_Begin
;
8342 vfmt
->CallList
= _mesa_save_CallList
;
8343 vfmt
->CallLists
= _mesa_save_CallLists
;
8344 vfmt
->Color3f
= save_Color3f
;
8345 vfmt
->Color3fv
= save_Color3fv
;
8346 vfmt
->Color4f
= save_Color4f
;
8347 vfmt
->Color4fv
= save_Color4fv
;
8348 vfmt
->EdgeFlag
= save_EdgeFlag
;
8349 vfmt
->EdgeFlagv
= save_EdgeFlagv
;
8350 vfmt
->End
= save_End
;
8351 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
8352 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
8353 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
8354 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
8355 vfmt
->EvalPoint1
= save_EvalPoint1
;
8356 vfmt
->EvalPoint2
= save_EvalPoint2
;
8357 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
8358 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
8359 vfmt
->Indexf
= save_Indexf
;
8360 vfmt
->Indexfv
= save_Indexfv
;
8361 vfmt
->Materialfv
= save_Materialfv
;
8362 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
8363 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
8364 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
8365 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
8366 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
8367 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
8368 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
8369 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
8370 vfmt
->Normal3f
= save_Normal3f
;
8371 vfmt
->Normal3fv
= save_Normal3fv
;
8372 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
8373 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
8374 vfmt
->TexCoord1f
= save_TexCoord1f
;
8375 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
8376 vfmt
->TexCoord2f
= save_TexCoord2f
;
8377 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
8378 vfmt
->TexCoord3f
= save_TexCoord3f
;
8379 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
8380 vfmt
->TexCoord4f
= save_TexCoord4f
;
8381 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
8382 vfmt
->Vertex2f
= save_Vertex2f
;
8383 vfmt
->Vertex2fv
= save_Vertex2fv
;
8384 vfmt
->Vertex3f
= save_Vertex3f
;
8385 vfmt
->Vertex3fv
= save_Vertex3fv
;
8386 vfmt
->Vertex4f
= save_Vertex4f
;
8387 vfmt
->Vertex4fv
= save_Vertex4fv
;
8388 vfmt
->VertexAttrib1fNV
= save_VertexAttrib1fNV
;
8389 vfmt
->VertexAttrib1fvNV
= save_VertexAttrib1fvNV
;
8390 vfmt
->VertexAttrib2fNV
= save_VertexAttrib2fNV
;
8391 vfmt
->VertexAttrib2fvNV
= save_VertexAttrib2fvNV
;
8392 vfmt
->VertexAttrib3fNV
= save_VertexAttrib3fNV
;
8393 vfmt
->VertexAttrib3fvNV
= save_VertexAttrib3fvNV
;
8394 vfmt
->VertexAttrib4fNV
= save_VertexAttrib4fNV
;
8395 vfmt
->VertexAttrib4fvNV
= save_VertexAttrib4fvNV
;
8396 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
8397 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
8398 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
8399 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
8400 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
8401 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
8402 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
8403 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
8405 vfmt
->EvalMesh1
= _mesa_save_EvalMesh1
;
8406 vfmt
->EvalMesh2
= _mesa_save_EvalMesh2
;
8407 vfmt
->Rectf
= save_Rectf
;
8409 /* The driver is required to implement these as
8410 * 1) They can probably do a better job.
8411 * 2) A lot of new mechanisms would have to be added to this module
8412 * to support it. That code would probably never get used,
8416 vfmt
->DrawArrays
= 0;
8417 vfmt
->DrawElements
= 0;
8418 vfmt
->DrawRangeElements
= 0;
8424 void _mesa_init_display_list( GLcontext
* ctx
)
8427 ctx
->ListState
.CallDepth
= 0;
8428 ctx
->ExecuteFlag
= GL_TRUE
;
8429 ctx
->CompileFlag
= GL_FALSE
;
8430 ctx
->ListState
.CurrentListPtr
= NULL
;
8431 ctx
->ListState
.CurrentBlock
= NULL
;
8432 ctx
->ListState
.CurrentListNum
= 0;
8433 ctx
->ListState
.CurrentPos
= 0;
8435 /* Display List group */
8436 ctx
->List
.ListBase
= 0;
8438 _mesa_save_vtxfmt_init( &ctx
->ListState
.ListVtxfmt
);