1 /* $Id: dlist.c,v 1.29 2000/02/11 21:14:27 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46 #include "extensions.h"
80 Functions which aren't compiled but executed immediately:
95 Functions which cause errors if called while compiling a display list:
102 * Display list instructions are stored as sequences of "nodes". Nodes
103 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
104 * are linked together with a pointer.
108 /* How many nodes to allocate at a time:
109 * - reduced now that we hold vertices etc. elsewhere.
111 #define BLOCK_SIZE 64
115 * Display list opcodes.
117 * The fact that these identifiers are assigned consecutive
118 * integer values starting at 0 is very important, see InstSize array usage)
120 * KW: Commented out opcodes now handled by vertex-cassettes.
128 OPCODE_BLEND_EQUATION
,
130 OPCODE_BLEND_FUNC_SEPARATE
,
132 OPCODE_CALL_LIST_OFFSET
,
138 OPCODE_CLEAR_STENCIL
,
141 OPCODE_COLOR_MATERIAL
,
143 OPCODE_COLOR_SUB_TABLE
,
145 OPCODE_COPY_TEX_IMAGE1D
,
146 OPCODE_COPY_TEX_IMAGE2D
,
147 OPCODE_COPY_TEX_SUB_IMAGE1D
,
148 OPCODE_COPY_TEX_SUB_IMAGE2D
,
149 OPCODE_COPY_TEX_SUB_IMAGE3D
,
176 OPCODE_LOAD_IDENTITY
,
189 OPCODE_PIXEL_TRANSFER
,
192 OPCODE_POINT_PARAMETERS
,
194 OPCODE_POLYGON_STIPPLE
,
195 OPCODE_POLYGON_OFFSET
,
199 OPCODE_PRIORITIZE_TEXTURE
,
208 OPCODE_SELECT_TEXTURE_SGIS
,
209 OPCODE_SELECT_TEXTURE_COORD_SET
,
220 OPCODE_TEX_SUB_IMAGE1D
,
221 OPCODE_TEX_SUB_IMAGE2D
,
222 OPCODE_TEX_SUB_IMAGE3D
,
226 /* GL_ARB_multitexture */
227 OPCODE_ACTIVE_TEXTURE
,
228 OPCODE_CLIENT_ACTIVE_TEXTURE
,
229 /* The following three are meta instructions */
230 OPCODE_ERROR
, /* raise compiled-in error */
231 OPCODE_VERTEX_CASSETTE
, /* render prebuilt vertex buffer */
238 * Each instruction in the display list is stored as a sequence of
239 * contiguous nodes in memory.
240 * Each node is the union of a variety of datatypes.
254 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
259 /* Number of nodes of storage needed for each instruction: */
260 static GLuint InstSize
[ OPCODE_END_OF_LIST
+1 ];
262 void mesa_print_display_list( GLuint list
);
265 /**********************************************************************/
266 /***** Private *****/
267 /**********************************************************************/
271 * Allocate space for a display list instruction.
272 * Input: opcode - type of instruction
273 * argcount - number of arguments following the instruction
274 * Return: pointer to first node in the instruction
276 static Node
*alloc_instruction( GLcontext
*ctx
, OpCode opcode
, GLint argcount
)
279 GLuint count
= InstSize
[opcode
];
281 assert( (GLint
) count
== argcount
+1 );
283 if (ctx
->CurrentPos
+ count
+ 2 > BLOCK_SIZE
) {
284 /* This block is full. Allocate a new block and chain to it */
285 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
286 n
[0].opcode
= OPCODE_CONTINUE
;
287 newblock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
289 gl_error( ctx
, GL_OUT_OF_MEMORY
, "Building display list" );
292 n
[1].next
= (Node
*) newblock
;
293 ctx
->CurrentBlock
= newblock
;
297 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
298 ctx
->CurrentPos
+= count
;
300 n
[0].opcode
= opcode
;
308 * Make an empty display list. This is used by glGenLists() to
309 * reserver display list IDs.
311 static Node
*make_empty_list( void )
313 Node
*n
= (Node
*) MALLOC( sizeof(Node
) );
314 n
[0].opcode
= OPCODE_END_OF_LIST
;
321 * Destroy all nodes in a display list.
322 * Input: list - display list number
324 void gl_destroy_list( GLcontext
*ctx
, GLuint list
)
332 block
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
335 done
= block
? GL_FALSE
: GL_TRUE
;
337 switch (n
[0].opcode
) {
338 /* special cases first */
339 case OPCODE_VERTEX_CASSETTE
:
340 if ( ! -- ((struct immediate
*) n
[1].data
)->ref_count
)
341 gl_immediate_free( (struct immediate
*) n
[1].data
);
342 n
+= InstSize
[n
[0].opcode
];
346 n
+= InstSize
[n
[0].opcode
];
350 n
+= InstSize
[n
[0].opcode
];
352 case OPCODE_DRAW_PIXELS
:
354 n
+= InstSize
[n
[0].opcode
];
358 n
+= InstSize
[n
[0].opcode
];
360 case OPCODE_COLOR_TABLE
:
362 n
+= InstSize
[n
[0].opcode
];
364 case OPCODE_COLOR_SUB_TABLE
:
366 n
+= InstSize
[n
[0].opcode
];
368 case OPCODE_POLYGON_STIPPLE
:
370 n
+= InstSize
[n
[0].opcode
];
372 case OPCODE_TEX_IMAGE1D
:
374 n
+= InstSize
[n
[0].opcode
];
376 case OPCODE_TEX_IMAGE2D
:
378 n
+= InstSize
[n
[0].opcode
];
380 case OPCODE_TEX_IMAGE3D
:
382 n
+= InstSize
[n
[0].opcode
];
384 case OPCODE_TEX_SUB_IMAGE1D
:
386 n
+= InstSize
[n
[0].opcode
];
388 case OPCODE_TEX_SUB_IMAGE2D
:
390 n
+= InstSize
[n
[0].opcode
];
392 case OPCODE_TEX_SUB_IMAGE3D
:
394 n
+= InstSize
[n
[0].opcode
];
396 case OPCODE_CONTINUE
:
397 n
= (Node
*) n
[1].next
;
401 case OPCODE_END_OF_LIST
:
406 /* Most frequent case */
407 n
+= InstSize
[n
[0].opcode
];
412 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
418 * Translate the nth element of list from type to GLuint.
420 static GLuint
translate_id( GLsizei n
, GLenum type
, const GLvoid
*list
)
432 bptr
= (GLbyte
*) list
;
433 return (GLuint
) *(bptr
+n
);
434 case GL_UNSIGNED_BYTE
:
435 ubptr
= (GLubyte
*) list
;
436 return (GLuint
) *(ubptr
+n
);
438 sptr
= (GLshort
*) list
;
439 return (GLuint
) *(sptr
+n
);
440 case GL_UNSIGNED_SHORT
:
441 usptr
= (GLushort
*) list
;
442 return (GLuint
) *(usptr
+n
);
444 iptr
= (GLint
*) list
;
445 return (GLuint
) *(iptr
+n
);
446 case GL_UNSIGNED_INT
:
447 uiptr
= (GLuint
*) list
;
448 return (GLuint
) *(uiptr
+n
);
450 fptr
= (GLfloat
*) list
;
451 return (GLuint
) *(fptr
+n
);
453 ubptr
= ((GLubyte
*) list
) + 2*n
;
454 return (GLuint
) *ubptr
* 256 + (GLuint
) *(ubptr
+1);
456 ubptr
= ((GLubyte
*) list
) + 3*n
;
457 return (GLuint
) *ubptr
* 65536
458 + (GLuint
) *(ubptr
+1) * 256
459 + (GLuint
) *(ubptr
+2);
461 ubptr
= ((GLubyte
*) list
) + 4*n
;
462 return (GLuint
) *ubptr
* 16777216
463 + (GLuint
) *(ubptr
+1) * 65536
464 + (GLuint
) *(ubptr
+2) * 256
465 + (GLuint
) *(ubptr
+3);
474 /**********************************************************************/
476 /**********************************************************************/
478 void gl_init_lists( void )
480 static int init_flag
= 0;
483 InstSize
[OPCODE_ACCUM
] = 3;
484 InstSize
[OPCODE_ALPHA_FUNC
] = 3;
485 InstSize
[OPCODE_BIND_TEXTURE
] = 3;
486 InstSize
[OPCODE_BITMAP
] = 8;
487 InstSize
[OPCODE_BLEND_COLOR
] = 5;
488 InstSize
[OPCODE_BLEND_EQUATION
] = 2;
489 InstSize
[OPCODE_BLEND_FUNC
] = 3;
490 InstSize
[OPCODE_BLEND_FUNC_SEPARATE
] = 5;
491 InstSize
[OPCODE_CALL_LIST
] = 2;
492 InstSize
[OPCODE_CALL_LIST_OFFSET
] = 2;
493 InstSize
[OPCODE_CLEAR
] = 2;
494 InstSize
[OPCODE_CLEAR_ACCUM
] = 5;
495 InstSize
[OPCODE_CLEAR_COLOR
] = 5;
496 InstSize
[OPCODE_CLEAR_DEPTH
] = 2;
497 InstSize
[OPCODE_CLEAR_INDEX
] = 2;
498 InstSize
[OPCODE_CLEAR_STENCIL
] = 2;
499 InstSize
[OPCODE_CLIP_PLANE
] = 6;
500 InstSize
[OPCODE_COLOR_MASK
] = 5;
501 InstSize
[OPCODE_COLOR_MATERIAL
] = 3;
502 InstSize
[OPCODE_COLOR_TABLE
] = 7;
503 InstSize
[OPCODE_COLOR_SUB_TABLE
] = 7;
504 InstSize
[OPCODE_COPY_PIXELS
] = 6;
505 InstSize
[OPCODE_COPY_TEX_IMAGE1D
] = 8;
506 InstSize
[OPCODE_COPY_TEX_IMAGE2D
] = 9;
507 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE1D
] = 7;
508 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE2D
] = 9;
509 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE3D
] = 10;
510 InstSize
[OPCODE_CULL_FACE
] = 2;
511 InstSize
[OPCODE_DEPTH_FUNC
] = 2;
512 InstSize
[OPCODE_DEPTH_MASK
] = 2;
513 InstSize
[OPCODE_DEPTH_RANGE
] = 3;
514 InstSize
[OPCODE_DISABLE
] = 2;
515 InstSize
[OPCODE_DRAW_BUFFER
] = 2;
516 InstSize
[OPCODE_DRAW_PIXELS
] = 6;
517 InstSize
[OPCODE_ENABLE
] = 2;
518 InstSize
[OPCODE_EVALCOORD1
] = 2;
519 InstSize
[OPCODE_EVALCOORD2
] = 3;
520 InstSize
[OPCODE_EVALMESH1
] = 4;
521 InstSize
[OPCODE_EVALMESH2
] = 6;
522 InstSize
[OPCODE_EVALPOINT1
] = 2;
523 InstSize
[OPCODE_EVALPOINT2
] = 3;
524 InstSize
[OPCODE_FOG
] = 6;
525 InstSize
[OPCODE_FRONT_FACE
] = 2;
526 InstSize
[OPCODE_FRUSTUM
] = 7;
527 InstSize
[OPCODE_HINT
] = 3;
528 InstSize
[OPCODE_HINT_PGI
] = 3;
529 InstSize
[OPCODE_INDEX_MASK
] = 2;
530 InstSize
[OPCODE_INIT_NAMES
] = 1;
531 InstSize
[OPCODE_LIGHT
] = 7;
532 InstSize
[OPCODE_LIGHT_MODEL
] = 6;
533 InstSize
[OPCODE_LINE_STIPPLE
] = 3;
534 InstSize
[OPCODE_LINE_WIDTH
] = 2;
535 InstSize
[OPCODE_LIST_BASE
] = 2;
536 InstSize
[OPCODE_LOAD_IDENTITY
] = 1;
537 InstSize
[OPCODE_LOAD_MATRIX
] = 17;
538 InstSize
[OPCODE_LOAD_NAME
] = 2;
539 InstSize
[OPCODE_LOGIC_OP
] = 2;
540 InstSize
[OPCODE_MAP1
] = 7;
541 InstSize
[OPCODE_MAP2
] = 11;
542 InstSize
[OPCODE_MAPGRID1
] = 4;
543 InstSize
[OPCODE_MAPGRID2
] = 7;
544 InstSize
[OPCODE_MATRIX_MODE
] = 2;
545 InstSize
[OPCODE_MULT_MATRIX
] = 17;
546 InstSize
[OPCODE_ORTHO
] = 7;
547 InstSize
[OPCODE_PASSTHROUGH
] = 2;
548 InstSize
[OPCODE_PIXEL_MAP
] = 4;
549 InstSize
[OPCODE_PIXEL_TRANSFER
] = 3;
550 InstSize
[OPCODE_PIXEL_ZOOM
] = 3;
551 InstSize
[OPCODE_POINT_SIZE
] = 2;
552 InstSize
[OPCODE_POINT_PARAMETERS
] = 5;
553 InstSize
[OPCODE_POLYGON_MODE
] = 3;
554 InstSize
[OPCODE_POLYGON_STIPPLE
] = 2;
555 InstSize
[OPCODE_POLYGON_OFFSET
] = 3;
556 InstSize
[OPCODE_POP_ATTRIB
] = 1;
557 InstSize
[OPCODE_POP_MATRIX
] = 1;
558 InstSize
[OPCODE_POP_NAME
] = 1;
559 InstSize
[OPCODE_PRIORITIZE_TEXTURE
] = 3;
560 InstSize
[OPCODE_PUSH_ATTRIB
] = 2;
561 InstSize
[OPCODE_PUSH_MATRIX
] = 1;
562 InstSize
[OPCODE_PUSH_NAME
] = 2;
563 InstSize
[OPCODE_RASTER_POS
] = 5;
564 InstSize
[OPCODE_RECTF
] = 5;
565 InstSize
[OPCODE_READ_BUFFER
] = 2;
566 InstSize
[OPCODE_SCALE
] = 4;
567 InstSize
[OPCODE_SCISSOR
] = 5;
568 InstSize
[OPCODE_STENCIL_FUNC
] = 4;
569 InstSize
[OPCODE_STENCIL_MASK
] = 2;
570 InstSize
[OPCODE_STENCIL_OP
] = 4;
571 InstSize
[OPCODE_SHADE_MODEL
] = 2;
572 InstSize
[OPCODE_TEXENV
] = 7;
573 InstSize
[OPCODE_TEXGEN
] = 7;
574 InstSize
[OPCODE_TEXPARAMETER
] = 7;
575 InstSize
[OPCODE_TEX_IMAGE1D
] = 9;
576 InstSize
[OPCODE_TEX_IMAGE2D
] = 10;
577 InstSize
[OPCODE_TEX_IMAGE3D
] = 11;
578 InstSize
[OPCODE_TEX_SUB_IMAGE1D
] = 8;
579 InstSize
[OPCODE_TEX_SUB_IMAGE2D
] = 10;
580 InstSize
[OPCODE_TEX_SUB_IMAGE3D
] = 12;
581 InstSize
[OPCODE_TRANSLATE
] = 4;
582 InstSize
[OPCODE_VIEWPORT
] = 5;
583 InstSize
[OPCODE_WINDOW_POS
] = 5;
584 InstSize
[OPCODE_CONTINUE
] = 2;
585 InstSize
[OPCODE_ERROR
] = 3;
586 InstSize
[OPCODE_VERTEX_CASSETTE
] = 9;
587 InstSize
[OPCODE_END_OF_LIST
] = 1;
588 /* GL_ARB_multitexture */
589 InstSize
[OPCODE_ACTIVE_TEXTURE
] = 2;
590 InstSize
[OPCODE_CLIENT_ACTIVE_TEXTURE
] = 2;
597 * Display List compilation functions
602 static void save_Accum( GLenum op
, GLfloat value
)
604 GET_CURRENT_CONTEXT(ctx
);
606 FLUSH_VB(ctx
, "dlist");
607 n
= alloc_instruction( ctx
, OPCODE_ACCUM
, 2 );
612 if (ctx
->ExecuteFlag
) {
613 (*ctx
->Exec
.Accum
)( op
, value
);
618 static void save_AlphaFunc( GLenum func
, GLclampf ref
)
620 GET_CURRENT_CONTEXT(ctx
);
622 FLUSH_VB(ctx
, "dlist");
623 n
= alloc_instruction( ctx
, OPCODE_ALPHA_FUNC
, 2 );
626 n
[2].f
= (GLfloat
) ref
;
628 if (ctx
->ExecuteFlag
) {
629 (*ctx
->Exec
.AlphaFunc
)( func
, ref
);
634 static void save_Begin( GLenum mode
)
636 _mesa_Begin(mode
); /* special case */
640 static void save_BindTexture( GLenum target
, GLuint texture
)
642 GET_CURRENT_CONTEXT(ctx
);
644 FLUSH_VB(ctx
, "dlist");
645 n
= alloc_instruction( ctx
, OPCODE_BIND_TEXTURE
, 2 );
650 if (ctx
->ExecuteFlag
) {
651 (*ctx
->Exec
.BindTexture
)( target
, texture
);
656 static void save_Bitmap( GLsizei width
, GLsizei height
,
657 GLfloat xorig
, GLfloat yorig
,
658 GLfloat xmove
, GLfloat ymove
,
659 const GLubyte
*pixels
)
661 GET_CURRENT_CONTEXT(ctx
);
662 GLvoid
*image
= _mesa_unpack_bitmap( width
, height
, pixels
, &ctx
->Unpack
);
664 FLUSH_VB(ctx
, "dlist");
665 n
= alloc_instruction( ctx
, OPCODE_BITMAP
, 7 );
667 n
[1].i
= (GLint
) width
;
668 n
[2].i
= (GLint
) height
;
678 if (ctx
->ExecuteFlag
) {
679 (*ctx
->Exec
.Bitmap
)( width
, height
,
680 xorig
, yorig
, xmove
, ymove
, pixels
);
685 static void save_BlendEquation( GLenum mode
)
687 GET_CURRENT_CONTEXT(ctx
);
689 FLUSH_VB(ctx
, "dlist");
690 n
= alloc_instruction( ctx
, OPCODE_BLEND_EQUATION
, 1 );
694 if (ctx
->ExecuteFlag
) {
695 (*ctx
->Exec
.BlendEquationEXT
)( mode
);
700 static void save_BlendFunc( GLenum sfactor
, GLenum dfactor
)
702 GET_CURRENT_CONTEXT(ctx
);
704 FLUSH_VB(ctx
, "dlist");
705 n
= alloc_instruction( ctx
, OPCODE_BLEND_FUNC
, 2 );
710 if (ctx
->ExecuteFlag
) {
711 (*ctx
->Exec
.BlendFunc
)( sfactor
, dfactor
);
716 static void save_BlendFuncSeparateINGR(GLenum sfactorRGB
, GLenum dfactorRGB
,
717 GLenum sfactorA
, GLenum dfactorA
)
719 GET_CURRENT_CONTEXT(ctx
);
721 FLUSH_VB(ctx
, "dlist");
722 n
= alloc_instruction( ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4 );
729 if (ctx
->ExecuteFlag
) {
730 (*ctx
->Exec
.BlendFuncSeparateINGR
)( sfactorRGB
, dfactorRGB
,
736 static void save_BlendColor( GLfloat red
, GLfloat green
,
737 GLfloat blue
, GLfloat alpha
)
739 GET_CURRENT_CONTEXT(ctx
);
741 FLUSH_VB(ctx
, "dlist");
742 n
= alloc_instruction( ctx
, OPCODE_BLEND_COLOR
, 4 );
749 if (ctx
->ExecuteFlag
) {
750 (*ctx
->Exec
.BlendColorEXT
)( red
, green
, blue
, alpha
);
755 static void save_CallList( GLuint list
)
757 GET_CURRENT_CONTEXT(ctx
);
759 FLUSH_VB(ctx
, "dlist");
760 n
= alloc_instruction( ctx
, OPCODE_CALL_LIST
, 1 );
764 if (ctx
->ExecuteFlag
) {
765 (*ctx
->Exec
.CallList
)( list
);
770 static void save_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
772 GET_CURRENT_CONTEXT(ctx
);
774 FLUSH_VB(ctx
, "dlist");
777 GLuint list
= translate_id( i
, type
, lists
);
778 Node
*n
= alloc_instruction( ctx
, OPCODE_CALL_LIST_OFFSET
, 1 );
783 if (ctx
->ExecuteFlag
) {
784 (*ctx
->Exec
.CallLists
)( n
, type
, lists
);
789 static void save_Clear( GLbitfield mask
)
791 GET_CURRENT_CONTEXT(ctx
);
793 FLUSH_VB(ctx
, "dlist");
794 n
= alloc_instruction( ctx
, OPCODE_CLEAR
, 1 );
798 if (ctx
->ExecuteFlag
) {
799 (*ctx
->Exec
.Clear
)( mask
);
804 static void save_ClearAccum( GLfloat red
, GLfloat green
,
805 GLfloat blue
, GLfloat alpha
)
807 GET_CURRENT_CONTEXT(ctx
);
809 FLUSH_VB(ctx
, "dlist");
810 n
= alloc_instruction( ctx
, OPCODE_CLEAR_ACCUM
, 4 );
817 if (ctx
->ExecuteFlag
) {
818 (*ctx
->Exec
.ClearAccum
)( red
, green
, blue
, alpha
);
823 static void save_ClearColor( GLclampf red
, GLclampf green
,
824 GLclampf blue
, GLclampf alpha
)
826 GET_CURRENT_CONTEXT(ctx
);
828 FLUSH_VB(ctx
, "dlist");
829 n
= alloc_instruction( ctx
, OPCODE_CLEAR_COLOR
, 4 );
836 if (ctx
->ExecuteFlag
) {
837 (*ctx
->Exec
.ClearColor
)( red
, green
, blue
, alpha
);
842 static void save_ClearDepth( GLclampd depth
)
844 GET_CURRENT_CONTEXT(ctx
);
846 FLUSH_VB(ctx
, "dlist");
847 n
= alloc_instruction( ctx
, OPCODE_CLEAR_DEPTH
, 1 );
849 n
[1].f
= (GLfloat
) depth
;
851 if (ctx
->ExecuteFlag
) {
852 (*ctx
->Exec
.ClearDepth
)( depth
);
857 static void save_ClearIndex( GLfloat c
)
859 GET_CURRENT_CONTEXT(ctx
);
861 FLUSH_VB(ctx
, "dlist");
862 n
= alloc_instruction( ctx
, OPCODE_CLEAR_INDEX
, 1 );
866 if (ctx
->ExecuteFlag
) {
867 (*ctx
->Exec
.ClearIndex
)( c
);
872 static void save_ClearStencil( GLint s
)
874 GET_CURRENT_CONTEXT(ctx
);
876 FLUSH_VB(ctx
, "dlist");
877 n
= alloc_instruction( ctx
, OPCODE_CLEAR_STENCIL
, 1 );
881 if (ctx
->ExecuteFlag
) {
882 (*ctx
->Exec
.ClearStencil
)( s
);
887 static void save_ClipPlane( GLenum plane
, const GLdouble
*equ
)
889 GET_CURRENT_CONTEXT(ctx
);
891 FLUSH_VB(ctx
, "dlist");
892 n
= alloc_instruction( ctx
, OPCODE_CLIP_PLANE
, 5 );
900 if (ctx
->ExecuteFlag
) {
901 (*ctx
->Exec
.ClipPlane
)( plane
, equ
);
907 static void save_ColorMask( GLboolean red
, GLboolean green
,
908 GLboolean blue
, GLboolean alpha
)
910 GET_CURRENT_CONTEXT(ctx
);
912 FLUSH_VB(ctx
, "dlist");
913 n
= alloc_instruction( ctx
, OPCODE_COLOR_MASK
, 4 );
920 if (ctx
->ExecuteFlag
) {
921 (*ctx
->Exec
.ColorMask
)( red
, green
, blue
, alpha
);
926 static void save_ColorMaterial( GLenum face
, GLenum mode
)
928 GET_CURRENT_CONTEXT(ctx
);
930 FLUSH_VB(ctx
, "dlist");
931 n
= alloc_instruction( ctx
, OPCODE_COLOR_MATERIAL
, 2 );
936 if (ctx
->ExecuteFlag
) {
937 (*ctx
->Exec
.ColorMaterial
)( face
, mode
);
942 static void save_ColorTableEXT( GLenum target
, GLenum internalFormat
,
943 GLsizei width
, GLenum format
, GLenum type
,
944 const GLvoid
*table
)
946 GET_CURRENT_CONTEXT(ctx
);
947 if (target
== GL_PROXY_TEXTURE_1D
||
948 target
== GL_PROXY_TEXTURE_2D
||
949 target
== GL_PROXY_TEXTURE_3D
) {
950 /* execute immediately */
951 (*ctx
->Exec
.ColorTableEXT
)( target
, internalFormat
, width
,
952 format
, type
, table
);
955 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, table
,
958 FLUSH_VB(ctx
, "dlist");
959 n
= alloc_instruction( ctx
, OPCODE_COLOR_TABLE
, 6 );
962 n
[2].e
= internalFormat
;
971 if (ctx
->ExecuteFlag
) {
972 (*ctx
->Exec
.ColorTableEXT
)( target
, internalFormat
, width
,
973 format
, type
, table
);
979 static void save_ColorSubTableEXT( GLenum target
, GLsizei start
, GLsizei count
,
980 GLenum format
, GLenum type
,
983 GET_CURRENT_CONTEXT(ctx
);
984 GLvoid
*image
= _mesa_unpack_image(count
, 1, 1, format
, type
, table
,
987 FLUSH_VB(ctx
, "dlist");
988 n
= alloc_instruction( ctx
, OPCODE_COLOR_SUB_TABLE
, 6 );
1000 if (ctx
->ExecuteFlag
) {
1001 (*ctx
->Exec
.ColorSubTableEXT
)(target
, start
, count
, format
, type
, table
);
1007 static void save_CopyPixels( GLint x
, GLint y
,
1008 GLsizei width
, GLsizei height
, GLenum type
)
1010 GET_CURRENT_CONTEXT(ctx
);
1012 FLUSH_VB(ctx
, "dlist");
1013 n
= alloc_instruction( ctx
, OPCODE_COPY_PIXELS
, 5 );
1017 n
[3].i
= (GLint
) width
;
1018 n
[4].i
= (GLint
) height
;
1021 if (ctx
->ExecuteFlag
) {
1022 (*ctx
->Exec
.CopyPixels
)( x
, y
, width
, height
, type
);
1029 save_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
1030 GLint x
, GLint y
, GLsizei width
, GLint border
)
1032 GET_CURRENT_CONTEXT(ctx
);
1034 FLUSH_VB(ctx
, "dlist");
1035 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7 );
1039 n
[3].e
= internalformat
;
1045 if (ctx
->ExecuteFlag
) {
1046 (*ctx
->Exec
.CopyTexImage1D
)( target
, level
, internalformat
,
1047 x
, y
, width
, border
);
1053 save_CopyTexImage2D( GLenum target
, GLint level
,
1054 GLenum internalformat
,
1055 GLint x
, GLint y
, GLsizei width
,
1056 GLsizei height
, GLint border
)
1058 GET_CURRENT_CONTEXT(ctx
);
1060 FLUSH_VB(ctx
, "dlist");
1061 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8 );
1065 n
[3].e
= internalformat
;
1072 if (ctx
->ExecuteFlag
) {
1073 (*ctx
->Exec
.CopyTexImage2D
)( target
, level
, internalformat
,
1074 x
, y
, width
, height
, border
);
1081 save_CopyTexSubImage1D( GLenum target
, GLint level
,
1082 GLint xoffset
, GLint x
, GLint y
,
1085 GET_CURRENT_CONTEXT(ctx
);
1087 FLUSH_VB(ctx
, "dlist");
1088 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6 );
1097 if (ctx
->ExecuteFlag
) {
1098 (*ctx
->Exec
.CopyTexSubImage1D
)( target
, level
, xoffset
, x
, y
, width
);
1104 save_CopyTexSubImage2D( GLenum target
, GLint level
,
1105 GLint xoffset
, GLint yoffset
,
1107 GLsizei width
, GLint height
)
1109 GET_CURRENT_CONTEXT(ctx
);
1111 FLUSH_VB(ctx
, "dlist");
1112 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8 );
1123 if (ctx
->ExecuteFlag
) {
1124 (*ctx
->Exec
.CopyTexSubImage2D
)( target
, level
, xoffset
, yoffset
,
1125 x
, y
, width
, height
);
1131 save_CopyTexSubImage3D( GLenum target
, GLint level
,
1132 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1134 GLsizei width
, GLint height
)
1136 GET_CURRENT_CONTEXT(ctx
);
1138 FLUSH_VB(ctx
, "dlist");
1139 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9 );
1151 if (ctx
->ExecuteFlag
) {
1152 (*ctx
->Exec
.CopyTexSubImage3D
)( target
, level
,
1153 xoffset
, yoffset
, zoffset
,
1154 x
, y
, width
, height
);
1159 static void save_CullFace( GLenum mode
)
1161 GET_CURRENT_CONTEXT(ctx
);
1163 FLUSH_VB(ctx
, "dlist");
1164 n
= alloc_instruction( ctx
, OPCODE_CULL_FACE
, 1 );
1168 if (ctx
->ExecuteFlag
) {
1169 (*ctx
->Exec
.CullFace
)( mode
);
1174 static void save_DepthFunc( GLenum func
)
1176 GET_CURRENT_CONTEXT(ctx
);
1178 FLUSH_VB(ctx
, "dlist");
1179 n
= alloc_instruction( ctx
, OPCODE_DEPTH_FUNC
, 1 );
1183 if (ctx
->ExecuteFlag
) {
1184 (*ctx
->Exec
.DepthFunc
)( func
);
1189 static void save_DepthMask( GLboolean mask
)
1191 GET_CURRENT_CONTEXT(ctx
);
1193 FLUSH_VB(ctx
, "dlist");
1194 n
= alloc_instruction( ctx
, OPCODE_DEPTH_MASK
, 1 );
1198 if (ctx
->ExecuteFlag
) {
1199 (*ctx
->Exec
.DepthMask
)( mask
);
1204 static void save_DepthRange( GLclampd nearval
, GLclampd farval
)
1206 GET_CURRENT_CONTEXT(ctx
);
1208 FLUSH_VB(ctx
, "dlist");
1209 n
= alloc_instruction( ctx
, OPCODE_DEPTH_RANGE
, 2 );
1211 n
[1].f
= (GLfloat
) nearval
;
1212 n
[2].f
= (GLfloat
) farval
;
1214 if (ctx
->ExecuteFlag
) {
1215 (*ctx
->Exec
.DepthRange
)( nearval
, farval
);
1220 static void save_Disable( GLenum cap
)
1222 GET_CURRENT_CONTEXT(ctx
);
1224 FLUSH_VB(ctx
, "dlist");
1225 n
= alloc_instruction( ctx
, OPCODE_DISABLE
, 1 );
1229 if (ctx
->ExecuteFlag
) {
1230 (*ctx
->Exec
.Disable
)( cap
);
1235 static void save_DrawBuffer( GLenum mode
)
1237 GET_CURRENT_CONTEXT(ctx
);
1239 FLUSH_VB(ctx
, "dlist");
1240 n
= alloc_instruction( ctx
, OPCODE_DRAW_BUFFER
, 1 );
1244 if (ctx
->ExecuteFlag
) {
1245 (*ctx
->Exec
.DrawBuffer
)( mode
);
1250 static void save_DrawPixels( GLsizei width
, GLsizei height
,
1251 GLenum format
, GLenum type
,
1252 const GLvoid
*pixels
)
1254 GET_CURRENT_CONTEXT(ctx
);
1255 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
1256 pixels
, &ctx
->Unpack
);
1258 FLUSH_VB(ctx
, "dlist");
1259 n
= alloc_instruction( ctx
, OPCODE_DRAW_PIXELS
, 5 );
1270 if (ctx
->ExecuteFlag
) {
1271 (*ctx
->Exec
.DrawPixels
)( width
, height
, format
, type
, pixels
);
1277 static void save_Enable( GLenum cap
)
1279 GET_CURRENT_CONTEXT(ctx
);
1281 FLUSH_VB(ctx
, "dlist");
1282 n
= alloc_instruction( ctx
, OPCODE_ENABLE
, 1 );
1286 if (ctx
->ExecuteFlag
) {
1287 (*ctx
->Exec
.Enable
)( cap
);
1293 static void save_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
1295 GET_CURRENT_CONTEXT(ctx
);
1297 FLUSH_VB(ctx
, "dlist");
1298 n
= alloc_instruction( ctx
, OPCODE_EVALMESH1
, 3 );
1304 if (ctx
->ExecuteFlag
) {
1305 (*ctx
->Exec
.EvalMesh1
)( mode
, i1
, i2
);
1310 static void save_EvalMesh2(
1311 GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1313 GET_CURRENT_CONTEXT(ctx
);
1315 FLUSH_VB(ctx
, "dlist");
1316 n
= alloc_instruction( ctx
, OPCODE_EVALMESH2
, 5 );
1324 if (ctx
->ExecuteFlag
) {
1325 (*ctx
->Exec
.EvalMesh2
)( mode
, i1
, i2
, j1
, j2
);
1332 static void save_Fogfv( GLenum pname
, const GLfloat
*params
)
1334 GET_CURRENT_CONTEXT(ctx
);
1336 FLUSH_VB(ctx
, "dlist");
1337 n
= alloc_instruction( ctx
, OPCODE_FOG
, 5 );
1345 if (ctx
->ExecuteFlag
) {
1346 (*ctx
->Exec
.Fogfv
)( pname
, params
);
1351 static void save_Fogf( GLenum pname
, GLfloat param
)
1353 save_Fogfv(pname
, ¶m
);
1357 static void save_Fogiv(GLenum pname
, const GLint
*params
)
1362 case GL_FOG_DENSITY
:
1366 p
[0] = (GLfloat
) *params
;
1369 p
[0] = INT_TO_FLOAT( params
[0] );
1370 p
[1] = INT_TO_FLOAT( params
[1] );
1371 p
[2] = INT_TO_FLOAT( params
[2] );
1372 p
[3] = INT_TO_FLOAT( params
[3] );
1375 /* Error will be caught later in gl_Fogfv */
1378 save_Fogfv(pname
, p
);
1382 static void save_Fogi(GLenum pname
, GLint param
)
1384 save_Fogiv(pname
, ¶m
);
1388 static void save_FrontFace( GLenum mode
)
1390 GET_CURRENT_CONTEXT(ctx
);
1392 FLUSH_VB(ctx
, "dlist");
1393 n
= alloc_instruction( ctx
, OPCODE_FRONT_FACE
, 1 );
1397 if (ctx
->ExecuteFlag
) {
1398 (*ctx
->Exec
.FrontFace
)( mode
);
1403 static void save_Frustum( GLdouble left
, GLdouble right
,
1404 GLdouble bottom
, GLdouble top
,
1405 GLdouble nearval
, GLdouble farval
)
1407 GET_CURRENT_CONTEXT(ctx
);
1409 FLUSH_VB(ctx
, "dlist");
1410 n
= alloc_instruction( ctx
, OPCODE_FRUSTUM
, 6 );
1419 if (ctx
->ExecuteFlag
) {
1420 (*ctx
->Exec
.Frustum
)( left
, right
, bottom
, top
, nearval
, farval
);
1425 static void save_Hint( GLenum target
, GLenum mode
)
1427 GET_CURRENT_CONTEXT(ctx
);
1429 FLUSH_VB(ctx
, "dlist");
1430 n
= alloc_instruction( ctx
, OPCODE_HINT
, 2 );
1435 if (ctx
->ExecuteFlag
) {
1436 (*ctx
->Exec
.Hint
)( target
, mode
);
1441 /* GL_PGI_misc_hints*/
1442 static void save_HintPGI( GLenum target
, GLint mode
)
1444 GET_CURRENT_CONTEXT(ctx
);
1446 FLUSH_VB(ctx
, "dlist");
1447 n
= alloc_instruction( ctx
, OPCODE_HINT_PGI
, 2 );
1452 if (ctx
->ExecuteFlag
) {
1453 (*ctx
->Exec
.HintPGI
)( target
, mode
);
1458 static void save_IndexMask( GLuint mask
)
1460 GET_CURRENT_CONTEXT(ctx
);
1462 FLUSH_VB(ctx
, "dlist");
1463 n
= alloc_instruction( ctx
, OPCODE_INDEX_MASK
, 1 );
1467 if (ctx
->ExecuteFlag
) {
1468 (*ctx
->Exec
.IndexMask
)( mask
);
1473 static void save_InitNames( void )
1475 GET_CURRENT_CONTEXT(ctx
);
1476 FLUSH_VB(ctx
, "dlist");
1477 (void) alloc_instruction( ctx
, OPCODE_INIT_NAMES
, 0 );
1478 if (ctx
->ExecuteFlag
) {
1479 (*ctx
->Exec
.InitNames
)();
1484 static void save_Lightfv( GLenum light
, GLenum pname
, const GLfloat
*params
)
1486 GET_CURRENT_CONTEXT(ctx
);
1488 FLUSH_VB(ctx
, "dlist");
1489 n
= alloc_instruction( ctx
, OPCODE_LIGHT
, 6 );
1507 case GL_SPOT_DIRECTION
:
1510 case GL_SPOT_EXPONENT
:
1513 case GL_SPOT_CUTOFF
:
1516 case GL_CONSTANT_ATTENUATION
:
1519 case GL_LINEAR_ATTENUATION
:
1522 case GL_QUADRATIC_ATTENUATION
:
1528 for (i
= 0; i
< nParams
; i
++) {
1529 n
[3+i
].f
= params
[i
];
1532 if (ctx
->ExecuteFlag
) {
1533 (*ctx
->Exec
.Lightfv
)( light
, pname
, params
);
1538 static void save_Lightf( GLenum light
, GLenum pname
, GLfloat params
)
1540 save_Lightfv(light
, pname
, ¶ms
);
1544 static void save_Lightiv( GLenum light
, GLenum pname
, const GLint
*params
)
1551 fparam
[0] = INT_TO_FLOAT( params
[0] );
1552 fparam
[1] = INT_TO_FLOAT( params
[1] );
1553 fparam
[2] = INT_TO_FLOAT( params
[2] );
1554 fparam
[3] = INT_TO_FLOAT( params
[3] );
1557 fparam
[0] = (GLfloat
) params
[0];
1558 fparam
[1] = (GLfloat
) params
[1];
1559 fparam
[2] = (GLfloat
) params
[2];
1560 fparam
[3] = (GLfloat
) params
[3];
1562 case GL_SPOT_DIRECTION
:
1563 fparam
[0] = (GLfloat
) params
[0];
1564 fparam
[1] = (GLfloat
) params
[1];
1565 fparam
[2] = (GLfloat
) params
[2];
1567 case GL_SPOT_EXPONENT
:
1568 case GL_SPOT_CUTOFF
:
1569 case GL_CONSTANT_ATTENUATION
:
1570 case GL_LINEAR_ATTENUATION
:
1571 case GL_QUADRATIC_ATTENUATION
:
1572 fparam
[0] = (GLfloat
) params
[0];
1575 /* error will be caught later in gl_Lightfv */
1578 save_Lightfv( light
, pname
, fparam
);
1582 static void save_Lighti( GLenum light
, GLenum pname
, GLint param
)
1584 save_Lightiv( light
, pname
, ¶m
);
1588 static void save_LightModelfv( GLenum pname
, const GLfloat
*params
)
1590 GET_CURRENT_CONTEXT(ctx
);
1592 FLUSH_VB(ctx
, "dlist");
1593 n
= alloc_instruction( ctx
, OPCODE_LIGHT_MODEL
, 5 );
1601 if (ctx
->ExecuteFlag
) {
1602 (*ctx
->Exec
.LightModelfv
)( pname
, params
);
1607 static void save_LightModelf( GLenum pname
, GLfloat param
)
1609 save_LightModelfv(pname
, ¶m
);
1613 static void save_LightModeliv( GLenum pname
, const GLint
*params
)
1617 case GL_LIGHT_MODEL_AMBIENT
:
1618 fparam
[0] = INT_TO_FLOAT( params
[0] );
1619 fparam
[1] = INT_TO_FLOAT( params
[1] );
1620 fparam
[2] = INT_TO_FLOAT( params
[2] );
1621 fparam
[3] = INT_TO_FLOAT( params
[3] );
1623 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
1624 case GL_LIGHT_MODEL_TWO_SIDE
:
1625 case GL_LIGHT_MODEL_COLOR_CONTROL
:
1626 fparam
[0] = (GLfloat
) params
[0];
1629 /* Error will be caught later in gl_LightModelfv */
1632 save_LightModelfv(pname
, fparam
);
1636 static void save_LightModeli( GLenum pname
, GLint param
)
1638 save_LightModeliv(pname
, ¶m
);
1642 static void save_LineStipple( GLint factor
, GLushort pattern
)
1644 GET_CURRENT_CONTEXT(ctx
);
1646 FLUSH_VB(ctx
, "dlist");
1647 n
= alloc_instruction( ctx
, OPCODE_LINE_STIPPLE
, 2 );
1652 if (ctx
->ExecuteFlag
) {
1653 (*ctx
->Exec
.LineStipple
)( factor
, pattern
);
1658 static void save_LineWidth( GLfloat width
)
1660 GET_CURRENT_CONTEXT(ctx
);
1662 FLUSH_VB(ctx
, "dlist");
1663 n
= alloc_instruction( ctx
, OPCODE_LINE_WIDTH
, 1 );
1667 if (ctx
->ExecuteFlag
) {
1668 (*ctx
->Exec
.LineWidth
)( width
);
1673 static void save_ListBase( GLuint base
)
1675 GET_CURRENT_CONTEXT(ctx
);
1677 FLUSH_VB(ctx
, "dlist");
1678 n
= alloc_instruction( ctx
, OPCODE_LIST_BASE
, 1 );
1682 if (ctx
->ExecuteFlag
) {
1683 (*ctx
->Exec
.ListBase
)( base
);
1688 static void save_LoadIdentity( void )
1690 GET_CURRENT_CONTEXT(ctx
);
1691 FLUSH_VB(ctx
, "dlist");
1692 (void) alloc_instruction( ctx
, OPCODE_LOAD_IDENTITY
, 0 );
1693 if (ctx
->ExecuteFlag
) {
1694 (*ctx
->Exec
.LoadIdentity
)();
1699 static void save_LoadMatrixf( const GLfloat
*m
)
1701 GET_CURRENT_CONTEXT(ctx
);
1703 FLUSH_VB(ctx
, "dlist");
1704 n
= alloc_instruction( ctx
, OPCODE_LOAD_MATRIX
, 16 );
1707 for (i
=0;i
<16;i
++) {
1711 if (ctx
->ExecuteFlag
) {
1712 (*ctx
->Exec
.LoadMatrixf
)( m
);
1717 static void save_LoadMatrixd( const GLdouble
*m
)
1721 for (i
= 0; i
< 16; i
++) {
1724 save_LoadMatrixf(f
);
1728 static void save_LoadName( GLuint name
)
1730 GET_CURRENT_CONTEXT(ctx
);
1732 FLUSH_VB(ctx
, "dlist");
1733 n
= alloc_instruction( ctx
, OPCODE_LOAD_NAME
, 1 );
1737 if (ctx
->ExecuteFlag
) {
1738 (*ctx
->Exec
.LoadName
)( name
);
1743 static void save_LogicOp( GLenum opcode
)
1745 GET_CURRENT_CONTEXT(ctx
);
1747 FLUSH_VB(ctx
, "dlist");
1748 n
= alloc_instruction( ctx
, OPCODE_LOGIC_OP
, 1 );
1752 if (ctx
->ExecuteFlag
) {
1753 (*ctx
->Exec
.LogicOp
)( opcode
);
1758 static void save_Map1d( GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
1759 GLint order
, const GLdouble
*points
)
1761 GET_CURRENT_CONTEXT(ctx
);
1763 FLUSH_VB(ctx
, "dlist");
1764 n
= alloc_instruction( ctx
, OPCODE_MAP1
, 6 );
1766 GLfloat
*pnts
= gl_copy_map_points1d( target
, stride
, order
, points
);
1770 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
1772 n
[6].data
= (void *) pnts
;
1774 if (ctx
->ExecuteFlag
) {
1775 (*ctx
->Exec
.Map1d
)( target
, u1
, u2
, stride
, order
, points
);
1779 static void save_Map1f( GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
1780 GLint order
, const GLfloat
*points
)
1782 GET_CURRENT_CONTEXT(ctx
);
1784 FLUSH_VB(ctx
, "dlist");
1785 n
= alloc_instruction( ctx
, OPCODE_MAP1
, 6 );
1787 GLfloat
*pnts
= gl_copy_map_points1f( target
, stride
, order
, points
);
1791 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
1793 n
[6].data
= (void *) pnts
;
1795 if (ctx
->ExecuteFlag
) {
1796 (*ctx
->Exec
.Map1f
)( target
, u1
, u2
, stride
, order
, points
);
1801 static void save_Map2d( GLenum target
,
1802 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
1803 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
1804 const GLdouble
*points
)
1806 GET_CURRENT_CONTEXT(ctx
);
1808 FLUSH_VB(ctx
, "dlist");
1809 n
= alloc_instruction( ctx
, OPCODE_MAP2
, 10 );
1811 GLfloat
*pnts
= gl_copy_map_points2d( target
, ustride
, uorder
,
1812 vstride
, vorder
, points
);
1818 /* XXX verify these strides are correct */
1819 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
1820 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
1823 n
[10].data
= (void *) pnts
;
1825 if (ctx
->ExecuteFlag
) {
1826 (*ctx
->Exec
.Map2d
)( target
,
1827 u1
, u2
, ustride
, uorder
,
1828 v1
, v2
, vstride
, vorder
, points
);
1833 static void save_Map2f( GLenum target
,
1834 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
1835 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
1836 const GLfloat
*points
)
1838 GET_CURRENT_CONTEXT(ctx
);
1840 FLUSH_VB(ctx
, "dlist");
1841 n
= alloc_instruction( ctx
, OPCODE_MAP2
, 10 );
1843 GLfloat
*pnts
= gl_copy_map_points2f( target
, ustride
, uorder
,
1844 vstride
, vorder
, points
);
1850 /* XXX verify these strides are correct */
1851 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
1852 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
1855 n
[10].data
= (void *) pnts
;
1857 if (ctx
->ExecuteFlag
) {
1858 (*ctx
->Exec
.Map2f
)( target
, u1
, u2
, ustride
, uorder
,
1859 v1
, v2
, vstride
, vorder
, points
);
1864 static void save_MapGrid1f( GLint un
, GLfloat u1
, GLfloat u2
)
1866 GET_CURRENT_CONTEXT(ctx
);
1868 FLUSH_VB(ctx
, "dlist");
1869 n
= alloc_instruction( ctx
, OPCODE_MAPGRID1
, 3 );
1875 if (ctx
->ExecuteFlag
) {
1876 (*ctx
->Exec
.MapGrid1f
)( un
, u1
, u2
);
1881 static void save_MapGrid1d( GLint un
, GLdouble u1
, GLdouble u2
)
1883 save_MapGrid1f(un
, u1
, u2
);
1887 static void save_MapGrid2f( GLint un
, GLfloat u1
, GLfloat u2
,
1888 GLint vn
, GLfloat v1
, GLfloat v2
)
1890 GET_CURRENT_CONTEXT(ctx
);
1892 FLUSH_VB(ctx
, "dlist");
1893 n
= alloc_instruction( ctx
, OPCODE_MAPGRID2
, 6 );
1902 if (ctx
->ExecuteFlag
) {
1903 (*ctx
->Exec
.MapGrid2f
)( un
, u1
, u2
, vn
, v1
, v2
);
1909 static void save_MapGrid2d( GLint un
, GLdouble u1
, GLdouble u2
,
1910 GLint vn
, GLdouble v1
, GLdouble v2
)
1912 save_MapGrid2f(un
, u1
, u2
, vn
, v1
, v2
);
1916 static void save_MatrixMode( GLenum mode
)
1918 GET_CURRENT_CONTEXT(ctx
);
1920 FLUSH_VB(ctx
, "dlist");
1921 n
= alloc_instruction( ctx
, OPCODE_MATRIX_MODE
, 1 );
1925 if (ctx
->ExecuteFlag
) {
1926 (*ctx
->Exec
.MatrixMode
)( mode
);
1931 static void save_MultMatrixf( const GLfloat
*m
)
1933 GET_CURRENT_CONTEXT(ctx
);
1935 FLUSH_VB(ctx
, "dlist");
1936 n
= alloc_instruction( ctx
, OPCODE_MULT_MATRIX
, 16 );
1939 for (i
=0;i
<16;i
++) {
1943 if (ctx
->ExecuteFlag
) {
1944 (*ctx
->Exec
.MultMatrixf
)( m
);
1949 static void save_MultMatrixd( const GLdouble
*m
)
1953 for (i
= 0; i
< 16; i
++) {
1956 save_MultMatrixf(f
);
1960 static void save_NewList( GLuint list
, GLenum mode
)
1962 GET_CURRENT_CONTEXT(ctx
);
1963 /* It's an error to call this function while building a display list */
1964 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
1971 static void save_Ortho( GLdouble left
, GLdouble right
,
1972 GLdouble bottom
, GLdouble top
,
1973 GLdouble nearval
, GLdouble farval
)
1975 GET_CURRENT_CONTEXT(ctx
);
1977 FLUSH_VB(ctx
, "dlist");
1978 n
= alloc_instruction( ctx
, OPCODE_ORTHO
, 6 );
1987 if (ctx
->ExecuteFlag
) {
1988 (*ctx
->Exec
.Ortho
)( left
, right
, bottom
, top
, nearval
, farval
);
1993 static void save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
1995 GET_CURRENT_CONTEXT(ctx
);
1997 FLUSH_VB(ctx
, "dlist");
1998 n
= alloc_instruction( ctx
, OPCODE_PIXEL_MAP
, 3 );
2002 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
2003 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
2005 if (ctx
->ExecuteFlag
) {
2006 (*ctx
->Exec
.PixelMapfv
)( map
, mapsize
, values
);
2011 static void save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2013 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2015 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2016 for (i
=0;i
<mapsize
;i
++) {
2017 fvalues
[i
] = (GLfloat
) values
[i
];
2021 for (i
=0;i
<mapsize
;i
++) {
2022 fvalues
[i
] = UINT_TO_FLOAT( values
[i
] );
2025 save_PixelMapfv(map
, mapsize
, fvalues
);
2029 static void save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2031 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2033 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2034 for (i
=0;i
<mapsize
;i
++) {
2035 fvalues
[i
] = (GLfloat
) values
[i
];
2039 for (i
=0;i
<mapsize
;i
++) {
2040 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2043 save_PixelMapfv(map
, mapsize
, fvalues
);
2047 static void save_PixelTransferf( GLenum pname
, GLfloat param
)
2049 GET_CURRENT_CONTEXT(ctx
);
2051 FLUSH_VB(ctx
, "dlist");
2052 n
= alloc_instruction( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2057 if (ctx
->ExecuteFlag
) {
2058 (*ctx
->Exec
.PixelTransferf
)( pname
, param
);
2063 static void save_PixelTransferi( GLenum pname
, GLint param
)
2065 save_PixelTransferf( pname
, (GLfloat
) param
);
2069 static void save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2071 GET_CURRENT_CONTEXT(ctx
);
2073 FLUSH_VB(ctx
, "dlist");
2074 n
= alloc_instruction( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2079 if (ctx
->ExecuteFlag
) {
2080 (*ctx
->Exec
.PixelZoom
)( xfactor
, yfactor
);
2085 static void save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2087 GET_CURRENT_CONTEXT(ctx
);
2089 FLUSH_VB(ctx
, "dlist");
2090 n
= alloc_instruction( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2097 if (ctx
->ExecuteFlag
) {
2098 (*ctx
->Exec
.PointParameterfvEXT
)( pname
, params
);
2103 static void save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2105 save_PointParameterfvEXT(pname
, ¶m
);
2109 static void save_PointSize( GLfloat size
)
2111 GET_CURRENT_CONTEXT(ctx
);
2113 FLUSH_VB(ctx
, "dlist");
2114 n
= alloc_instruction( ctx
, OPCODE_POINT_SIZE
, 1 );
2118 if (ctx
->ExecuteFlag
) {
2119 (*ctx
->Exec
.PointSize
)( size
);
2124 static void save_PolygonMode( GLenum face
, GLenum mode
)
2126 GET_CURRENT_CONTEXT(ctx
);
2128 FLUSH_VB(ctx
, "dlist");
2129 n
= alloc_instruction( ctx
, OPCODE_POLYGON_MODE
, 2 );
2134 if (ctx
->ExecuteFlag
) {
2135 (*ctx
->Exec
.PolygonMode
)( face
, mode
);
2141 * Polygon stipple must have been upacked already!
2143 static void save_PolygonStipple( const GLubyte
*pattern
)
2145 GET_CURRENT_CONTEXT(ctx
);
2147 FLUSH_VB(ctx
, "dlist");
2148 n
= alloc_instruction( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2151 n
[1].data
= MALLOC( 32 * 4 );
2152 data
= n
[1].data
; /* This needed for Acorn compiler */
2153 MEMCPY( data
, pattern
, 32 * 4 );
2155 if (ctx
->ExecuteFlag
) {
2156 (*ctx
->Exec
.PolygonStipple
)( (GLubyte
*) pattern
);
2161 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2163 GET_CURRENT_CONTEXT(ctx
);
2165 FLUSH_VB(ctx
, "dlist");
2166 n
= alloc_instruction( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2171 if (ctx
->ExecuteFlag
) {
2172 (*ctx
->Exec
.PolygonOffset
)( factor
, units
);
2177 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2179 save_PolygonOffset(factor
, DEPTH_SCALE
* bias
);
2183 static void save_PopAttrib( void )
2185 GET_CURRENT_CONTEXT(ctx
);
2186 FLUSH_VB(ctx
, "dlist");
2187 (void) alloc_instruction( ctx
, OPCODE_POP_ATTRIB
, 0 );
2188 if (ctx
->ExecuteFlag
) {
2189 (*ctx
->Exec
.PopAttrib
)();
2194 static void save_PopMatrix( void )
2196 GET_CURRENT_CONTEXT(ctx
);
2197 FLUSH_VB(ctx
, "dlist");
2198 (void) alloc_instruction( ctx
, OPCODE_POP_MATRIX
, 0 );
2199 if (ctx
->ExecuteFlag
) {
2200 (*ctx
->Exec
.PopMatrix
)();
2205 static void save_PopName( void )
2207 GET_CURRENT_CONTEXT(ctx
);
2208 FLUSH_VB(ctx
, "dlist");
2209 (void) alloc_instruction( ctx
, OPCODE_POP_NAME
, 0 );
2210 if (ctx
->ExecuteFlag
) {
2211 (*ctx
->Exec
.PopName
)();
2216 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2217 const GLclampf
*priorities
)
2219 GET_CURRENT_CONTEXT(ctx
);
2221 FLUSH_VB(ctx
, "dlist");
2223 for (i
=0;i
<num
;i
++) {
2225 n
= alloc_instruction( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2227 n
[1].ui
= textures
[i
];
2228 n
[2].f
= priorities
[i
];
2231 if (ctx
->ExecuteFlag
) {
2232 (*ctx
->Exec
.PrioritizeTextures
)( num
, textures
, priorities
);
2237 static void save_PushAttrib( GLbitfield mask
)
2239 GET_CURRENT_CONTEXT(ctx
);
2241 FLUSH_VB(ctx
, "dlist");
2242 n
= alloc_instruction( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2246 if (ctx
->ExecuteFlag
) {
2247 (*ctx
->Exec
.PushAttrib
)( mask
);
2252 static void save_PushMatrix( void )
2254 GET_CURRENT_CONTEXT(ctx
);
2255 FLUSH_VB(ctx
, "dlist");
2256 (void) alloc_instruction( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2257 if (ctx
->ExecuteFlag
) {
2258 (*ctx
->Exec
.PushMatrix
)();
2263 static void save_PushName( GLuint name
)
2265 GET_CURRENT_CONTEXT(ctx
);
2267 FLUSH_VB(ctx
, "dlist");
2268 n
= alloc_instruction( ctx
, OPCODE_PUSH_NAME
, 1 );
2272 if (ctx
->ExecuteFlag
) {
2273 (*ctx
->Exec
.PushName
)( name
);
2278 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2280 GET_CURRENT_CONTEXT(ctx
);
2282 FLUSH_VB(ctx
, "dlist");
2283 n
= alloc_instruction( ctx
, OPCODE_RASTER_POS
, 4 );
2290 if (ctx
->ExecuteFlag
) {
2291 (*ctx
->Exec
.RasterPos4f
)( x
, y
, z
, w
);
2295 static void save_RasterPos2d(GLdouble x
, GLdouble y
)
2297 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2300 static void save_RasterPos2f(GLfloat x
, GLfloat y
)
2302 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2305 static void save_RasterPos2i(GLint x
, GLint y
)
2307 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2310 static void save_RasterPos2s(GLshort x
, GLshort y
)
2312 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2315 static void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2317 save_RasterPos4f(x
, y
, z
, 1.0F
);
2320 static void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2322 save_RasterPos4f(x
, y
, z
, 1.0F
);
2325 static void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2327 save_RasterPos4f(x
, y
, z
, 1.0F
);
2330 static void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2332 save_RasterPos4f(x
, y
, z
, 1.0F
);
2335 static void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2337 save_RasterPos4f(x
, y
, z
, w
);
2340 static void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2342 save_RasterPos4f(x
, y
, z
, w
);
2345 static void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2347 save_RasterPos4f(x
, y
, z
, w
);
2350 static void save_RasterPos2dv(const GLdouble
*v
)
2352 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2355 static void save_RasterPos2fv(const GLfloat
*v
)
2357 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2360 static void save_RasterPos2iv(const GLint
*v
)
2362 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2365 static void save_RasterPos2sv(const GLshort
*v
)
2367 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2370 static void save_RasterPos3dv(const GLdouble
*v
)
2372 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2375 static void save_RasterPos3fv(const GLfloat
*v
)
2377 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2380 static void save_RasterPos3iv(const GLint
*v
)
2382 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2385 static void save_RasterPos3sv(const GLshort
*v
)
2387 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2390 static void save_RasterPos4dv(const GLdouble
*v
)
2392 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2395 static void save_RasterPos4fv(const GLfloat
*v
)
2397 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2400 static void save_RasterPos4iv(const GLint
*v
)
2402 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2405 static void save_RasterPos4sv(const GLshort
*v
)
2407 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2411 static void save_PassThrough( GLfloat token
)
2413 GET_CURRENT_CONTEXT(ctx
);
2415 FLUSH_VB(ctx
, "dlist");
2416 n
= alloc_instruction( ctx
, OPCODE_PASSTHROUGH
, 1 );
2420 if (ctx
->ExecuteFlag
) {
2421 (*ctx
->Exec
.PassThrough
)( token
);
2426 static void save_ReadBuffer( GLenum mode
)
2428 GET_CURRENT_CONTEXT(ctx
);
2430 FLUSH_VB(ctx
, "dlist");
2431 n
= alloc_instruction( ctx
, OPCODE_READ_BUFFER
, 1 );
2435 if (ctx
->ExecuteFlag
) {
2436 (*ctx
->Exec
.ReadBuffer
)( mode
);
2441 static void save_Rectf( GLfloat x1
, GLfloat y1
, GLfloat x2
, GLfloat y2
)
2443 GET_CURRENT_CONTEXT(ctx
);
2445 FLUSH_VB(ctx
, "dlist");
2446 n
= alloc_instruction( ctx
, OPCODE_RECTF
, 4 );
2453 if (ctx
->ExecuteFlag
) {
2454 (*ctx
->Exec
.Rectf
)( x1
, y1
, x2
, y2
);
2458 static void save_Rectd(GLdouble x1
, GLdouble y1
, GLdouble x2
, GLdouble y2
)
2460 save_Rectf(x1
, y1
, x2
, y2
);
2463 static void save_Rectdv(const GLdouble
*v1
, const GLdouble
*v2
)
2465 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2468 static void save_Rectfv( const GLfloat
*v1
, const GLfloat
*v2
)
2470 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2473 static void save_Recti(GLint x1
, GLint y1
, GLint x2
, GLint y2
)
2475 save_Rectf(x1
, y1
, x2
, y2
);
2478 static void save_Rectiv(const GLint
*v1
, const GLint
*v2
)
2480 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2483 static void save_Rects(GLshort x1
, GLshort y1
, GLshort x2
, GLshort y2
)
2485 save_Rectf(x1
, y1
, x2
, y2
);
2488 static void save_Rectsv(const GLshort
*v1
, const GLshort
*v2
)
2490 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2494 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2497 gl_rotation_matrix( angle
, x
, y
, z
, m
);
2498 save_MultMatrixf( m
); /* save and maybe execute */
2502 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2504 save_Rotatef(angle
, x
, y
, z
);
2508 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2510 GET_CURRENT_CONTEXT(ctx
);
2512 FLUSH_VB(ctx
, "dlist");
2513 n
= alloc_instruction( ctx
, OPCODE_SCALE
, 3 );
2519 if (ctx
->ExecuteFlag
) {
2520 (*ctx
->Exec
.Scalef
)( x
, y
, z
);
2525 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
2527 save_Scalef(x
, y
, z
);
2531 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
2533 GET_CURRENT_CONTEXT(ctx
);
2535 FLUSH_VB(ctx
, "dlist");
2536 n
= alloc_instruction( ctx
, OPCODE_SCISSOR
, 4 );
2543 if (ctx
->ExecuteFlag
) {
2544 (*ctx
->Exec
.Scissor
)( x
, y
, width
, height
);
2549 static void save_ShadeModel( GLenum mode
)
2551 GET_CURRENT_CONTEXT(ctx
);
2553 FLUSH_VB(ctx
, "dlist");
2554 n
= alloc_instruction( ctx
, OPCODE_SHADE_MODEL
, 1 );
2558 if (ctx
->ExecuteFlag
) {
2559 (*ctx
->Exec
.ShadeModel
)( mode
);
2564 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
2566 GET_CURRENT_CONTEXT(ctx
);
2568 FLUSH_VB(ctx
, "dlist");
2569 n
= alloc_instruction( ctx
, OPCODE_STENCIL_FUNC
, 3 );
2575 if (ctx
->ExecuteFlag
) {
2576 (*ctx
->Exec
.StencilFunc
)( func
, ref
, mask
);
2581 static void save_StencilMask( GLuint mask
)
2583 GET_CURRENT_CONTEXT(ctx
);
2585 FLUSH_VB(ctx
, "dlist");
2586 n
= alloc_instruction( ctx
, OPCODE_STENCIL_MASK
, 1 );
2590 if (ctx
->ExecuteFlag
) {
2591 (*ctx
->Exec
.StencilMask
)( mask
);
2596 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
2598 GET_CURRENT_CONTEXT(ctx
);
2600 FLUSH_VB(ctx
, "dlist");
2601 n
= alloc_instruction( ctx
, OPCODE_STENCIL_OP
, 3 );
2607 if (ctx
->ExecuteFlag
) {
2608 (*ctx
->Exec
.StencilOp
)( fail
, zfail
, zpass
);
2613 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
2615 GET_CURRENT_CONTEXT(ctx
);
2617 FLUSH_VB(ctx
, "dlist");
2618 n
= alloc_instruction( ctx
, OPCODE_TEXENV
, 6 );
2627 if (ctx
->ExecuteFlag
) {
2628 (*ctx
->Exec
.TexEnvfv
)( target
, pname
, params
);
2633 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
2635 save_TexEnvfv( target
, pname
, ¶m
);
2639 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
2642 p
[0] = (GLfloat
) param
;
2643 p
[1] = p
[2] = p
[3] = 0.0;
2644 save_TexEnvfv( target
, pname
, p
);
2648 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
2651 p
[0] = INT_TO_FLOAT( param
[0] );
2652 p
[1] = INT_TO_FLOAT( param
[1] );
2653 p
[2] = INT_TO_FLOAT( param
[2] );
2654 p
[3] = INT_TO_FLOAT( param
[3] );
2655 save_TexEnvfv( target
, pname
, p
);
2659 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
2661 GET_CURRENT_CONTEXT(ctx
);
2663 FLUSH_VB(ctx
, "dlist");
2664 n
= alloc_instruction( ctx
, OPCODE_TEXGEN
, 6 );
2673 if (ctx
->ExecuteFlag
) {
2674 (*ctx
->Exec
.TexGenfv
)( coord
, pname
, params
);
2679 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
2686 save_TexGenfv(coord
, pname
, p
);
2690 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
2692 GLfloat p
= (GLfloat
) param
;
2693 save_TexGenfv( coord
, pname
, &p
);
2697 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
2704 save_TexGenfv( coord
, pname
, p
);
2708 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
2710 save_TexGenfv(coord
, pname
, ¶m
);
2714 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
2716 save_TexGeniv( coord
, pname
, ¶m
);
2720 static void save_TexParameterfv( GLenum target
,
2721 GLenum pname
, const GLfloat
*params
)
2723 GET_CURRENT_CONTEXT(ctx
);
2725 FLUSH_VB(ctx
, "dlist");
2726 n
= alloc_instruction( ctx
, OPCODE_TEXPARAMETER
, 6 );
2735 if (ctx
->ExecuteFlag
) {
2736 (*ctx
->Exec
.TexParameterfv
)( target
, pname
, params
);
2741 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
2743 save_TexParameterfv(target
, pname
, ¶m
);
2747 static void save_TexParameteri( GLenum target
, GLenum pname
, const GLint param
)
2750 fparam
[0] = (GLfloat
) param
;
2751 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
2752 save_TexParameterfv(target
, pname
, fparam
);
2756 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
2759 fparam
[0] = (GLfloat
) params
[0];
2760 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
2761 save_TexParameterfv(target
, pname
, fparam
);
2765 static void save_TexImage1D( GLenum target
,
2766 GLint level
, GLint components
,
2767 GLsizei width
, GLint border
,
2768 GLenum format
, GLenum type
,
2769 const GLvoid
*pixels
)
2771 GET_CURRENT_CONTEXT(ctx
);
2772 if (target
== GL_PROXY_TEXTURE_1D
) {
2773 /* don't compile, execute immediately */
2774 (*ctx
->Exec
.TexImage1D
)( target
, level
, components
, width
,
2775 border
, format
, type
, pixels
);
2778 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
2779 pixels
, &ctx
->Unpack
);
2781 FLUSH_VB(ctx
, "dlist");
2782 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
2786 n
[3].i
= components
;
2787 n
[4].i
= (GLint
) width
;
2796 if (ctx
->ExecuteFlag
) {
2797 (*ctx
->Exec
.TexImage1D
)( target
, level
, components
, width
,
2798 border
, format
, type
, pixels
);
2804 static void save_TexImage2D( GLenum target
,
2805 GLint level
, GLint components
,
2806 GLsizei width
, GLsizei height
, GLint border
,
2807 GLenum format
, GLenum type
,
2808 const GLvoid
*pixels
)
2810 GET_CURRENT_CONTEXT(ctx
);
2811 if (target
== GL_PROXY_TEXTURE_2D
) {
2812 /* don't compile, execute immediately */
2813 (*ctx
->Exec
.TexImage2D
)( target
, level
, components
, width
,
2814 height
, border
, format
, type
, pixels
);
2817 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
2818 pixels
, &ctx
->Unpack
);
2820 FLUSH_VB(ctx
, "dlist");
2821 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
2825 n
[3].i
= components
;
2826 n
[4].i
= (GLint
) width
;
2827 n
[5].i
= (GLint
) height
;
2836 if (ctx
->ExecuteFlag
) {
2837 (*ctx
->Exec
.TexImage2D
)( target
, level
, components
, width
,
2838 height
, border
, format
, type
, pixels
);
2844 static void save_TexImage3D( GLenum target
,
2845 GLint level
, GLint components
,
2846 GLsizei width
, GLsizei height
, GLsizei depth
,
2848 GLenum format
, GLenum type
,
2849 const GLvoid
*pixels
)
2851 GET_CURRENT_CONTEXT(ctx
);
2852 if (target
== GL_PROXY_TEXTURE_3D
) {
2853 /* don't compile, execute immediately */
2854 (*ctx
->Exec
.TexImage3D
)( target
, level
, components
, width
,
2855 height
, depth
, border
, format
, type
, pixels
);
2859 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
2860 pixels
, &ctx
->Unpack
);
2861 FLUSH_VB(ctx
, "dlist");
2862 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
2866 n
[3].i
= components
;
2867 n
[4].i
= (GLint
) width
;
2868 n
[5].i
= (GLint
) height
;
2869 n
[6].i
= (GLint
) depth
;
2878 if (ctx
->ExecuteFlag
) {
2879 (*ctx
->Exec
.TexImage3D
)( target
, level
, components
, width
,
2880 height
, depth
, border
, format
, type
, pixels
);
2886 static void save_TexImage3DEXT( GLenum target
,
2887 GLint level
, GLenum components
,
2888 GLsizei width
, GLsizei height
, GLsizei depth
,
2889 GLint border
, GLenum format
, GLenum type
,
2890 const GLvoid
*pixels
)
2892 save_TexImage3D(target
, level
, (GLint
) components
, width
, height
,
2893 depth
, border
, format
, type
, pixels
);
2897 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
2898 GLsizei width
, GLenum format
, GLenum type
,
2899 const GLvoid
*pixels
)
2901 GET_CURRENT_CONTEXT(ctx
);
2903 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
2904 pixels
, &ctx
->Unpack
);
2905 FLUSH_VB(ctx
, "dlist");
2906 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
2911 n
[4].i
= (GLint
) width
;
2919 if (ctx
->ExecuteFlag
) {
2920 (*ctx
->Exec
.TexSubImage1D
)( target
, level
, xoffset
, width
,
2921 format
, type
, pixels
);
2926 static void save_TexSubImage2D( GLenum target
, GLint level
,
2927 GLint xoffset
, GLint yoffset
,
2928 GLsizei width
, GLsizei height
,
2929 GLenum format
, GLenum type
,
2930 const GLvoid
*pixels
)
2932 GET_CURRENT_CONTEXT(ctx
);
2934 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
2935 pixels
, &ctx
->Unpack
);
2936 FLUSH_VB(ctx
, "dlist");
2937 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
2943 n
[5].i
= (GLint
) width
;
2944 n
[6].i
= (GLint
) height
;
2952 if (ctx
->ExecuteFlag
) {
2953 (*ctx
->Exec
.TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
2954 width
, height
, format
, type
, pixels
);
2959 static void save_TexSubImage3D( GLenum target
, GLint level
,
2960 GLint xoffset
, GLint yoffset
,GLint zoffset
,
2961 GLsizei width
, GLsizei height
, GLsizei depth
,
2962 GLenum format
, GLenum type
,
2963 const GLvoid
*pixels
)
2965 GET_CURRENT_CONTEXT(ctx
);
2967 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
2968 pixels
, &ctx
->Unpack
);
2969 FLUSH_VB(ctx
, "dlist");
2970 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
2977 n
[6].i
= (GLint
) width
;
2978 n
[7].i
= (GLint
) height
;
2979 n
[8].i
= (GLint
) depth
;
2987 if (ctx
->ExecuteFlag
) {
2988 (*ctx
->Exec
.TexSubImage3D
)( target
, level
,
2989 xoffset
, yoffset
, zoffset
,
2990 width
, height
, depth
, format
, type
, pixels
);
2995 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
2997 GET_CURRENT_CONTEXT(ctx
);
2999 FLUSH_VB(ctx
, "dlist");
3000 n
= alloc_instruction( ctx
, OPCODE_TRANSLATE
, 3 );
3006 if (ctx
->ExecuteFlag
) {
3007 (*ctx
->Exec
.Translatef
)( x
, y
, z
);
3012 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3014 save_Translatef(x
, y
, z
);
3019 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3021 GET_CURRENT_CONTEXT(ctx
);
3023 FLUSH_VB(ctx
, "dlist");
3024 n
= alloc_instruction( ctx
, OPCODE_VIEWPORT
, 4 );
3028 n
[3].i
= (GLint
) width
;
3029 n
[4].i
= (GLint
) height
;
3031 if (ctx
->ExecuteFlag
) {
3032 (*ctx
->Exec
.Viewport
)( x
, y
, width
, height
);
3037 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3039 GET_CURRENT_CONTEXT(ctx
);
3041 FLUSH_VB(ctx
, "dlist");
3042 n
= alloc_instruction( ctx
, OPCODE_WINDOW_POS
, 4 );
3049 if (ctx
->ExecuteFlag
) {
3050 (*ctx
->Exec
.WindowPos4fMESA
)( x
, y
, z
, w
);
3054 static void save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3056 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3059 static void save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3061 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3064 static void save_WindowPos2iMESA(GLint x
, GLint y
)
3066 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3069 static void save_WindowPos2sMESA(GLshort x
, GLshort y
)
3071 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3074 static void save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3076 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3079 static void save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3081 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3084 static void save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3086 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3089 static void save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3091 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3094 static void save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3096 save_WindowPos4fMESA(x
, y
, z
, w
);
3099 static void save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3101 save_WindowPos4fMESA(x
, y
, z
, w
);
3104 static void save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3106 save_WindowPos4fMESA(x
, y
, z
, w
);
3109 static void save_WindowPos2dvMESA(const GLdouble
*v
)
3111 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3114 static void save_WindowPos2fvMESA(const GLfloat
*v
)
3116 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3119 static void save_WindowPos2ivMESA(const GLint
*v
)
3121 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3124 static void save_WindowPos2svMESA(const GLshort
*v
)
3126 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3129 static void save_WindowPos3dvMESA(const GLdouble
*v
)
3131 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3134 static void save_WindowPos3fvMESA(const GLfloat
*v
)
3136 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3139 static void save_WindowPos3ivMESA(const GLint
*v
)
3141 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3144 static void save_WindowPos3svMESA(const GLshort
*v
)
3146 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3149 static void save_WindowPos4dvMESA(const GLdouble
*v
)
3151 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3154 static void save_WindowPos4fvMESA(const GLfloat
*v
)
3156 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3159 static void save_WindowPos4ivMESA(const GLint
*v
)
3161 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3164 static void save_WindowPos4svMESA(const GLshort
*v
)
3166 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3171 /* GL_ARB_multitexture */
3172 static void save_ActiveTextureARB( GLenum target
)
3174 GET_CURRENT_CONTEXT(ctx
);
3176 FLUSH_VB(ctx
, "dlist");
3177 n
= alloc_instruction( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3181 if (ctx
->ExecuteFlag
) {
3182 (*ctx
->Exec
.ActiveTextureARB
)( target
);
3187 /* GL_ARB_multitexture */
3188 static void save_ClientActiveTextureARB( GLenum target
)
3190 GET_CURRENT_CONTEXT(ctx
);
3192 FLUSH_VB(ctx
, "dlist");
3193 n
= alloc_instruction( ctx
, OPCODE_CLIENT_ACTIVE_TEXTURE
, 1 );
3197 if (ctx
->ExecuteFlag
) {
3198 (*ctx
->Exec
.ClientActiveTextureARB
)( target
);
3204 static void save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3207 gl_matrix_transposed(tm
, m
);
3208 save_LoadMatrixd(tm
);
3212 static void save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3215 gl_matrix_transposef(tm
, m
);
3216 save_LoadMatrixf(tm
);
3220 static void save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3223 gl_matrix_transposed(tm
, m
);
3224 save_MultMatrixd(tm
);
3228 static void save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3231 gl_matrix_transposef(tm
, m
);
3232 save_MultMatrixf(tm
);
3237 void gl_compile_cassette( GLcontext
*ctx
)
3239 Node
*n
= alloc_instruction( ctx
, OPCODE_VERTEX_CASSETTE
, 8 );
3240 struct immediate
*im
= ctx
->input
;
3246 /* Do some easy optimizations of the cassette.
3249 if (0 && im
->v
.Obj
.size
< 4 && im
->Count
> 15) {
3250 im
->Bounds
= (GLfloat (*)[3]) MALLOC(6 * sizeof(GLfloat
));
3251 (gl_calc_bound_tab
[im
->v
.Obj
.size
])( im
->Bounds
, &im
->v
.Obj
);
3255 n
[1].data
= (void *)im
;
3256 n
[2].ui
= im
->Start
;
3257 n
[3].ui
= im
->Count
;
3258 n
[4].ui
= im
->BeginState
;
3259 n
[5].ui
= im
->OrFlag
;
3260 n
[6].ui
= im
->AndFlag
;
3261 n
[7].ui
= im
->LastData
;
3262 n
[8].ui
= im
->LastPrimitive
;
3264 if (im
->Count
> VB_MAX
- 4) {
3266 struct immediate
*new_im
= gl_immediate_alloc(ctx
);
3267 if (!new_im
) return;
3268 SET_IMMEDIATE( ctx
, new_im
);
3269 gl_reset_input( ctx
);
3273 im
->Start
= im
->Count
; /* don't clear anything in reset_input */
3276 im
->Primitive
[im
->Start
] = ctx
->Current
.Primitive
;
3277 im
->LastPrimitive
= im
->Start
;
3278 im
->BeginState
= VERT_BEGIN_0
;
3283 fprintf(stderr
, "in compile_cassette, BeginState is %x\n",
3288 /* KW: Compile commands
3290 * Will appear in the list before the vertex buffer containing the
3291 * command that provoked the error. I don't see this as a problem.
3293 void gl_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
3296 n
= alloc_instruction( ctx
, OPCODE_ERROR
, 2 );
3299 n
[2].data
= (void *) s
;
3301 /* execute already done */
3306 islist(GLcontext
*ctx
, GLuint list
)
3308 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
3318 /**********************************************************************/
3319 /* Display list execution */
3320 /**********************************************************************/
3324 * Execute a display list. Note that the ListBase offset must have already
3325 * been added before calling this function. I.e. the list argument is
3326 * the absolute list number, not relative to ListBase.
3327 * Input: list - display list number
3329 static void execute_list( GLcontext
*ctx
, GLuint list
)
3335 if (!islist(ctx
,list
))
3338 /* mesa_print_display_list( list ); */
3342 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
3346 opcode
= n
[0].opcode
;
3350 gl_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
3352 case OPCODE_VERTEX_CASSETTE
: {
3353 struct immediate
*IM
;
3356 gl_update_state(ctx
);
3357 if (ctx
->CompileCVAFlag
) {
3358 ctx
->CompileCVAFlag
= 0;
3359 ctx
->CVA
.elt
.pipeline_valid
= 0;
3361 if (!ctx
->CVA
.elt
.pipeline_valid
)
3362 gl_build_immediate_pipeline( ctx
);
3365 IM
= (struct immediate
*) n
[1].data
;
3366 IM
->Start
= n
[2].ui
;
3367 IM
->Count
= n
[3].ui
;
3368 IM
->BeginState
= n
[4].ui
;
3369 IM
->OrFlag
= n
[5].ui
;
3370 IM
->AndFlag
= n
[6].ui
;
3371 IM
->LastData
= n
[7].ui
;
3372 IM
->LastPrimitive
= n
[8].ui
;
3374 if ((MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
) &&
3375 (MESA_VERBOSE
& VERBOSE_IMMEDIATE
))
3376 gl_print_cassette( (struct immediate
*) n
[1].data
);
3379 fprintf(stderr
, "Run cassette %d, rows %d..%d, beginstate %x\n",
3381 IM
->Start
, IM
->Count
, IM
->BeginState
);
3383 gl_fixup_cassette( ctx
, (struct immediate
*) n
[1].data
);
3384 gl_execute_cassette( ctx
, (struct immediate
*) n
[1].data
);
3388 (*ctx
->Exec
.Accum
)( n
[1].e
, n
[2].f
);
3390 case OPCODE_ALPHA_FUNC
:
3391 (*ctx
->Exec
.AlphaFunc
)( n
[1].e
, n
[2].f
);
3393 case OPCODE_BIND_TEXTURE
:
3394 (*ctx
->Exec
.BindTexture
)( n
[1].e
, n
[2].ui
);
3398 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3399 ctx
->Unpack
= _mesa_native_packing
;
3400 (*ctx
->Exec
.Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
3401 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, n
[7].data
);
3402 ctx
->Unpack
= save
; /* restore */
3405 case OPCODE_BLEND_COLOR
:
3406 (*ctx
->Exec
.BlendColorEXT
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3408 case OPCODE_BLEND_EQUATION
:
3409 (*ctx
->Exec
.BlendEquationEXT
)( n
[1].e
);
3411 case OPCODE_BLEND_FUNC
:
3412 (*ctx
->Exec
.BlendFunc
)( n
[1].e
, n
[2].e
);
3414 case OPCODE_BLEND_FUNC_SEPARATE
:
3415 (*ctx
->Exec
.BlendFuncSeparateINGR
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
3417 case OPCODE_CALL_LIST
:
3418 /* Generated by glCallList(), don't add ListBase */
3419 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
3420 execute_list( ctx
, n
[1].ui
);
3423 case OPCODE_CALL_LIST_OFFSET
:
3424 /* Generated by glCallLists() so we must add ListBase */
3425 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
3426 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
3430 (*ctx
->Exec
.Clear
)( n
[1].bf
);
3432 case OPCODE_CLEAR_COLOR
:
3433 (*ctx
->Exec
.ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3435 case OPCODE_CLEAR_ACCUM
:
3436 (*ctx
->Exec
.ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3438 case OPCODE_CLEAR_DEPTH
:
3439 (*ctx
->Exec
.ClearDepth
)( (GLclampd
) n
[1].f
);
3441 case OPCODE_CLEAR_INDEX
:
3442 (*ctx
->Exec
.ClearIndex
)( n
[1].ui
);
3444 case OPCODE_CLEAR_STENCIL
:
3445 (*ctx
->Exec
.ClearStencil
)( n
[1].i
);
3447 case OPCODE_CLIP_PLANE
:
3454 (*ctx
->Exec
.ClipPlane
)( n
[1].e
, eq
);
3457 case OPCODE_COLOR_MASK
:
3458 (*ctx
->Exec
.ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
3460 case OPCODE_COLOR_MATERIAL
:
3461 (*ctx
->Exec
.ColorMaterial
)( n
[1].e
, n
[2].e
);
3463 case OPCODE_COLOR_TABLE
:
3465 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3466 ctx
->Unpack
= _mesa_native_packing
;
3467 (*ctx
->Exec
.ColorTableEXT
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
3468 n
[5].e
, n
[6].data
);
3469 ctx
->Unpack
= save
; /* restore */
3472 case OPCODE_COLOR_SUB_TABLE
:
3474 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3475 ctx
->Unpack
= _mesa_native_packing
;
3476 (*ctx
->Exec
.ColorSubTableEXT
)( n
[1].e
, n
[2].i
, n
[3].i
,
3477 n
[4].e
, n
[5].e
, n
[6].data
);
3478 ctx
->Unpack
= save
; /* restore */
3481 case OPCODE_COPY_PIXELS
:
3482 (*ctx
->Exec
.CopyPixels
)( n
[1].i
, n
[2].i
,
3483 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
3485 case OPCODE_COPY_TEX_IMAGE1D
:
3486 (*ctx
->Exec
.CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
3487 n
[5].i
, n
[6].i
, n
[7].i
);
3489 case OPCODE_COPY_TEX_IMAGE2D
:
3490 (*ctx
->Exec
.CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
3491 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
3493 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
3494 (*ctx
->Exec
.CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3495 n
[4].i
, n
[5].i
, n
[6].i
);
3497 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
3498 (*ctx
->Exec
.CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3499 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
3501 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
3502 (*ctx
->Exec
.CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3503 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
3505 case OPCODE_CULL_FACE
:
3506 (*ctx
->Exec
.CullFace
)( n
[1].e
);
3508 case OPCODE_DEPTH_FUNC
:
3509 (*ctx
->Exec
.DepthFunc
)( n
[1].e
);
3511 case OPCODE_DEPTH_MASK
:
3512 (*ctx
->Exec
.DepthMask
)( n
[1].b
);
3514 case OPCODE_DEPTH_RANGE
:
3515 (*ctx
->Exec
.DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
3517 case OPCODE_DISABLE
:
3518 (*ctx
->Exec
.Disable
)( n
[1].e
);
3520 case OPCODE_DRAW_BUFFER
:
3521 (*ctx
->Exec
.DrawBuffer
)( n
[1].e
);
3523 case OPCODE_DRAW_PIXELS
:
3525 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3526 ctx
->Unpack
= _mesa_native_packing
;
3527 (*ctx
->Exec
.DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
3529 ctx
->Unpack
= save
; /* restore */
3533 (*ctx
->Exec
.Enable
)( n
[1].e
);
3535 case OPCODE_EVALMESH1
:
3536 (*ctx
->Exec
.EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
3538 case OPCODE_EVALMESH2
:
3539 (*ctx
->Exec
.EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
3548 (*ctx
->Exec
.Fogfv
)( n
[1].e
, p
);
3551 case OPCODE_FRONT_FACE
:
3552 (*ctx
->Exec
.FrontFace
)( n
[1].e
);
3554 case OPCODE_FRUSTUM
:
3555 (*ctx
->Exec
.Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
3558 (*ctx
->Exec
.Hint
)( n
[1].e
, n
[2].e
);
3560 case OPCODE_HINT_PGI
:
3561 (*ctx
->Exec
.HintPGI
)( n
[1].e
, n
[2].i
);
3563 case OPCODE_INDEX_MASK
:
3564 (*ctx
->Exec
.IndexMask
)( n
[1].ui
);
3566 case OPCODE_INIT_NAMES
:
3567 (*ctx
->Exec
.InitNames
)();
3576 (*ctx
->Exec
.Lightfv
)( n
[1].e
, n
[2].e
, p
);
3579 case OPCODE_LIGHT_MODEL
:
3586 (*ctx
->Exec
.LightModelfv
)( n
[1].e
, p
);
3589 case OPCODE_LINE_STIPPLE
:
3590 (*ctx
->Exec
.LineStipple
)( n
[1].i
, n
[2].us
);
3592 case OPCODE_LINE_WIDTH
:
3593 (*ctx
->Exec
.LineWidth
)( n
[1].f
);
3595 case OPCODE_LIST_BASE
:
3596 (*ctx
->Exec
.ListBase
)( n
[1].ui
);
3598 case OPCODE_LOAD_IDENTITY
:
3599 (*ctx
->Exec
.LoadIdentity
)();
3601 case OPCODE_LOAD_MATRIX
:
3602 if (sizeof(Node
)==sizeof(GLfloat
)) {
3603 (*ctx
->Exec
.LoadMatrixf
)( &n
[1].f
);
3608 for (i
=0;i
<16;i
++) {
3611 (*ctx
->Exec
.LoadMatrixf
)( m
);
3614 case OPCODE_LOAD_NAME
:
3615 (*ctx
->Exec
.LoadName
)( n
[1].ui
);
3617 case OPCODE_LOGIC_OP
:
3618 (*ctx
->Exec
.LogicOp
)( n
[1].e
);
3622 GLenum target
= n
[1].e
;
3623 GLint ustride
= _mesa_evaluator_components(target
);
3624 GLint uorder
= n
[5].i
;
3625 GLfloat u1
= n
[2].f
;
3626 GLfloat u2
= n
[3].f
;
3627 (*ctx
->Exec
.Map1f
)( target
, u1
, u2
, ustride
, uorder
,
3628 (GLfloat
*) n
[6].data
);
3633 GLenum target
= n
[1].e
;
3634 GLfloat u1
= n
[2].f
;
3635 GLfloat u2
= n
[3].f
;
3636 GLfloat v1
= n
[4].f
;
3637 GLfloat v2
= n
[5].f
;
3638 GLint ustride
= n
[6].i
;
3639 GLint vstride
= n
[7].i
;
3640 GLint uorder
= n
[8].i
;
3641 GLint vorder
= n
[9].i
;
3642 (*ctx
->Exec
.Map2f
)( target
, u1
, u2
, ustride
, uorder
,
3643 v1
, v2
, vstride
, vorder
,
3644 (GLfloat
*) n
[10].data
);
3647 case OPCODE_MAPGRID1
:
3648 (*ctx
->Exec
.MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
3650 case OPCODE_MAPGRID2
:
3651 (*ctx
->Exec
.MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
3653 case OPCODE_MATRIX_MODE
:
3654 (*ctx
->Exec
.MatrixMode
)( n
[1].e
);
3656 case OPCODE_MULT_MATRIX
:
3657 if (sizeof(Node
)==sizeof(GLfloat
)) {
3658 (*ctx
->Exec
.MultMatrixf
)( &n
[1].f
);
3663 for (i
=0;i
<16;i
++) {
3666 (*ctx
->Exec
.MultMatrixf
)( m
);
3670 (*ctx
->Exec
.Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
3672 case OPCODE_PASSTHROUGH
:
3673 (*ctx
->Exec
.PassThrough
)( n
[1].f
);
3675 case OPCODE_PIXEL_MAP
:
3676 (*ctx
->Exec
.PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
3678 case OPCODE_PIXEL_TRANSFER
:
3679 (*ctx
->Exec
.PixelTransferf
)( n
[1].e
, n
[2].f
);
3681 case OPCODE_PIXEL_ZOOM
:
3682 (*ctx
->Exec
.PixelZoom
)( n
[1].f
, n
[2].f
);
3684 case OPCODE_POINT_SIZE
:
3685 (*ctx
->Exec
.PointSize
)( n
[1].f
);
3687 case OPCODE_POINT_PARAMETERS
:
3693 (*ctx
->Exec
.PointParameterfvEXT
)( n
[1].e
, params
);
3696 case OPCODE_POLYGON_MODE
:
3697 (*ctx
->Exec
.PolygonMode
)( n
[1].e
, n
[2].e
);
3699 case OPCODE_POLYGON_STIPPLE
:
3700 (*ctx
->Exec
.PolygonStipple
)( (GLubyte
*) n
[1].data
);
3702 case OPCODE_POLYGON_OFFSET
:
3703 (*ctx
->Exec
.PolygonOffset
)( n
[1].f
, n
[2].f
);
3705 case OPCODE_POP_ATTRIB
:
3706 (*ctx
->Exec
.PopAttrib
)();
3708 case OPCODE_POP_MATRIX
:
3709 (*ctx
->Exec
.PopMatrix
)();
3711 case OPCODE_POP_NAME
:
3712 (*ctx
->Exec
.PopName
)();
3714 case OPCODE_PRIORITIZE_TEXTURE
:
3715 (*ctx
->Exec
.PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
3717 case OPCODE_PUSH_ATTRIB
:
3718 (*ctx
->Exec
.PushAttrib
)( n
[1].bf
);
3720 case OPCODE_PUSH_MATRIX
:
3721 (*ctx
->Exec
.PushMatrix
)();
3723 case OPCODE_PUSH_NAME
:
3724 (*ctx
->Exec
.PushName
)( n
[1].ui
);
3726 case OPCODE_RASTER_POS
:
3727 (*ctx
->Exec
.RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3729 case OPCODE_READ_BUFFER
:
3730 (*ctx
->Exec
.ReadBuffer
)( n
[1].e
);
3733 (*ctx
->Exec
.Rectf
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3736 (*ctx
->Exec
.Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
3738 case OPCODE_SCISSOR
:
3739 (*ctx
->Exec
.Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
3741 case OPCODE_SHADE_MODEL
:
3742 (*ctx
->Exec
.ShadeModel
)( n
[1].e
);
3744 case OPCODE_STENCIL_FUNC
:
3745 (*ctx
->Exec
.StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
3747 case OPCODE_STENCIL_MASK
:
3748 (*ctx
->Exec
.StencilMask
)( n
[1].ui
);
3750 case OPCODE_STENCIL_OP
:
3751 (*ctx
->Exec
.StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
3760 (*ctx
->Exec
.TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
3770 (*ctx
->Exec
.TexGenfv
)( n
[1].e
, n
[2].e
, params
);
3773 case OPCODE_TEXPARAMETER
:
3780 (*ctx
->Exec
.TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
3783 case OPCODE_TEX_IMAGE1D
:
3785 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3786 ctx
->Unpack
= _mesa_native_packing
;
3787 (*ctx
->Exec
.TexImage1D
)(
3788 n
[1].e
, /* target */
3790 n
[3].i
, /* components */
3792 n
[5].e
, /* border */
3793 n
[6].e
, /* format */
3796 ctx
->Unpack
= save
; /* restore */
3799 case OPCODE_TEX_IMAGE2D
:
3801 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3802 ctx
->Unpack
= _mesa_native_packing
;
3803 (*ctx
->Exec
.TexImage2D
)(
3804 n
[1].e
, /* target */
3806 n
[3].i
, /* components */
3808 n
[5].i
, /* height */
3809 n
[6].e
, /* border */
3810 n
[7].e
, /* format */
3813 ctx
->Unpack
= save
; /* restore */
3816 case OPCODE_TEX_IMAGE3D
:
3818 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3819 ctx
->Unpack
= _mesa_native_packing
;
3820 (*ctx
->Exec
.TexImage3D
)(
3821 n
[1].e
, /* target */
3823 n
[3].i
, /* components */
3825 n
[5].i
, /* height */
3827 n
[7].e
, /* border */
3828 n
[8].e
, /* format */
3831 ctx
->Unpack
= save
; /* restore */
3834 case OPCODE_TEX_SUB_IMAGE1D
:
3836 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3837 ctx
->Unpack
= _mesa_native_packing
;
3838 (*ctx
->Exec
.TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3840 n
[6].e
, n
[7].data
);
3841 ctx
->Unpack
= save
; /* restore */
3844 case OPCODE_TEX_SUB_IMAGE2D
:
3846 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3847 ctx
->Unpack
= _mesa_native_packing
;
3848 (*ctx
->Exec
.TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3850 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
3851 ctx
->Unpack
= save
; /* restore */
3854 case OPCODE_TEX_SUB_IMAGE3D
:
3856 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3857 ctx
->Unpack
= _mesa_native_packing
;
3858 (*ctx
->Exec
.TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3859 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
3860 n
[8].i
, n
[9].e
, n
[10].e
,
3862 ctx
->Unpack
= save
; /* restore */
3865 case OPCODE_TRANSLATE
:
3866 (*ctx
->Exec
.Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
3868 case OPCODE_VIEWPORT
:
3869 (*ctx
->Exec
.Viewport
)(n
[1].i
, n
[2].i
,
3870 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
3872 case OPCODE_WINDOW_POS
:
3873 (*ctx
->Exec
.WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3875 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
3876 (*ctx
->Exec
.ActiveTextureARB
)( n
[1].e
);
3878 case OPCODE_CLIENT_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
3879 (*ctx
->Exec
.ClientActiveTextureARB
)( n
[1].e
);
3881 case OPCODE_CONTINUE
:
3882 n
= (Node
*) n
[1].next
;
3884 case OPCODE_END_OF_LIST
:
3890 sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
3891 gl_problem( ctx
, msg
);
3896 /* increment n to point to next compiled command */
3897 if (opcode
!=OPCODE_CONTINUE
) {
3898 n
+= InstSize
[opcode
];
3909 /**********************************************************************/
3911 /**********************************************************************/
3917 * Test if a display list number is valid.
3920 _mesa_IsList( GLuint list
)
3922 GET_CURRENT_CONTEXT(ctx
);
3923 return islist(ctx
, list
);
3928 * Delete a sequence of consecutive display lists.
3931 _mesa_DeleteLists( GLuint list
, GLsizei range
)
3933 GET_CURRENT_CONTEXT(ctx
);
3936 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glDeleteLists");
3938 gl_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
3941 for (i
=list
;i
<list
+range
;i
++) {
3942 gl_destroy_list( ctx
, i
);
3949 * Return a display list number, n, such that lists n through n+range-1
3953 _mesa_GenLists(GLsizei range
)
3955 GET_CURRENT_CONTEXT(ctx
);
3958 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx
, "glGenLists", 0);
3960 gl_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
3967 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
3969 /* reserve the list IDs by with empty/dummy lists */
3971 for (i
=0; i
<range
; i
++) {
3972 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
3981 * Begin a new display list.
3984 _mesa_NewList( GLuint list
, GLenum mode
)
3986 GET_CURRENT_CONTEXT(ctx
);
3987 struct immediate
*IM
;
3988 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glNewList");
3990 if (MESA_VERBOSE
&VERBOSE_API
)
3991 fprintf(stderr
, "glNewList %u %s\n", list
, gl_lookup_enum_by_nr(mode
));
3994 gl_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
3998 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
3999 gl_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
4003 if (ctx
->CurrentListPtr
) {
4004 /* already compiling a display list */
4005 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
4009 /* Allocate new display list */
4010 ctx
->CurrentListNum
= list
;
4011 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
4012 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
4013 ctx
->CurrentPos
= 0;
4015 IM
= gl_immediate_alloc( ctx
);
4016 SET_IMMEDIATE( ctx
, IM
);
4017 gl_reset_input( ctx
);
4019 ctx
->CompileFlag
= GL_TRUE
;
4020 ctx
->CompileCVAFlag
= GL_FALSE
;
4021 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
4023 ctx
->CurrentDispatch
= &ctx
->Save
;
4024 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4030 * End definition of current display list.
4033 _mesa_EndList( void )
4035 GET_CURRENT_CONTEXT(ctx
);
4036 if (MESA_VERBOSE
&VERBOSE_API
)
4037 fprintf(stderr
, "glEndList\n");
4039 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
, "glEndList" );
4041 /* Check that a list is under construction */
4042 if (!ctx
->CurrentListPtr
) {
4043 gl_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
4047 (void) alloc_instruction( ctx
, OPCODE_END_OF_LIST
, 0 );
4049 /* Destroy old list, if any */
4050 gl_destroy_list(ctx
, ctx
->CurrentListNum
);
4051 /* Install the list */
4052 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
4055 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
4056 mesa_print_display_list(ctx
->CurrentListNum
);
4058 ctx
->CurrentListNum
= 0;
4059 ctx
->CurrentListPtr
= NULL
;
4060 ctx
->ExecuteFlag
= GL_TRUE
;
4061 ctx
->CompileFlag
= GL_FALSE
;
4062 /* ctx->CompileCVAFlag = ...; */
4064 /* KW: Put back the old input pointer.
4066 if (--ctx
->input
->ref_count
== 0)
4067 gl_immediate_free( ctx
->input
);
4069 SET_IMMEDIATE( ctx
, ctx
->VB
->IM
);
4070 gl_reset_input( ctx
);
4072 /* Haven't tracked down why this is needed.
4076 ctx
->CurrentDispatch
= &ctx
->Exec
;
4077 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4083 _mesa_CallList( GLuint list
)
4085 GET_CURRENT_CONTEXT(ctx
);
4086 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
4087 /* execute the display list, and restore the CompileFlag. */
4088 GLboolean save_compile_flag
;
4090 if (MESA_VERBOSE
&VERBOSE_API
) {
4091 fprintf(stderr
, "glCallList %u\n", list
);
4092 mesa_print_display_list( list
);
4095 save_compile_flag
= ctx
->CompileFlag
;
4096 ctx
->CompileFlag
= GL_FALSE
;
4098 FLUSH_VB( ctx
, "call list" );
4099 execute_list( ctx
, list
);
4100 ctx
->CompileFlag
= save_compile_flag
;
4102 /* also restore API function pointers to point to "save" versions */
4103 if (save_compile_flag
) {
4104 ctx
->CurrentDispatch
= &ctx
->Save
;
4105 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4112 * Execute glCallLists: call multiple display lists.
4115 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
4117 GET_CURRENT_CONTEXT(ctx
);
4120 GLboolean save_compile_flag
;
4122 /* Save the CompileFlag status, turn it off, execute display list,
4123 * and restore the CompileFlag.
4125 save_compile_flag
= ctx
->CompileFlag
;
4126 ctx
->CompileFlag
= GL_FALSE
;
4128 FLUSH_VB( ctx
, "call lists" );
4131 list
= translate_id( i
, type
, lists
);
4132 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
4135 ctx
->CompileFlag
= save_compile_flag
;
4137 /* also restore API function pointers to point to "save" versions */
4138 if (save_compile_flag
) {
4139 ctx
->CurrentDispatch
= &ctx
->Save
;
4140 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4143 /* RESET_IMMEDIATE( ctx ); */
4149 * Set the offset added to list numbers in glCallLists.
4152 _mesa_ListBase( GLuint base
)
4154 GET_CURRENT_CONTEXT(ctx
);
4155 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glListBase");
4156 ctx
->List
.ListBase
= base
;
4163 * Assign all the pointers in 'table' to point to Mesa's display list
4164 * building functions.
4167 _mesa_init_dlist_table( struct _glapi_table
*table
)
4169 _mesa_init_no_op_table(table
);
4172 table
->Accum
= save_Accum
;
4173 table
->AlphaFunc
= save_AlphaFunc
;
4174 table
->Begin
= save_Begin
;
4175 table
->Bitmap
= save_Bitmap
;
4176 table
->BlendFunc
= save_BlendFunc
;
4177 table
->CallList
= save_CallList
;
4178 table
->CallLists
= save_CallLists
;
4179 table
->Clear
= save_Clear
;
4180 table
->ClearAccum
= save_ClearAccum
;
4181 table
->ClearColor
= save_ClearColor
;
4182 table
->ClearDepth
= save_ClearDepth
;
4183 table
->ClearIndex
= save_ClearIndex
;
4184 table
->ClearStencil
= save_ClearStencil
;
4185 table
->ClipPlane
= save_ClipPlane
;
4186 table
->Color3b
= _mesa_Color3b
;
4187 table
->Color3bv
= _mesa_Color3bv
;
4188 table
->Color3d
= _mesa_Color3d
;
4189 table
->Color3dv
= _mesa_Color3dv
;
4190 table
->Color3f
= _mesa_Color3f
;
4191 table
->Color3fv
= _mesa_Color3fv
;
4192 table
->Color3i
= _mesa_Color3i
;
4193 table
->Color3iv
= _mesa_Color3iv
;
4194 table
->Color3s
= _mesa_Color3s
;
4195 table
->Color3sv
= _mesa_Color3sv
;
4196 table
->Color3ub
= _mesa_Color3ub
;
4197 table
->Color3ubv
= _mesa_Color3ubv
;
4198 table
->Color3ui
= _mesa_Color3ui
;
4199 table
->Color3uiv
= _mesa_Color3uiv
;
4200 table
->Color3us
= _mesa_Color3us
;
4201 table
->Color3usv
= _mesa_Color3usv
;
4202 table
->Color4b
= _mesa_Color4b
;
4203 table
->Color4bv
= _mesa_Color4bv
;
4204 table
->Color4d
= _mesa_Color4d
;
4205 table
->Color4dv
= _mesa_Color4dv
;
4206 table
->Color4f
= _mesa_Color4f
;
4207 table
->Color4fv
= _mesa_Color4fv
;
4208 table
->Color4i
= _mesa_Color4i
;
4209 table
->Color4iv
= _mesa_Color4iv
;
4210 table
->Color4s
= _mesa_Color4s
;
4211 table
->Color4sv
= _mesa_Color4sv
;
4212 table
->Color4ub
= _mesa_Color4ub
;
4213 table
->Color4ubv
= _mesa_Color4ubv
;
4214 table
->Color4ui
= _mesa_Color4ui
;
4215 table
->Color4uiv
= _mesa_Color4uiv
;
4216 table
->Color4us
= _mesa_Color4us
;
4217 table
->Color4usv
= _mesa_Color4usv
;
4218 table
->ColorMask
= save_ColorMask
;
4219 table
->ColorMaterial
= save_ColorMaterial
;
4220 table
->CopyPixels
= save_CopyPixels
;
4221 table
->CullFace
= save_CullFace
;
4222 table
->DeleteLists
= _mesa_DeleteLists
;
4223 table
->DepthFunc
= save_DepthFunc
;
4224 table
->DepthMask
= save_DepthMask
;
4225 table
->DepthRange
= save_DepthRange
;
4226 table
->Disable
= save_Disable
;
4227 table
->DrawBuffer
= save_DrawBuffer
;
4228 table
->DrawPixels
= save_DrawPixels
;
4229 table
->EdgeFlag
= _mesa_EdgeFlag
;
4230 table
->EdgeFlagv
= _mesa_EdgeFlagv
;
4231 table
->Enable
= save_Enable
;
4232 table
->End
= _mesa_End
;
4233 table
->EndList
= _mesa_EndList
;
4234 table
->EvalCoord1d
= _mesa_EvalCoord1d
;
4235 table
->EvalCoord1dv
= _mesa_EvalCoord1dv
;
4236 table
->EvalCoord1f
= _mesa_EvalCoord1f
;
4237 table
->EvalCoord1fv
= _mesa_EvalCoord1fv
;
4238 table
->EvalCoord2d
= _mesa_EvalCoord2d
;
4239 table
->EvalCoord2dv
= _mesa_EvalCoord2dv
;
4240 table
->EvalCoord2f
= _mesa_EvalCoord2f
;
4241 table
->EvalCoord2fv
= _mesa_EvalCoord2fv
;
4242 table
->EvalMesh1
= save_EvalMesh1
;
4243 table
->EvalMesh2
= save_EvalMesh2
;
4244 table
->EvalPoint1
= _mesa_EvalPoint1
;
4245 table
->EvalPoint2
= _mesa_EvalPoint2
;
4246 table
->FeedbackBuffer
= _mesa_FeedbackBuffer
;
4247 table
->Finish
= _mesa_Finish
;
4248 table
->Flush
= _mesa_Flush
;
4249 table
->Fogf
= save_Fogf
;
4250 table
->Fogfv
= save_Fogfv
;
4251 table
->Fogi
= save_Fogi
;
4252 table
->Fogiv
= save_Fogiv
;
4253 table
->FrontFace
= save_FrontFace
;
4254 table
->Frustum
= save_Frustum
;
4255 table
->GenLists
= _mesa_GenLists
;
4256 table
->GetBooleanv
= _mesa_GetBooleanv
;
4257 table
->GetClipPlane
= _mesa_GetClipPlane
;
4258 table
->GetDoublev
= _mesa_GetDoublev
;
4259 table
->GetError
= _mesa_GetError
;
4260 table
->GetFloatv
= _mesa_GetFloatv
;
4261 table
->GetIntegerv
= _mesa_GetIntegerv
;
4262 table
->GetLightfv
= _mesa_GetLightfv
;
4263 table
->GetLightiv
= _mesa_GetLightiv
;
4264 table
->GetMapdv
= _mesa_GetMapdv
;
4265 table
->GetMapfv
= _mesa_GetMapfv
;
4266 table
->GetMapiv
= _mesa_GetMapiv
;
4267 table
->GetMaterialfv
= _mesa_GetMaterialfv
;
4268 table
->GetMaterialiv
= _mesa_GetMaterialiv
;
4269 table
->GetPixelMapfv
= _mesa_GetPixelMapfv
;
4270 table
->GetPixelMapuiv
= _mesa_GetPixelMapuiv
;
4271 table
->GetPixelMapusv
= _mesa_GetPixelMapusv
;
4272 table
->GetPolygonStipple
= _mesa_GetPolygonStipple
;
4273 table
->GetString
= _mesa_GetString
;
4274 table
->GetTexEnvfv
= _mesa_GetTexEnvfv
;
4275 table
->GetTexEnviv
= _mesa_GetTexEnviv
;
4276 table
->GetTexGendv
= _mesa_GetTexGendv
;
4277 table
->GetTexGenfv
= _mesa_GetTexGenfv
;
4278 table
->GetTexGeniv
= _mesa_GetTexGeniv
;
4279 table
->GetTexImage
= _mesa_GetTexImage
;
4280 table
->GetTexLevelParameterfv
= _mesa_GetTexLevelParameterfv
;
4281 table
->GetTexLevelParameteriv
= _mesa_GetTexLevelParameteriv
;
4282 table
->GetTexParameterfv
= _mesa_GetTexParameterfv
;
4283 table
->GetTexParameteriv
= _mesa_GetTexParameteriv
;
4284 table
->Hint
= save_Hint
;
4285 table
->IndexMask
= save_IndexMask
;
4286 table
->Indexd
= _mesa_Indexd
;
4287 table
->Indexdv
= _mesa_Indexdv
;
4288 table
->Indexf
= _mesa_Indexf
;
4289 table
->Indexfv
= _mesa_Indexfv
;
4290 table
->Indexi
= _mesa_Indexi
;
4291 table
->Indexiv
= _mesa_Indexiv
;
4292 table
->Indexs
= _mesa_Indexs
;
4293 table
->Indexsv
= _mesa_Indexsv
;
4294 table
->InitNames
= save_InitNames
;
4295 table
->IsEnabled
= _mesa_IsEnabled
;
4296 table
->IsList
= _mesa_IsList
;
4297 table
->LightModelf
= save_LightModelf
;
4298 table
->LightModelfv
= save_LightModelfv
;
4299 table
->LightModeli
= save_LightModeli
;
4300 table
->LightModeliv
= save_LightModeliv
;
4301 table
->Lightf
= save_Lightf
;
4302 table
->Lightfv
= save_Lightfv
;
4303 table
->Lighti
= save_Lighti
;
4304 table
->Lightiv
= save_Lightiv
;
4305 table
->LineStipple
= save_LineStipple
;
4306 table
->LineWidth
= save_LineWidth
;
4307 table
->ListBase
= save_ListBase
;
4308 table
->LoadIdentity
= save_LoadIdentity
;
4309 table
->LoadMatrixd
= save_LoadMatrixd
;
4310 table
->LoadMatrixf
= save_LoadMatrixf
;
4311 table
->LoadName
= save_LoadName
;
4312 table
->LogicOp
= save_LogicOp
;
4313 table
->Map1d
= save_Map1d
;
4314 table
->Map1f
= save_Map1f
;
4315 table
->Map2d
= save_Map2d
;
4316 table
->Map2f
= save_Map2f
;
4317 table
->MapGrid1d
= save_MapGrid1d
;
4318 table
->MapGrid1f
= save_MapGrid1f
;
4319 table
->MapGrid2d
= save_MapGrid2d
;
4320 table
->MapGrid2f
= save_MapGrid2f
;
4321 table
->Materialf
= _mesa_Materialf
;
4322 table
->Materialfv
= _mesa_Materialfv
;
4323 table
->Materiali
= _mesa_Materiali
;
4324 table
->Materialiv
= _mesa_Materialiv
;
4325 table
->MatrixMode
= save_MatrixMode
;
4326 table
->MultMatrixd
= save_MultMatrixd
;
4327 table
->MultMatrixf
= save_MultMatrixf
;
4328 table
->NewList
= save_NewList
;
4329 table
->Normal3b
= _mesa_Normal3b
;
4330 table
->Normal3bv
= _mesa_Normal3bv
;
4331 table
->Normal3d
= _mesa_Normal3d
;
4332 table
->Normal3dv
= _mesa_Normal3dv
;
4333 table
->Normal3f
= _mesa_Normal3f
;
4334 table
->Normal3fv
= _mesa_Normal3fv
;
4335 table
->Normal3i
= _mesa_Normal3i
;
4336 table
->Normal3iv
= _mesa_Normal3iv
;
4337 table
->Normal3s
= _mesa_Normal3s
;
4338 table
->Normal3sv
= _mesa_Normal3sv
;
4339 table
->Ortho
= save_Ortho
;
4340 table
->PassThrough
= save_PassThrough
;
4341 table
->PixelMapfv
= save_PixelMapfv
;
4342 table
->PixelMapuiv
= save_PixelMapuiv
;
4343 table
->PixelMapusv
= save_PixelMapusv
;
4344 table
->PixelStoref
= _mesa_PixelStoref
;
4345 table
->PixelStorei
= _mesa_PixelStorei
;
4346 table
->PixelTransferf
= save_PixelTransferf
;
4347 table
->PixelTransferi
= save_PixelTransferi
;
4348 table
->PixelZoom
= save_PixelZoom
;
4349 table
->PointSize
= save_PointSize
;
4350 table
->PolygonMode
= save_PolygonMode
;
4351 table
->PolygonOffset
= save_PolygonOffset
;
4352 table
->PolygonStipple
= save_PolygonStipple
;
4353 table
->PopAttrib
= save_PopAttrib
;
4354 table
->PopMatrix
= save_PopMatrix
;
4355 table
->PopName
= save_PopName
;
4356 table
->PushAttrib
= save_PushAttrib
;
4357 table
->PushMatrix
= save_PushMatrix
;
4358 table
->PushName
= save_PushName
;
4359 table
->RasterPos2d
= save_RasterPos2d
;
4360 table
->RasterPos2dv
= save_RasterPos2dv
;
4361 table
->RasterPos2f
= save_RasterPos2f
;
4362 table
->RasterPos2fv
= save_RasterPos2fv
;
4363 table
->RasterPos2i
= save_RasterPos2i
;
4364 table
->RasterPos2iv
= save_RasterPos2iv
;
4365 table
->RasterPos2s
= save_RasterPos2s
;
4366 table
->RasterPos2sv
= save_RasterPos2sv
;
4367 table
->RasterPos3d
= save_RasterPos3d
;
4368 table
->RasterPos3dv
= save_RasterPos3dv
;
4369 table
->RasterPos3f
= save_RasterPos3f
;
4370 table
->RasterPos3fv
= save_RasterPos3fv
;
4371 table
->RasterPos3i
= save_RasterPos3i
;
4372 table
->RasterPos3iv
= save_RasterPos3iv
;
4373 table
->RasterPos3s
= save_RasterPos3s
;
4374 table
->RasterPos3sv
= save_RasterPos3sv
;
4375 table
->RasterPos4d
= save_RasterPos4d
;
4376 table
->RasterPos4dv
= save_RasterPos4dv
;
4377 table
->RasterPos4f
= save_RasterPos4f
;
4378 table
->RasterPos4fv
= save_RasterPos4fv
;
4379 table
->RasterPos4i
= save_RasterPos4i
;
4380 table
->RasterPos4iv
= save_RasterPos4iv
;
4381 table
->RasterPos4s
= save_RasterPos4s
;
4382 table
->RasterPos4sv
= save_RasterPos4sv
;
4383 table
->ReadBuffer
= save_ReadBuffer
;
4384 table
->ReadPixels
= _mesa_ReadPixels
;
4385 table
->Rectd
= save_Rectd
;
4386 table
->Rectdv
= save_Rectdv
;
4387 table
->Rectf
= save_Rectf
;
4388 table
->Rectfv
= save_Rectfv
;
4389 table
->Recti
= save_Recti
;
4390 table
->Rectiv
= save_Rectiv
;
4391 table
->Rects
= save_Rects
;
4392 table
->Rectsv
= save_Rectsv
;
4393 table
->RenderMode
= _mesa_RenderMode
;
4394 table
->Rotated
= save_Rotated
;
4395 table
->Rotatef
= save_Rotatef
;
4396 table
->Scaled
= save_Scaled
;
4397 table
->Scalef
= save_Scalef
;
4398 table
->Scissor
= save_Scissor
;
4399 table
->SelectBuffer
= _mesa_SelectBuffer
;
4400 table
->ShadeModel
= save_ShadeModel
;
4401 table
->StencilFunc
= save_StencilFunc
;
4402 table
->StencilMask
= save_StencilMask
;
4403 table
->StencilOp
= save_StencilOp
;
4404 table
->TexCoord1d
= _mesa_TexCoord1d
;
4405 table
->TexCoord1dv
= _mesa_TexCoord1dv
;
4406 table
->TexCoord1f
= _mesa_TexCoord1f
;
4407 table
->TexCoord1fv
= _mesa_TexCoord1fv
;
4408 table
->TexCoord1i
= _mesa_TexCoord1i
;
4409 table
->TexCoord1iv
= _mesa_TexCoord1iv
;
4410 table
->TexCoord1s
= _mesa_TexCoord1s
;
4411 table
->TexCoord1sv
= _mesa_TexCoord1sv
;
4412 table
->TexCoord2d
= _mesa_TexCoord2d
;
4413 table
->TexCoord2dv
= _mesa_TexCoord2dv
;
4414 table
->TexCoord2f
= _mesa_TexCoord2f
;
4415 table
->TexCoord2fv
= _mesa_TexCoord2fv
;
4416 table
->TexCoord2i
= _mesa_TexCoord2i
;
4417 table
->TexCoord2iv
= _mesa_TexCoord2iv
;
4418 table
->TexCoord2s
= _mesa_TexCoord2s
;
4419 table
->TexCoord2sv
= _mesa_TexCoord2sv
;
4420 table
->TexCoord3d
= _mesa_TexCoord3d
;
4421 table
->TexCoord3dv
= _mesa_TexCoord3dv
;
4422 table
->TexCoord3f
= _mesa_TexCoord3f
;
4423 table
->TexCoord3fv
= _mesa_TexCoord3fv
;
4424 table
->TexCoord3i
= _mesa_TexCoord3i
;
4425 table
->TexCoord3iv
= _mesa_TexCoord3iv
;
4426 table
->TexCoord3s
= _mesa_TexCoord3s
;
4427 table
->TexCoord3sv
= _mesa_TexCoord3sv
;
4428 table
->TexCoord4d
= _mesa_TexCoord4d
;
4429 table
->TexCoord4dv
= _mesa_TexCoord4dv
;
4430 table
->TexCoord4f
= _mesa_TexCoord4f
;
4431 table
->TexCoord4fv
= _mesa_TexCoord4fv
;
4432 table
->TexCoord4i
= _mesa_TexCoord4i
;
4433 table
->TexCoord4iv
= _mesa_TexCoord4iv
;
4434 table
->TexCoord4s
= _mesa_TexCoord4s
;
4435 table
->TexCoord4sv
= _mesa_TexCoord4sv
;
4436 table
->TexEnvf
= save_TexEnvf
;
4437 table
->TexEnvfv
= save_TexEnvfv
;
4438 table
->TexEnvi
= save_TexEnvi
;
4439 table
->TexEnviv
= save_TexEnviv
;
4440 table
->TexGend
= save_TexGend
;
4441 table
->TexGendv
= save_TexGendv
;
4442 table
->TexGenf
= save_TexGenf
;
4443 table
->TexGenfv
= save_TexGenfv
;
4444 table
->TexGeni
= save_TexGeni
;
4445 table
->TexGeniv
= save_TexGeniv
;
4446 table
->TexImage1D
= save_TexImage1D
;
4447 table
->TexImage2D
= save_TexImage2D
;
4448 table
->TexParameterf
= save_TexParameterf
;
4449 table
->TexParameterfv
= save_TexParameterfv
;
4450 table
->TexParameteri
= save_TexParameteri
;
4451 table
->TexParameteriv
= save_TexParameteriv
;
4452 table
->Translated
= save_Translated
;
4453 table
->Translatef
= save_Translatef
;
4454 table
->Vertex2d
= _mesa_Vertex2d
;
4455 table
->Vertex2dv
= _mesa_Vertex2dv
;
4456 table
->Vertex2f
= _mesa_Vertex2f
;
4457 table
->Vertex2fv
= _mesa_Vertex2fv
;
4458 table
->Vertex2i
= _mesa_Vertex2i
;
4459 table
->Vertex2iv
= _mesa_Vertex2iv
;
4460 table
->Vertex2s
= _mesa_Vertex2s
;
4461 table
->Vertex2sv
= _mesa_Vertex2sv
;
4462 table
->Vertex3d
= _mesa_Vertex3d
;
4463 table
->Vertex3dv
= _mesa_Vertex3dv
;
4464 table
->Vertex3f
= _mesa_Vertex3f
;
4465 table
->Vertex3fv
= _mesa_Vertex3fv
;
4466 table
->Vertex3i
= _mesa_Vertex3i
;
4467 table
->Vertex3iv
= _mesa_Vertex3iv
;
4468 table
->Vertex3s
= _mesa_Vertex3s
;
4469 table
->Vertex3sv
= _mesa_Vertex3sv
;
4470 table
->Vertex4d
= _mesa_Vertex4d
;
4471 table
->Vertex4dv
= _mesa_Vertex4dv
;
4472 table
->Vertex4f
= _mesa_Vertex4f
;
4473 table
->Vertex4fv
= _mesa_Vertex4fv
;
4474 table
->Vertex4i
= _mesa_Vertex4i
;
4475 table
->Vertex4iv
= _mesa_Vertex4iv
;
4476 table
->Vertex4s
= _mesa_Vertex4s
;
4477 table
->Vertex4sv
= _mesa_Vertex4sv
;
4478 table
->Viewport
= save_Viewport
;
4481 table
->AreTexturesResident
= _mesa_AreTexturesResident
;
4482 table
->ArrayElement
= _mesa_ArrayElement
;
4483 table
->BindTexture
= save_BindTexture
;
4484 table
->ColorPointer
= _mesa_ColorPointer
;
4485 table
->CopyTexImage1D
= save_CopyTexImage1D
;
4486 table
->CopyTexImage2D
= save_CopyTexImage2D
;
4487 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
4488 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
4489 table
->DeleteTextures
= _mesa_DeleteTextures
;
4490 table
->DisableClientState
= _mesa_DisableClientState
;
4491 table
->DrawArrays
= _mesa_DrawArrays
;
4492 table
->DrawElements
= _mesa_DrawElements
;
4493 table
->EdgeFlagPointer
= _mesa_EdgeFlagPointer
;
4494 table
->EnableClientState
= _mesa_EnableClientState
;
4495 table
->GenTextures
= _mesa_GenTextures
;
4496 table
->GetPointerv
= _mesa_GetPointerv
;
4497 table
->IndexPointer
= _mesa_IndexPointer
;
4498 table
->Indexub
= _mesa_Indexub
;
4499 table
->Indexubv
= _mesa_Indexubv
;
4500 table
->InterleavedArrays
= _mesa_InterleavedArrays
;
4501 table
->IsTexture
= _mesa_IsTexture
;
4502 table
->NormalPointer
= _mesa_NormalPointer
;
4503 table
->PopClientAttrib
= _mesa_PopClientAttrib
;
4504 table
->PrioritizeTextures
= save_PrioritizeTextures
;
4505 table
->PushClientAttrib
= _mesa_PushClientAttrib
;
4506 table
->TexCoordPointer
= _mesa_TexCoordPointer
;
4507 table
->TexSubImage1D
= save_TexSubImage1D
;
4508 table
->TexSubImage2D
= save_TexSubImage2D
;
4509 table
->VertexPointer
= _mesa_VertexPointer
;
4512 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
4513 table
->DrawRangeElements
= _mesa_DrawRangeElements
;
4514 table
->TexImage3D
= save_TexImage3D
;
4515 table
->TexSubImage3D
= save_TexSubImage3D
;
4517 /* GL_ARB_imaging */
4518 /* NOT supported, just call stub functions */
4519 table
->BlendColor
= _mesa_BlendColor
;
4520 table
->BlendEquation
= _mesa_BlendEquation
;
4521 table
->ColorSubTable
= _mesa_ColorSubTable
;
4522 table
->ColorTable
= _mesa_ColorTable
;
4523 table
->ColorTableParameterfv
= _mesa_ColorTableParameterfv
;
4524 table
->ColorTableParameteriv
= _mesa_ColorTableParameteriv
;
4525 table
->ConvolutionFilter1D
= _mesa_ConvolutionFilter1D
;
4526 table
->ConvolutionFilter2D
= _mesa_ConvolutionFilter2D
;
4527 table
->ConvolutionParameterf
= _mesa_ConvolutionParameterf
;
4528 table
->ConvolutionParameterfv
= _mesa_ConvolutionParameterfv
;
4529 table
->ConvolutionParameteri
= _mesa_ConvolutionParameteri
;
4530 table
->ConvolutionParameteriv
= _mesa_ConvolutionParameteriv
;
4531 table
->CopyColorSubTable
= _mesa_CopyColorSubTable
;
4532 table
->CopyColorTable
= _mesa_CopyColorTable
;
4533 table
->CopyConvolutionFilter1D
= _mesa_CopyConvolutionFilter1D
;
4534 table
->CopyConvolutionFilter2D
= _mesa_CopyConvolutionFilter2D
;
4535 table
->GetColorTable
= _mesa_GetColorTable
;
4536 table
->GetColorTableParameterfv
= _mesa_GetColorTableParameterfv
;
4537 table
->GetColorTableParameteriv
= _mesa_GetColorTableParameteriv
;
4538 table
->GetConvolutionFilter
= _mesa_GetConvolutionFilter
;
4539 table
->GetConvolutionParameterfv
= _mesa_GetConvolutionParameterfv
;
4540 table
->GetConvolutionParameteriv
= _mesa_GetConvolutionParameteriv
;
4541 table
->GetHistogram
= _mesa_GetHistogram
;
4542 table
->GetHistogramParameterfv
= _mesa_GetHistogramParameterfv
;
4543 table
->GetHistogramParameteriv
= _mesa_GetHistogramParameteriv
;
4544 table
->GetMinmax
= _mesa_GetMinmax
;
4545 table
->GetMinmaxParameterfv
= _mesa_GetMinmaxParameterfv
;
4546 table
->GetMinmaxParameteriv
= _mesa_GetMinmaxParameteriv
;
4547 table
->GetSeparableFilter
= _mesa_GetSeparableFilter
;
4548 table
->Histogram
= _mesa_Histogram
;
4549 table
->Minmax
= _mesa_Minmax
;
4550 table
->ResetHistogram
= _mesa_ResetHistogram
;
4551 table
->ResetMinmax
= _mesa_ResetMinmax
;
4552 table
->SeparableFilter2D
= _mesa_SeparableFilter2D
;
4554 /* 6. GL_EXT_texture3d */
4555 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
4556 table
->TexImage3DEXT
= save_TexImage3DEXT
;
4557 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
4559 /* GL_EXT_paletted_texture */
4560 table
->ColorTableEXT
= save_ColorTableEXT
;
4561 table
->ColorSubTableEXT
= save_ColorSubTableEXT
;
4562 table
->GetColorTableEXT
= _mesa_GetColorTableEXT
;
4563 table
->GetColorTableParameterfvEXT
= _mesa_GetColorTableParameterfvEXT
;
4564 table
->GetColorTableParameterivEXT
= _mesa_GetColorTableParameterivEXT
;
4566 /* GL_EXT_compiled_vertex_array */
4567 table
->LockArraysEXT
= _mesa_LockArraysEXT
;
4568 table
->UnlockArraysEXT
= _mesa_UnlockArraysEXT
;
4570 /* GL_EXT_point_parameters */
4571 table
->PointParameterfEXT
= save_PointParameterfEXT
;
4572 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
4574 /* GL_PGI_misc_hints */
4575 table
->HintPGI
= save_HintPGI
;
4577 /* GL_EXT_polygon_offset */
4578 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
4580 /* GL_EXT_blend_minmax */
4581 table
->BlendEquationEXT
= save_BlendEquation
;
4583 /* GL_EXT_blend_color */
4584 table
->BlendColorEXT
= save_BlendColor
;
4586 /* GL_ARB_multitexture */
4587 table
->ActiveTextureARB
= save_ActiveTextureARB
;
4588 table
->ClientActiveTextureARB
= save_ClientActiveTextureARB
;
4589 table
->MultiTexCoord1dARB
= _mesa_MultiTexCoord1dARB
;
4590 table
->MultiTexCoord1dvARB
= _mesa_MultiTexCoord1dvARB
;
4591 table
->MultiTexCoord1fARB
= _mesa_MultiTexCoord1fARB
;
4592 table
->MultiTexCoord1fvARB
= _mesa_MultiTexCoord1fvARB
;
4593 table
->MultiTexCoord1iARB
= _mesa_MultiTexCoord1iARB
;
4594 table
->MultiTexCoord1ivARB
= _mesa_MultiTexCoord1ivARB
;
4595 table
->MultiTexCoord1sARB
= _mesa_MultiTexCoord1sARB
;
4596 table
->MultiTexCoord1svARB
= _mesa_MultiTexCoord1svARB
;
4597 table
->MultiTexCoord2dARB
= _mesa_MultiTexCoord2dARB
;
4598 table
->MultiTexCoord2dvARB
= _mesa_MultiTexCoord2dvARB
;
4599 table
->MultiTexCoord2fARB
= _mesa_MultiTexCoord2fARB
;
4600 table
->MultiTexCoord2fvARB
= _mesa_MultiTexCoord2fvARB
;
4601 table
->MultiTexCoord2iARB
= _mesa_MultiTexCoord2iARB
;
4602 table
->MultiTexCoord2ivARB
= _mesa_MultiTexCoord2ivARB
;
4603 table
->MultiTexCoord2sARB
= _mesa_MultiTexCoord2sARB
;
4604 table
->MultiTexCoord2svARB
= _mesa_MultiTexCoord2svARB
;
4605 table
->MultiTexCoord3dARB
= _mesa_MultiTexCoord3dARB
;
4606 table
->MultiTexCoord3dvARB
= _mesa_MultiTexCoord3dvARB
;
4607 table
->MultiTexCoord3fARB
= _mesa_MultiTexCoord3fARB
;
4608 table
->MultiTexCoord3fvARB
= _mesa_MultiTexCoord3fvARB
;
4609 table
->MultiTexCoord3iARB
= _mesa_MultiTexCoord3iARB
;
4610 table
->MultiTexCoord3ivARB
= _mesa_MultiTexCoord3ivARB
;
4611 table
->MultiTexCoord3sARB
= _mesa_MultiTexCoord3sARB
;
4612 table
->MultiTexCoord3svARB
= _mesa_MultiTexCoord3svARB
;
4613 table
->MultiTexCoord4dARB
= _mesa_MultiTexCoord4dARB
;
4614 table
->MultiTexCoord4dvARB
= _mesa_MultiTexCoord4dvARB
;
4615 table
->MultiTexCoord4fARB
= _mesa_MultiTexCoord4fARB
;
4616 table
->MultiTexCoord4fvARB
= _mesa_MultiTexCoord4fvARB
;
4617 table
->MultiTexCoord4iARB
= _mesa_MultiTexCoord4iARB
;
4618 table
->MultiTexCoord4ivARB
= _mesa_MultiTexCoord4ivARB
;
4619 table
->MultiTexCoord4sARB
= _mesa_MultiTexCoord4sARB
;
4620 table
->MultiTexCoord4svARB
= _mesa_MultiTexCoord4svARB
;
4622 /* GL_INGR_blend_func_separate */
4623 table
->BlendFuncSeparateINGR
= save_BlendFuncSeparateINGR
;
4625 /* GL_MESA_window_pos */
4626 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
4627 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
4628 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
4629 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
4630 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
4631 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
4632 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
4633 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
4634 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
4635 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
4636 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
4637 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
4638 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
4639 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
4640 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
4641 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
4642 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
4643 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
4644 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
4645 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
4646 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
4647 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
4648 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
4649 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
4651 /* GL_MESA_resize_buffers */
4652 table
->ResizeBuffersMESA
= _mesa_ResizeBuffersMESA
;
4654 /* GL_ARB_transpose_matrix */
4655 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
4656 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
4657 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
4658 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
4667 static const char *enum_string( GLenum k
)
4669 return gl_lookup_enum_by_nr( k
);
4674 * Print the commands in a display list. For debugging only.
4675 * TODO: many commands aren't handled yet.
4677 static void print_list( GLcontext
*ctx
, FILE *f
, GLuint list
)
4683 if (!glIsList(list
)) {
4684 fprintf(f
,"%u is not a display list ID\n",list
);
4688 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
4690 fprintf( f
, "START-LIST %u, address %p\n", list
, (void*)n
);
4692 done
= n
? GL_FALSE
: GL_TRUE
;
4694 opcode
= n
[0].opcode
;
4698 fprintf(f
,"accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
4701 fprintf(f
,"Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
4702 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
4704 case OPCODE_CALL_LIST
:
4705 fprintf(f
,"CallList %d\n", (int) n
[1].ui
);
4707 case OPCODE_CALL_LIST_OFFSET
:
4708 fprintf(f
,"CallList %d + offset %u = %u\n", (int) n
[1].ui
,
4709 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
4711 case OPCODE_DISABLE
:
4712 fprintf(f
,"Disable %s\n", enum_string(n
[1].e
));
4715 fprintf(f
,"Enable %s\n", enum_string(n
[1].e
));
4717 case OPCODE_FRUSTUM
:
4718 fprintf(f
,"Frustum %g %g %g %g %g %g\n",
4719 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4721 case OPCODE_LINE_STIPPLE
:
4722 fprintf(f
,"LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
4724 case OPCODE_LOAD_IDENTITY
:
4725 fprintf(f
,"LoadIdentity\n");
4727 case OPCODE_LOAD_MATRIX
:
4728 fprintf(f
,"LoadMatrix\n");
4729 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
4730 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
4731 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
4732 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
4734 case OPCODE_MULT_MATRIX
:
4735 fprintf(f
,"MultMatrix (or Rotate)\n");
4736 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
4737 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
4738 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
4739 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
4742 fprintf(f
,"Ortho %g %g %g %g %g %g\n",
4743 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4745 case OPCODE_POP_ATTRIB
:
4746 fprintf(f
,"PopAttrib\n");
4748 case OPCODE_POP_MATRIX
:
4749 fprintf(f
,"PopMatrix\n");
4751 case OPCODE_POP_NAME
:
4752 fprintf(f
,"PopName\n");
4754 case OPCODE_PUSH_ATTRIB
:
4755 fprintf(f
,"PushAttrib %x\n", n
[1].bf
);
4757 case OPCODE_PUSH_MATRIX
:
4758 fprintf(f
,"PushMatrix\n");
4760 case OPCODE_PUSH_NAME
:
4761 fprintf(f
,"PushName %d\n", (int) n
[1].ui
);
4763 case OPCODE_RASTER_POS
:
4764 fprintf(f
,"RasterPos %g %g %g %g\n", n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
4767 fprintf( f
, "Rectf %g %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4770 fprintf(f
,"Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
4772 case OPCODE_TRANSLATE
:
4773 fprintf(f
,"Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
4775 case OPCODE_BIND_TEXTURE
:
4776 fprintf(f
,"BindTexture %s %d\n", gl_lookup_enum_by_nr(n
[1].ui
),
4779 case OPCODE_SHADE_MODEL
:
4780 fprintf(f
,"ShadeModel %s\n", gl_lookup_enum_by_nr(n
[1].ui
));
4784 * meta opcodes/commands
4787 fprintf(f
,"Error: %s %s\n", enum_string(n
[1].e
), (const char *)n
[2].data
);
4789 case OPCODE_VERTEX_CASSETTE
:
4790 fprintf(f
,"VERTEX-CASSETTE, id %u, rows %u..%u\n",
4791 ((struct immediate
*) n
[1].data
)->id
,
4795 case OPCODE_CONTINUE
:
4796 fprintf(f
,"DISPLAY-LIST-CONTINUE\n");
4797 n
= (Node
*) n
[1].next
;
4799 case OPCODE_END_OF_LIST
:
4800 fprintf(f
,"END-LIST %u\n", list
);
4804 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
4805 fprintf(f
,"ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
4810 fprintf(f
,"command %d, %u operands\n",opcode
,InstSize
[opcode
]);
4814 /* increment n to point to next compiled command */
4815 if (opcode
!=OPCODE_CONTINUE
) {
4816 n
+= InstSize
[opcode
];
4824 * Clients may call this function to help debug display list problems.
4825 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
4826 * changed, or break in the future without notice.
4828 void mesa_print_display_list( GLuint list
)
4830 GET_CURRENT_CONTEXT(ctx
);
4831 print_list( ctx
, stderr
, list
);