1 /* $Id: dlist.c,v 1.35 2000/03/19 01:10:11 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.
47 #include "extensions.h"
81 Functions which aren't compiled but executed immediately:
96 Functions which cause errors if called while compiling a display list:
103 * Display list instructions are stored as sequences of "nodes". Nodes
104 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
105 * are linked together with a pointer.
109 /* How many nodes to allocate at a time:
110 * - reduced now that we hold vertices etc. elsewhere.
112 #define BLOCK_SIZE 64
116 * Display list opcodes.
118 * The fact that these identifiers are assigned consecutive
119 * integer values starting at 0 is very important, see InstSize array usage)
121 * KW: Commented out opcodes now handled by vertex-cassettes.
129 OPCODE_BLEND_EQUATION
,
131 OPCODE_BLEND_FUNC_SEPARATE
,
133 OPCODE_CALL_LIST_OFFSET
,
139 OPCODE_CLEAR_STENCIL
,
142 OPCODE_COLOR_MATERIAL
,
144 OPCODE_COLOR_SUB_TABLE
,
146 OPCODE_COPY_TEX_IMAGE1D
,
147 OPCODE_COPY_TEX_IMAGE2D
,
148 OPCODE_COPY_TEX_SUB_IMAGE1D
,
149 OPCODE_COPY_TEX_SUB_IMAGE2D
,
150 OPCODE_COPY_TEX_SUB_IMAGE3D
,
177 OPCODE_LOAD_IDENTITY
,
190 OPCODE_PIXEL_TRANSFER
,
193 OPCODE_POINT_PARAMETERS
,
195 OPCODE_POLYGON_STIPPLE
,
196 OPCODE_POLYGON_OFFSET
,
200 OPCODE_PRIORITIZE_TEXTURE
,
209 OPCODE_SELECT_TEXTURE_SGIS
,
210 OPCODE_SELECT_TEXTURE_COORD_SET
,
221 OPCODE_TEX_SUB_IMAGE1D
,
222 OPCODE_TEX_SUB_IMAGE2D
,
223 OPCODE_TEX_SUB_IMAGE3D
,
227 /* GL_ARB_multitexture */
228 OPCODE_ACTIVE_TEXTURE
,
229 OPCODE_CLIENT_ACTIVE_TEXTURE
,
230 /* The following three are meta instructions */
231 OPCODE_ERROR
, /* raise compiled-in error */
232 OPCODE_VERTEX_CASSETTE
, /* render prebuilt vertex buffer */
239 * Each instruction in the display list is stored as a sequence of
240 * contiguous nodes in memory.
241 * Each node is the union of a variety of datatypes.
255 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
260 /* Number of nodes of storage needed for each instruction: */
261 static GLuint InstSize
[ OPCODE_END_OF_LIST
+1 ];
263 void mesa_print_display_list( GLuint list
);
266 /**********************************************************************/
267 /***** Private *****/
268 /**********************************************************************/
272 * Allocate space for a display list instruction.
273 * Input: opcode - type of instruction
274 * argcount - number of arguments following the instruction
275 * Return: pointer to first node in the instruction
277 static Node
*alloc_instruction( GLcontext
*ctx
, OpCode opcode
, GLint argcount
)
280 GLuint count
= InstSize
[opcode
];
282 assert( (GLint
) count
== argcount
+1 );
284 if (ctx
->CurrentPos
+ count
+ 2 > BLOCK_SIZE
) {
285 /* This block is full. Allocate a new block and chain to it */
286 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
287 n
[0].opcode
= OPCODE_CONTINUE
;
288 newblock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
290 gl_error( ctx
, GL_OUT_OF_MEMORY
, "Building display list" );
293 n
[1].next
= (Node
*) newblock
;
294 ctx
->CurrentBlock
= newblock
;
298 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
299 ctx
->CurrentPos
+= count
;
301 n
[0].opcode
= opcode
;
309 * Make an empty display list. This is used by glGenLists() to
310 * reserver display list IDs.
312 static Node
*make_empty_list( void )
314 Node
*n
= (Node
*) MALLOC( sizeof(Node
) );
315 n
[0].opcode
= OPCODE_END_OF_LIST
;
322 * Destroy all nodes in a display list.
323 * Input: list - display list number
325 void gl_destroy_list( GLcontext
*ctx
, GLuint list
)
333 block
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
336 done
= block
? GL_FALSE
: GL_TRUE
;
338 switch (n
[0].opcode
) {
339 /* special cases first */
340 case OPCODE_VERTEX_CASSETTE
:
341 if ( ! -- ((struct immediate
*) n
[1].data
)->ref_count
)
342 gl_immediate_free( (struct immediate
*) n
[1].data
);
343 n
+= InstSize
[n
[0].opcode
];
347 n
+= InstSize
[n
[0].opcode
];
351 n
+= InstSize
[n
[0].opcode
];
353 case OPCODE_DRAW_PIXELS
:
355 n
+= InstSize
[n
[0].opcode
];
359 n
+= InstSize
[n
[0].opcode
];
361 case OPCODE_COLOR_TABLE
:
363 n
+= InstSize
[n
[0].opcode
];
365 case OPCODE_COLOR_SUB_TABLE
:
367 n
+= InstSize
[n
[0].opcode
];
369 case OPCODE_POLYGON_STIPPLE
:
371 n
+= InstSize
[n
[0].opcode
];
373 case OPCODE_TEX_IMAGE1D
:
375 n
+= InstSize
[n
[0].opcode
];
377 case OPCODE_TEX_IMAGE2D
:
379 n
+= InstSize
[n
[0].opcode
];
381 case OPCODE_TEX_IMAGE3D
:
383 n
+= InstSize
[n
[0].opcode
];
385 case OPCODE_TEX_SUB_IMAGE1D
:
387 n
+= InstSize
[n
[0].opcode
];
389 case OPCODE_TEX_SUB_IMAGE2D
:
391 n
+= InstSize
[n
[0].opcode
];
393 case OPCODE_TEX_SUB_IMAGE3D
:
395 n
+= InstSize
[n
[0].opcode
];
397 case OPCODE_CONTINUE
:
398 n
= (Node
*) n
[1].next
;
402 case OPCODE_END_OF_LIST
:
407 /* Most frequent case */
408 n
+= InstSize
[n
[0].opcode
];
413 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
419 * Translate the nth element of list from type to GLuint.
421 static GLuint
translate_id( GLsizei n
, GLenum type
, const GLvoid
*list
)
433 bptr
= (GLbyte
*) list
;
434 return (GLuint
) *(bptr
+n
);
435 case GL_UNSIGNED_BYTE
:
436 ubptr
= (GLubyte
*) list
;
437 return (GLuint
) *(ubptr
+n
);
439 sptr
= (GLshort
*) list
;
440 return (GLuint
) *(sptr
+n
);
441 case GL_UNSIGNED_SHORT
:
442 usptr
= (GLushort
*) list
;
443 return (GLuint
) *(usptr
+n
);
445 iptr
= (GLint
*) list
;
446 return (GLuint
) *(iptr
+n
);
447 case GL_UNSIGNED_INT
:
448 uiptr
= (GLuint
*) list
;
449 return (GLuint
) *(uiptr
+n
);
451 fptr
= (GLfloat
*) list
;
452 return (GLuint
) *(fptr
+n
);
454 ubptr
= ((GLubyte
*) list
) + 2*n
;
455 return (GLuint
) *ubptr
* 256 + (GLuint
) *(ubptr
+1);
457 ubptr
= ((GLubyte
*) list
) + 3*n
;
458 return (GLuint
) *ubptr
* 65536
459 + (GLuint
) *(ubptr
+1) * 256
460 + (GLuint
) *(ubptr
+2);
462 ubptr
= ((GLubyte
*) list
) + 4*n
;
463 return (GLuint
) *ubptr
* 16777216
464 + (GLuint
) *(ubptr
+1) * 65536
465 + (GLuint
) *(ubptr
+2) * 256
466 + (GLuint
) *(ubptr
+3);
475 /**********************************************************************/
477 /**********************************************************************/
479 void gl_init_lists( void )
481 static int init_flag
= 0;
484 InstSize
[OPCODE_ACCUM
] = 3;
485 InstSize
[OPCODE_ALPHA_FUNC
] = 3;
486 InstSize
[OPCODE_BIND_TEXTURE
] = 3;
487 InstSize
[OPCODE_BITMAP
] = 8;
488 InstSize
[OPCODE_BLEND_COLOR
] = 5;
489 InstSize
[OPCODE_BLEND_EQUATION
] = 2;
490 InstSize
[OPCODE_BLEND_FUNC
] = 3;
491 InstSize
[OPCODE_BLEND_FUNC_SEPARATE
] = 5;
492 InstSize
[OPCODE_CALL_LIST
] = 2;
493 InstSize
[OPCODE_CALL_LIST_OFFSET
] = 2;
494 InstSize
[OPCODE_CLEAR
] = 2;
495 InstSize
[OPCODE_CLEAR_ACCUM
] = 5;
496 InstSize
[OPCODE_CLEAR_COLOR
] = 5;
497 InstSize
[OPCODE_CLEAR_DEPTH
] = 2;
498 InstSize
[OPCODE_CLEAR_INDEX
] = 2;
499 InstSize
[OPCODE_CLEAR_STENCIL
] = 2;
500 InstSize
[OPCODE_CLIP_PLANE
] = 6;
501 InstSize
[OPCODE_COLOR_MASK
] = 5;
502 InstSize
[OPCODE_COLOR_MATERIAL
] = 3;
503 InstSize
[OPCODE_COLOR_TABLE
] = 7;
504 InstSize
[OPCODE_COLOR_SUB_TABLE
] = 7;
505 InstSize
[OPCODE_COPY_PIXELS
] = 6;
506 InstSize
[OPCODE_COPY_TEX_IMAGE1D
] = 8;
507 InstSize
[OPCODE_COPY_TEX_IMAGE2D
] = 9;
508 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE1D
] = 7;
509 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE2D
] = 9;
510 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE3D
] = 10;
511 InstSize
[OPCODE_CULL_FACE
] = 2;
512 InstSize
[OPCODE_DEPTH_FUNC
] = 2;
513 InstSize
[OPCODE_DEPTH_MASK
] = 2;
514 InstSize
[OPCODE_DEPTH_RANGE
] = 3;
515 InstSize
[OPCODE_DISABLE
] = 2;
516 InstSize
[OPCODE_DRAW_BUFFER
] = 2;
517 InstSize
[OPCODE_DRAW_PIXELS
] = 6;
518 InstSize
[OPCODE_ENABLE
] = 2;
519 InstSize
[OPCODE_EVALCOORD1
] = 2;
520 InstSize
[OPCODE_EVALCOORD2
] = 3;
521 InstSize
[OPCODE_EVALMESH1
] = 4;
522 InstSize
[OPCODE_EVALMESH2
] = 6;
523 InstSize
[OPCODE_EVALPOINT1
] = 2;
524 InstSize
[OPCODE_EVALPOINT2
] = 3;
525 InstSize
[OPCODE_FOG
] = 6;
526 InstSize
[OPCODE_FRONT_FACE
] = 2;
527 InstSize
[OPCODE_FRUSTUM
] = 7;
528 InstSize
[OPCODE_HINT
] = 3;
529 InstSize
[OPCODE_HINT_PGI
] = 3;
530 InstSize
[OPCODE_INDEX_MASK
] = 2;
531 InstSize
[OPCODE_INIT_NAMES
] = 1;
532 InstSize
[OPCODE_LIGHT
] = 7;
533 InstSize
[OPCODE_LIGHT_MODEL
] = 6;
534 InstSize
[OPCODE_LINE_STIPPLE
] = 3;
535 InstSize
[OPCODE_LINE_WIDTH
] = 2;
536 InstSize
[OPCODE_LIST_BASE
] = 2;
537 InstSize
[OPCODE_LOAD_IDENTITY
] = 1;
538 InstSize
[OPCODE_LOAD_MATRIX
] = 17;
539 InstSize
[OPCODE_LOAD_NAME
] = 2;
540 InstSize
[OPCODE_LOGIC_OP
] = 2;
541 InstSize
[OPCODE_MAP1
] = 7;
542 InstSize
[OPCODE_MAP2
] = 11;
543 InstSize
[OPCODE_MAPGRID1
] = 4;
544 InstSize
[OPCODE_MAPGRID2
] = 7;
545 InstSize
[OPCODE_MATRIX_MODE
] = 2;
546 InstSize
[OPCODE_MULT_MATRIX
] = 17;
547 InstSize
[OPCODE_ORTHO
] = 7;
548 InstSize
[OPCODE_PASSTHROUGH
] = 2;
549 InstSize
[OPCODE_PIXEL_MAP
] = 4;
550 InstSize
[OPCODE_PIXEL_TRANSFER
] = 3;
551 InstSize
[OPCODE_PIXEL_ZOOM
] = 3;
552 InstSize
[OPCODE_POINT_SIZE
] = 2;
553 InstSize
[OPCODE_POINT_PARAMETERS
] = 5;
554 InstSize
[OPCODE_POLYGON_MODE
] = 3;
555 InstSize
[OPCODE_POLYGON_STIPPLE
] = 2;
556 InstSize
[OPCODE_POLYGON_OFFSET
] = 3;
557 InstSize
[OPCODE_POP_ATTRIB
] = 1;
558 InstSize
[OPCODE_POP_MATRIX
] = 1;
559 InstSize
[OPCODE_POP_NAME
] = 1;
560 InstSize
[OPCODE_PRIORITIZE_TEXTURE
] = 3;
561 InstSize
[OPCODE_PUSH_ATTRIB
] = 2;
562 InstSize
[OPCODE_PUSH_MATRIX
] = 1;
563 InstSize
[OPCODE_PUSH_NAME
] = 2;
564 InstSize
[OPCODE_RASTER_POS
] = 5;
565 InstSize
[OPCODE_RECTF
] = 5;
566 InstSize
[OPCODE_READ_BUFFER
] = 2;
567 InstSize
[OPCODE_SCALE
] = 4;
568 InstSize
[OPCODE_SCISSOR
] = 5;
569 InstSize
[OPCODE_STENCIL_FUNC
] = 4;
570 InstSize
[OPCODE_STENCIL_MASK
] = 2;
571 InstSize
[OPCODE_STENCIL_OP
] = 4;
572 InstSize
[OPCODE_SHADE_MODEL
] = 2;
573 InstSize
[OPCODE_TEXENV
] = 7;
574 InstSize
[OPCODE_TEXGEN
] = 7;
575 InstSize
[OPCODE_TEXPARAMETER
] = 7;
576 InstSize
[OPCODE_TEX_IMAGE1D
] = 9;
577 InstSize
[OPCODE_TEX_IMAGE2D
] = 10;
578 InstSize
[OPCODE_TEX_IMAGE3D
] = 11;
579 InstSize
[OPCODE_TEX_SUB_IMAGE1D
] = 8;
580 InstSize
[OPCODE_TEX_SUB_IMAGE2D
] = 10;
581 InstSize
[OPCODE_TEX_SUB_IMAGE3D
] = 12;
582 InstSize
[OPCODE_TRANSLATE
] = 4;
583 InstSize
[OPCODE_VIEWPORT
] = 5;
584 InstSize
[OPCODE_WINDOW_POS
] = 5;
585 InstSize
[OPCODE_CONTINUE
] = 2;
586 InstSize
[OPCODE_ERROR
] = 3;
587 InstSize
[OPCODE_VERTEX_CASSETTE
] = 9;
588 InstSize
[OPCODE_END_OF_LIST
] = 1;
589 /* GL_ARB_multitexture */
590 InstSize
[OPCODE_ACTIVE_TEXTURE
] = 2;
591 InstSize
[OPCODE_CLIENT_ACTIVE_TEXTURE
] = 2;
598 * Display List compilation functions
603 static void save_Accum( GLenum op
, GLfloat value
)
605 GET_CURRENT_CONTEXT(ctx
);
607 FLUSH_VB(ctx
, "dlist");
608 n
= alloc_instruction( ctx
, OPCODE_ACCUM
, 2 );
613 if (ctx
->ExecuteFlag
) {
614 (*ctx
->Exec
->Accum
)( op
, value
);
619 static void save_AlphaFunc( GLenum func
, GLclampf ref
)
621 GET_CURRENT_CONTEXT(ctx
);
623 FLUSH_VB(ctx
, "dlist");
624 n
= alloc_instruction( ctx
, OPCODE_ALPHA_FUNC
, 2 );
627 n
[2].f
= (GLfloat
) ref
;
629 if (ctx
->ExecuteFlag
) {
630 (*ctx
->Exec
->AlphaFunc
)( func
, ref
);
635 static void save_Begin( GLenum mode
)
637 _mesa_Begin(mode
); /* special case */
641 static void save_BindTexture( GLenum target
, GLuint texture
)
643 GET_CURRENT_CONTEXT(ctx
);
645 FLUSH_VB(ctx
, "dlist");
646 n
= alloc_instruction( ctx
, OPCODE_BIND_TEXTURE
, 2 );
651 if (ctx
->ExecuteFlag
) {
652 (*ctx
->Exec
->BindTexture
)( target
, texture
);
657 static void save_Bitmap( GLsizei width
, GLsizei height
,
658 GLfloat xorig
, GLfloat yorig
,
659 GLfloat xmove
, GLfloat ymove
,
660 const GLubyte
*pixels
)
662 GET_CURRENT_CONTEXT(ctx
);
663 GLvoid
*image
= _mesa_unpack_bitmap( width
, height
, pixels
, &ctx
->Unpack
);
665 FLUSH_VB(ctx
, "dlist");
666 n
= alloc_instruction( ctx
, OPCODE_BITMAP
, 7 );
668 n
[1].i
= (GLint
) width
;
669 n
[2].i
= (GLint
) height
;
679 if (ctx
->ExecuteFlag
) {
680 (*ctx
->Exec
->Bitmap
)( width
, height
,
681 xorig
, yorig
, xmove
, ymove
, pixels
);
686 static void save_BlendEquation( GLenum mode
)
688 GET_CURRENT_CONTEXT(ctx
);
690 FLUSH_VB(ctx
, "dlist");
691 n
= alloc_instruction( ctx
, OPCODE_BLEND_EQUATION
, 1 );
695 if (ctx
->ExecuteFlag
) {
696 (*ctx
->Exec
->BlendEquation
)( mode
);
701 static void save_BlendFunc( GLenum sfactor
, GLenum dfactor
)
703 GET_CURRENT_CONTEXT(ctx
);
705 FLUSH_VB(ctx
, "dlist");
706 n
= alloc_instruction( ctx
, OPCODE_BLEND_FUNC
, 2 );
711 if (ctx
->ExecuteFlag
) {
712 (*ctx
->Exec
->BlendFunc
)( sfactor
, dfactor
);
717 static void save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
718 GLenum sfactorA
, GLenum dfactorA
)
720 GET_CURRENT_CONTEXT(ctx
);
722 FLUSH_VB(ctx
, "dlist");
723 n
= alloc_instruction( ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4 );
730 if (ctx
->ExecuteFlag
) {
731 (*ctx
->Exec
->BlendFuncSeparateEXT
)( sfactorRGB
, dfactorRGB
,
737 static void save_BlendColor( GLfloat red
, GLfloat green
,
738 GLfloat blue
, GLfloat alpha
)
740 GET_CURRENT_CONTEXT(ctx
);
742 FLUSH_VB(ctx
, "dlist");
743 n
= alloc_instruction( ctx
, OPCODE_BLEND_COLOR
, 4 );
750 if (ctx
->ExecuteFlag
) {
751 (*ctx
->Exec
->BlendColor
)( red
, green
, blue
, alpha
);
756 static void save_CallList( GLuint list
)
758 GET_CURRENT_CONTEXT(ctx
);
760 FLUSH_VB(ctx
, "dlist");
761 n
= alloc_instruction( ctx
, OPCODE_CALL_LIST
, 1 );
765 if (ctx
->ExecuteFlag
) {
766 (*ctx
->Exec
->CallList
)( list
);
771 static void save_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
773 GET_CURRENT_CONTEXT(ctx
);
775 FLUSH_VB(ctx
, "dlist");
778 GLuint list
= translate_id( i
, type
, lists
);
779 Node
*n
= alloc_instruction( ctx
, OPCODE_CALL_LIST_OFFSET
, 1 );
784 if (ctx
->ExecuteFlag
) {
785 (*ctx
->Exec
->CallLists
)( n
, type
, lists
);
790 static void save_Clear( GLbitfield mask
)
792 GET_CURRENT_CONTEXT(ctx
);
794 FLUSH_VB(ctx
, "dlist");
795 n
= alloc_instruction( ctx
, OPCODE_CLEAR
, 1 );
799 if (ctx
->ExecuteFlag
) {
800 (*ctx
->Exec
->Clear
)( mask
);
805 static void save_ClearAccum( GLfloat red
, GLfloat green
,
806 GLfloat blue
, GLfloat alpha
)
808 GET_CURRENT_CONTEXT(ctx
);
810 FLUSH_VB(ctx
, "dlist");
811 n
= alloc_instruction( ctx
, OPCODE_CLEAR_ACCUM
, 4 );
818 if (ctx
->ExecuteFlag
) {
819 (*ctx
->Exec
->ClearAccum
)( red
, green
, blue
, alpha
);
824 static void save_ClearColor( GLclampf red
, GLclampf green
,
825 GLclampf blue
, GLclampf alpha
)
827 GET_CURRENT_CONTEXT(ctx
);
829 FLUSH_VB(ctx
, "dlist");
830 n
= alloc_instruction( ctx
, OPCODE_CLEAR_COLOR
, 4 );
837 if (ctx
->ExecuteFlag
) {
838 (*ctx
->Exec
->ClearColor
)( red
, green
, blue
, alpha
);
843 static void save_ClearDepth( GLclampd depth
)
845 GET_CURRENT_CONTEXT(ctx
);
847 FLUSH_VB(ctx
, "dlist");
848 n
= alloc_instruction( ctx
, OPCODE_CLEAR_DEPTH
, 1 );
850 n
[1].f
= (GLfloat
) depth
;
852 if (ctx
->ExecuteFlag
) {
853 (*ctx
->Exec
->ClearDepth
)( depth
);
858 static void save_ClearIndex( GLfloat c
)
860 GET_CURRENT_CONTEXT(ctx
);
862 FLUSH_VB(ctx
, "dlist");
863 n
= alloc_instruction( ctx
, OPCODE_CLEAR_INDEX
, 1 );
867 if (ctx
->ExecuteFlag
) {
868 (*ctx
->Exec
->ClearIndex
)( c
);
873 static void save_ClearStencil( GLint s
)
875 GET_CURRENT_CONTEXT(ctx
);
877 FLUSH_VB(ctx
, "dlist");
878 n
= alloc_instruction( ctx
, OPCODE_CLEAR_STENCIL
, 1 );
882 if (ctx
->ExecuteFlag
) {
883 (*ctx
->Exec
->ClearStencil
)( s
);
888 static void save_ClipPlane( GLenum plane
, const GLdouble
*equ
)
890 GET_CURRENT_CONTEXT(ctx
);
892 FLUSH_VB(ctx
, "dlist");
893 n
= alloc_instruction( ctx
, OPCODE_CLIP_PLANE
, 5 );
901 if (ctx
->ExecuteFlag
) {
902 (*ctx
->Exec
->ClipPlane
)( plane
, equ
);
908 static void save_ColorMask( GLboolean red
, GLboolean green
,
909 GLboolean blue
, GLboolean alpha
)
911 GET_CURRENT_CONTEXT(ctx
);
913 FLUSH_VB(ctx
, "dlist");
914 n
= alloc_instruction( ctx
, OPCODE_COLOR_MASK
, 4 );
921 if (ctx
->ExecuteFlag
) {
922 (*ctx
->Exec
->ColorMask
)( red
, green
, blue
, alpha
);
927 static void save_ColorMaterial( GLenum face
, GLenum mode
)
929 GET_CURRENT_CONTEXT(ctx
);
931 FLUSH_VB(ctx
, "dlist");
932 n
= alloc_instruction( ctx
, OPCODE_COLOR_MATERIAL
, 2 );
937 if (ctx
->ExecuteFlag
) {
938 (*ctx
->Exec
->ColorMaterial
)( face
, mode
);
943 static void save_ColorTable( GLenum target
, GLenum internalFormat
,
944 GLsizei width
, GLenum format
, GLenum type
,
945 const GLvoid
*table
)
947 GET_CURRENT_CONTEXT(ctx
);
948 if (target
== GL_PROXY_TEXTURE_1D
||
949 target
== GL_PROXY_TEXTURE_2D
||
950 target
== GL_PROXY_TEXTURE_3D
) {
951 /* execute immediately */
952 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
953 format
, type
, table
);
956 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, table
,
959 FLUSH_VB(ctx
, "dlist");
960 n
= alloc_instruction( ctx
, OPCODE_COLOR_TABLE
, 6 );
963 n
[2].e
= internalFormat
;
972 if (ctx
->ExecuteFlag
) {
973 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
974 format
, type
, table
);
980 static void save_ColorSubTable( GLenum target
, GLsizei start
, GLsizei count
,
981 GLenum format
, GLenum type
,
984 GET_CURRENT_CONTEXT(ctx
);
985 GLvoid
*image
= _mesa_unpack_image(count
, 1, 1, format
, type
, table
,
988 FLUSH_VB(ctx
, "dlist");
989 n
= alloc_instruction( ctx
, OPCODE_COLOR_SUB_TABLE
, 6 );
1001 if (ctx
->ExecuteFlag
) {
1002 (*ctx
->Exec
->ColorSubTable
)(target
, start
, count
, format
, type
, table
);
1008 static void save_CopyPixels( GLint x
, GLint y
,
1009 GLsizei width
, GLsizei height
, GLenum type
)
1011 GET_CURRENT_CONTEXT(ctx
);
1013 FLUSH_VB(ctx
, "dlist");
1014 n
= alloc_instruction( ctx
, OPCODE_COPY_PIXELS
, 5 );
1018 n
[3].i
= (GLint
) width
;
1019 n
[4].i
= (GLint
) height
;
1022 if (ctx
->ExecuteFlag
) {
1023 (*ctx
->Exec
->CopyPixels
)( x
, y
, width
, height
, type
);
1030 save_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
1031 GLint x
, GLint y
, GLsizei width
, GLint border
)
1033 GET_CURRENT_CONTEXT(ctx
);
1035 FLUSH_VB(ctx
, "dlist");
1036 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7 );
1040 n
[3].e
= internalformat
;
1046 if (ctx
->ExecuteFlag
) {
1047 (*ctx
->Exec
->CopyTexImage1D
)( target
, level
, internalformat
,
1048 x
, y
, width
, border
);
1054 save_CopyTexImage2D( GLenum target
, GLint level
,
1055 GLenum internalformat
,
1056 GLint x
, GLint y
, GLsizei width
,
1057 GLsizei height
, GLint border
)
1059 GET_CURRENT_CONTEXT(ctx
);
1061 FLUSH_VB(ctx
, "dlist");
1062 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8 );
1066 n
[3].e
= internalformat
;
1073 if (ctx
->ExecuteFlag
) {
1074 (*ctx
->Exec
->CopyTexImage2D
)( target
, level
, internalformat
,
1075 x
, y
, width
, height
, border
);
1082 save_CopyTexSubImage1D( GLenum target
, GLint level
,
1083 GLint xoffset
, GLint x
, GLint y
,
1086 GET_CURRENT_CONTEXT(ctx
);
1088 FLUSH_VB(ctx
, "dlist");
1089 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6 );
1098 if (ctx
->ExecuteFlag
) {
1099 (*ctx
->Exec
->CopyTexSubImage1D
)( target
, level
, xoffset
, x
, y
, width
);
1105 save_CopyTexSubImage2D( GLenum target
, GLint level
,
1106 GLint xoffset
, GLint yoffset
,
1108 GLsizei width
, GLint height
)
1110 GET_CURRENT_CONTEXT(ctx
);
1112 FLUSH_VB(ctx
, "dlist");
1113 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8 );
1124 if (ctx
->ExecuteFlag
) {
1125 (*ctx
->Exec
->CopyTexSubImage2D
)( target
, level
, xoffset
, yoffset
,
1126 x
, y
, width
, height
);
1132 save_CopyTexSubImage3D( GLenum target
, GLint level
,
1133 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1135 GLsizei width
, GLint height
)
1137 GET_CURRENT_CONTEXT(ctx
);
1139 FLUSH_VB(ctx
, "dlist");
1140 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9 );
1152 if (ctx
->ExecuteFlag
) {
1153 (*ctx
->Exec
->CopyTexSubImage3D
)( target
, level
,
1154 xoffset
, yoffset
, zoffset
,
1155 x
, y
, width
, height
);
1160 static void save_CullFace( GLenum mode
)
1162 GET_CURRENT_CONTEXT(ctx
);
1164 FLUSH_VB(ctx
, "dlist");
1165 n
= alloc_instruction( ctx
, OPCODE_CULL_FACE
, 1 );
1169 if (ctx
->ExecuteFlag
) {
1170 (*ctx
->Exec
->CullFace
)( mode
);
1175 static void save_DepthFunc( GLenum func
)
1177 GET_CURRENT_CONTEXT(ctx
);
1179 FLUSH_VB(ctx
, "dlist");
1180 n
= alloc_instruction( ctx
, OPCODE_DEPTH_FUNC
, 1 );
1184 if (ctx
->ExecuteFlag
) {
1185 (*ctx
->Exec
->DepthFunc
)( func
);
1190 static void save_DepthMask( GLboolean mask
)
1192 GET_CURRENT_CONTEXT(ctx
);
1194 FLUSH_VB(ctx
, "dlist");
1195 n
= alloc_instruction( ctx
, OPCODE_DEPTH_MASK
, 1 );
1199 if (ctx
->ExecuteFlag
) {
1200 (*ctx
->Exec
->DepthMask
)( mask
);
1205 static void save_DepthRange( GLclampd nearval
, GLclampd farval
)
1207 GET_CURRENT_CONTEXT(ctx
);
1209 FLUSH_VB(ctx
, "dlist");
1210 n
= alloc_instruction( ctx
, OPCODE_DEPTH_RANGE
, 2 );
1212 n
[1].f
= (GLfloat
) nearval
;
1213 n
[2].f
= (GLfloat
) farval
;
1215 if (ctx
->ExecuteFlag
) {
1216 (*ctx
->Exec
->DepthRange
)( nearval
, farval
);
1221 static void save_Disable( GLenum cap
)
1223 GET_CURRENT_CONTEXT(ctx
);
1225 FLUSH_VB(ctx
, "dlist");
1226 n
= alloc_instruction( ctx
, OPCODE_DISABLE
, 1 );
1230 if (ctx
->ExecuteFlag
) {
1231 (*ctx
->Exec
->Disable
)( cap
);
1236 static void save_DrawBuffer( GLenum mode
)
1238 GET_CURRENT_CONTEXT(ctx
);
1240 FLUSH_VB(ctx
, "dlist");
1241 n
= alloc_instruction( ctx
, OPCODE_DRAW_BUFFER
, 1 );
1245 if (ctx
->ExecuteFlag
) {
1246 (*ctx
->Exec
->DrawBuffer
)( mode
);
1251 static void save_DrawPixels( GLsizei width
, GLsizei height
,
1252 GLenum format
, GLenum type
,
1253 const GLvoid
*pixels
)
1255 GET_CURRENT_CONTEXT(ctx
);
1256 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
1257 pixels
, &ctx
->Unpack
);
1259 FLUSH_VB(ctx
, "dlist");
1260 n
= alloc_instruction( ctx
, OPCODE_DRAW_PIXELS
, 5 );
1271 if (ctx
->ExecuteFlag
) {
1272 (*ctx
->Exec
->DrawPixels
)( width
, height
, format
, type
, pixels
);
1278 static void save_Enable( GLenum cap
)
1280 GET_CURRENT_CONTEXT(ctx
);
1282 FLUSH_VB(ctx
, "dlist");
1283 n
= alloc_instruction( ctx
, OPCODE_ENABLE
, 1 );
1287 if (ctx
->ExecuteFlag
) {
1288 (*ctx
->Exec
->Enable
)( cap
);
1294 static void save_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
1296 GET_CURRENT_CONTEXT(ctx
);
1298 FLUSH_VB(ctx
, "dlist");
1299 n
= alloc_instruction( ctx
, OPCODE_EVALMESH1
, 3 );
1305 if (ctx
->ExecuteFlag
) {
1306 (*ctx
->Exec
->EvalMesh1
)( mode
, i1
, i2
);
1311 static void save_EvalMesh2(
1312 GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1314 GET_CURRENT_CONTEXT(ctx
);
1316 FLUSH_VB(ctx
, "dlist");
1317 n
= alloc_instruction( ctx
, OPCODE_EVALMESH2
, 5 );
1325 if (ctx
->ExecuteFlag
) {
1326 (*ctx
->Exec
->EvalMesh2
)( mode
, i1
, i2
, j1
, j2
);
1333 static void save_Fogfv( GLenum pname
, const GLfloat
*params
)
1335 GET_CURRENT_CONTEXT(ctx
);
1337 FLUSH_VB(ctx
, "dlist");
1338 n
= alloc_instruction( ctx
, OPCODE_FOG
, 5 );
1346 if (ctx
->ExecuteFlag
) {
1347 (*ctx
->Exec
->Fogfv
)( pname
, params
);
1352 static void save_Fogf( GLenum pname
, GLfloat param
)
1354 save_Fogfv(pname
, ¶m
);
1358 static void save_Fogiv(GLenum pname
, const GLint
*params
)
1363 case GL_FOG_DENSITY
:
1367 p
[0] = (GLfloat
) *params
;
1370 p
[0] = INT_TO_FLOAT( params
[0] );
1371 p
[1] = INT_TO_FLOAT( params
[1] );
1372 p
[2] = INT_TO_FLOAT( params
[2] );
1373 p
[3] = INT_TO_FLOAT( params
[3] );
1376 /* Error will be caught later in gl_Fogfv */
1379 save_Fogfv(pname
, p
);
1383 static void save_Fogi(GLenum pname
, GLint param
)
1385 save_Fogiv(pname
, ¶m
);
1389 static void save_FrontFace( GLenum mode
)
1391 GET_CURRENT_CONTEXT(ctx
);
1393 FLUSH_VB(ctx
, "dlist");
1394 n
= alloc_instruction( ctx
, OPCODE_FRONT_FACE
, 1 );
1398 if (ctx
->ExecuteFlag
) {
1399 (*ctx
->Exec
->FrontFace
)( mode
);
1404 static void save_Frustum( GLdouble left
, GLdouble right
,
1405 GLdouble bottom
, GLdouble top
,
1406 GLdouble nearval
, GLdouble farval
)
1408 GET_CURRENT_CONTEXT(ctx
);
1410 FLUSH_VB(ctx
, "dlist");
1411 n
= alloc_instruction( ctx
, OPCODE_FRUSTUM
, 6 );
1420 if (ctx
->ExecuteFlag
) {
1421 (*ctx
->Exec
->Frustum
)( left
, right
, bottom
, top
, nearval
, farval
);
1426 static void save_Hint( GLenum target
, GLenum mode
)
1428 GET_CURRENT_CONTEXT(ctx
);
1430 FLUSH_VB(ctx
, "dlist");
1431 n
= alloc_instruction( ctx
, OPCODE_HINT
, 2 );
1436 if (ctx
->ExecuteFlag
) {
1437 (*ctx
->Exec
->Hint
)( target
, mode
);
1442 /* GL_PGI_misc_hints*/
1443 static void save_HintPGI( GLenum target
, GLint mode
)
1445 GET_CURRENT_CONTEXT(ctx
);
1447 FLUSH_VB(ctx
, "dlist");
1448 n
= alloc_instruction( ctx
, OPCODE_HINT_PGI
, 2 );
1453 if (ctx
->ExecuteFlag
) {
1454 (*ctx
->Exec
->HintPGI
)( target
, mode
);
1459 static void save_IndexMask( GLuint mask
)
1461 GET_CURRENT_CONTEXT(ctx
);
1463 FLUSH_VB(ctx
, "dlist");
1464 n
= alloc_instruction( ctx
, OPCODE_INDEX_MASK
, 1 );
1468 if (ctx
->ExecuteFlag
) {
1469 (*ctx
->Exec
->IndexMask
)( mask
);
1474 static void save_InitNames( void )
1476 GET_CURRENT_CONTEXT(ctx
);
1477 FLUSH_VB(ctx
, "dlist");
1478 (void) alloc_instruction( ctx
, OPCODE_INIT_NAMES
, 0 );
1479 if (ctx
->ExecuteFlag
) {
1480 (*ctx
->Exec
->InitNames
)();
1485 static void save_Lightfv( GLenum light
, GLenum pname
, const GLfloat
*params
)
1487 GET_CURRENT_CONTEXT(ctx
);
1489 FLUSH_VB(ctx
, "dlist");
1490 n
= alloc_instruction( ctx
, OPCODE_LIGHT
, 6 );
1508 case GL_SPOT_DIRECTION
:
1511 case GL_SPOT_EXPONENT
:
1514 case GL_SPOT_CUTOFF
:
1517 case GL_CONSTANT_ATTENUATION
:
1520 case GL_LINEAR_ATTENUATION
:
1523 case GL_QUADRATIC_ATTENUATION
:
1529 for (i
= 0; i
< nParams
; i
++) {
1530 n
[3+i
].f
= params
[i
];
1533 if (ctx
->ExecuteFlag
) {
1534 (*ctx
->Exec
->Lightfv
)( light
, pname
, params
);
1539 static void save_Lightf( GLenum light
, GLenum pname
, GLfloat params
)
1541 save_Lightfv(light
, pname
, ¶ms
);
1545 static void save_Lightiv( GLenum light
, GLenum pname
, const GLint
*params
)
1552 fparam
[0] = INT_TO_FLOAT( params
[0] );
1553 fparam
[1] = INT_TO_FLOAT( params
[1] );
1554 fparam
[2] = INT_TO_FLOAT( params
[2] );
1555 fparam
[3] = INT_TO_FLOAT( params
[3] );
1558 fparam
[0] = (GLfloat
) params
[0];
1559 fparam
[1] = (GLfloat
) params
[1];
1560 fparam
[2] = (GLfloat
) params
[2];
1561 fparam
[3] = (GLfloat
) params
[3];
1563 case GL_SPOT_DIRECTION
:
1564 fparam
[0] = (GLfloat
) params
[0];
1565 fparam
[1] = (GLfloat
) params
[1];
1566 fparam
[2] = (GLfloat
) params
[2];
1568 case GL_SPOT_EXPONENT
:
1569 case GL_SPOT_CUTOFF
:
1570 case GL_CONSTANT_ATTENUATION
:
1571 case GL_LINEAR_ATTENUATION
:
1572 case GL_QUADRATIC_ATTENUATION
:
1573 fparam
[0] = (GLfloat
) params
[0];
1576 /* error will be caught later in gl_Lightfv */
1579 save_Lightfv( light
, pname
, fparam
);
1583 static void save_Lighti( GLenum light
, GLenum pname
, GLint param
)
1585 save_Lightiv( light
, pname
, ¶m
);
1589 static void save_LightModelfv( GLenum pname
, const GLfloat
*params
)
1591 GET_CURRENT_CONTEXT(ctx
);
1593 FLUSH_VB(ctx
, "dlist");
1594 n
= alloc_instruction( ctx
, OPCODE_LIGHT_MODEL
, 5 );
1602 if (ctx
->ExecuteFlag
) {
1603 (*ctx
->Exec
->LightModelfv
)( pname
, params
);
1608 static void save_LightModelf( GLenum pname
, GLfloat param
)
1610 save_LightModelfv(pname
, ¶m
);
1614 static void save_LightModeliv( GLenum pname
, const GLint
*params
)
1618 case GL_LIGHT_MODEL_AMBIENT
:
1619 fparam
[0] = INT_TO_FLOAT( params
[0] );
1620 fparam
[1] = INT_TO_FLOAT( params
[1] );
1621 fparam
[2] = INT_TO_FLOAT( params
[2] );
1622 fparam
[3] = INT_TO_FLOAT( params
[3] );
1624 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
1625 case GL_LIGHT_MODEL_TWO_SIDE
:
1626 case GL_LIGHT_MODEL_COLOR_CONTROL
:
1627 fparam
[0] = (GLfloat
) params
[0];
1630 /* Error will be caught later in gl_LightModelfv */
1633 save_LightModelfv(pname
, fparam
);
1637 static void save_LightModeli( GLenum pname
, GLint param
)
1639 save_LightModeliv(pname
, ¶m
);
1643 static void save_LineStipple( GLint factor
, GLushort pattern
)
1645 GET_CURRENT_CONTEXT(ctx
);
1647 FLUSH_VB(ctx
, "dlist");
1648 n
= alloc_instruction( ctx
, OPCODE_LINE_STIPPLE
, 2 );
1653 if (ctx
->ExecuteFlag
) {
1654 (*ctx
->Exec
->LineStipple
)( factor
, pattern
);
1659 static void save_LineWidth( GLfloat width
)
1661 GET_CURRENT_CONTEXT(ctx
);
1663 FLUSH_VB(ctx
, "dlist");
1664 n
= alloc_instruction( ctx
, OPCODE_LINE_WIDTH
, 1 );
1668 if (ctx
->ExecuteFlag
) {
1669 (*ctx
->Exec
->LineWidth
)( width
);
1674 static void save_ListBase( GLuint base
)
1676 GET_CURRENT_CONTEXT(ctx
);
1678 FLUSH_VB(ctx
, "dlist");
1679 n
= alloc_instruction( ctx
, OPCODE_LIST_BASE
, 1 );
1683 if (ctx
->ExecuteFlag
) {
1684 (*ctx
->Exec
->ListBase
)( base
);
1689 static void save_LoadIdentity( void )
1691 GET_CURRENT_CONTEXT(ctx
);
1692 FLUSH_VB(ctx
, "dlist");
1693 (void) alloc_instruction( ctx
, OPCODE_LOAD_IDENTITY
, 0 );
1694 if (ctx
->ExecuteFlag
) {
1695 (*ctx
->Exec
->LoadIdentity
)();
1700 static void save_LoadMatrixf( const GLfloat
*m
)
1702 GET_CURRENT_CONTEXT(ctx
);
1704 FLUSH_VB(ctx
, "dlist");
1705 n
= alloc_instruction( ctx
, OPCODE_LOAD_MATRIX
, 16 );
1708 for (i
=0;i
<16;i
++) {
1712 if (ctx
->ExecuteFlag
) {
1713 (*ctx
->Exec
->LoadMatrixf
)( m
);
1718 static void save_LoadMatrixd( const GLdouble
*m
)
1722 for (i
= 0; i
< 16; i
++) {
1725 save_LoadMatrixf(f
);
1729 static void save_LoadName( GLuint name
)
1731 GET_CURRENT_CONTEXT(ctx
);
1733 FLUSH_VB(ctx
, "dlist");
1734 n
= alloc_instruction( ctx
, OPCODE_LOAD_NAME
, 1 );
1738 if (ctx
->ExecuteFlag
) {
1739 (*ctx
->Exec
->LoadName
)( name
);
1744 static void save_LogicOp( GLenum opcode
)
1746 GET_CURRENT_CONTEXT(ctx
);
1748 FLUSH_VB(ctx
, "dlist");
1749 n
= alloc_instruction( ctx
, OPCODE_LOGIC_OP
, 1 );
1753 if (ctx
->ExecuteFlag
) {
1754 (*ctx
->Exec
->LogicOp
)( opcode
);
1759 static void save_Map1d( GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
1760 GLint order
, const GLdouble
*points
)
1762 GET_CURRENT_CONTEXT(ctx
);
1764 FLUSH_VB(ctx
, "dlist");
1765 n
= alloc_instruction( ctx
, OPCODE_MAP1
, 6 );
1767 GLfloat
*pnts
= gl_copy_map_points1d( target
, stride
, order
, points
);
1771 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
1773 n
[6].data
= (void *) pnts
;
1775 if (ctx
->ExecuteFlag
) {
1776 (*ctx
->Exec
->Map1d
)( target
, u1
, u2
, stride
, order
, points
);
1780 static void save_Map1f( GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
1781 GLint order
, const GLfloat
*points
)
1783 GET_CURRENT_CONTEXT(ctx
);
1785 FLUSH_VB(ctx
, "dlist");
1786 n
= alloc_instruction( ctx
, OPCODE_MAP1
, 6 );
1788 GLfloat
*pnts
= gl_copy_map_points1f( target
, stride
, order
, points
);
1792 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
1794 n
[6].data
= (void *) pnts
;
1796 if (ctx
->ExecuteFlag
) {
1797 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, stride
, order
, points
);
1802 static void save_Map2d( GLenum target
,
1803 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
1804 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
1805 const GLdouble
*points
)
1807 GET_CURRENT_CONTEXT(ctx
);
1809 FLUSH_VB(ctx
, "dlist");
1810 n
= alloc_instruction( ctx
, OPCODE_MAP2
, 10 );
1812 GLfloat
*pnts
= gl_copy_map_points2d( target
, ustride
, uorder
,
1813 vstride
, vorder
, points
);
1819 /* XXX verify these strides are correct */
1820 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
1821 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
1824 n
[10].data
= (void *) pnts
;
1826 if (ctx
->ExecuteFlag
) {
1827 (*ctx
->Exec
->Map2d
)( target
,
1828 u1
, u2
, ustride
, uorder
,
1829 v1
, v2
, vstride
, vorder
, points
);
1834 static void save_Map2f( GLenum target
,
1835 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
1836 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
1837 const GLfloat
*points
)
1839 GET_CURRENT_CONTEXT(ctx
);
1841 FLUSH_VB(ctx
, "dlist");
1842 n
= alloc_instruction( ctx
, OPCODE_MAP2
, 10 );
1844 GLfloat
*pnts
= gl_copy_map_points2f( target
, ustride
, uorder
,
1845 vstride
, vorder
, points
);
1851 /* XXX verify these strides are correct */
1852 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
1853 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
1856 n
[10].data
= (void *) pnts
;
1858 if (ctx
->ExecuteFlag
) {
1859 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
1860 v1
, v2
, vstride
, vorder
, points
);
1865 static void save_MapGrid1f( GLint un
, GLfloat u1
, GLfloat u2
)
1867 GET_CURRENT_CONTEXT(ctx
);
1869 FLUSH_VB(ctx
, "dlist");
1870 n
= alloc_instruction( ctx
, OPCODE_MAPGRID1
, 3 );
1876 if (ctx
->ExecuteFlag
) {
1877 (*ctx
->Exec
->MapGrid1f
)( un
, u1
, u2
);
1882 static void save_MapGrid1d( GLint un
, GLdouble u1
, GLdouble u2
)
1884 save_MapGrid1f(un
, u1
, u2
);
1888 static void save_MapGrid2f( GLint un
, GLfloat u1
, GLfloat u2
,
1889 GLint vn
, GLfloat v1
, GLfloat v2
)
1891 GET_CURRENT_CONTEXT(ctx
);
1893 FLUSH_VB(ctx
, "dlist");
1894 n
= alloc_instruction( ctx
, OPCODE_MAPGRID2
, 6 );
1903 if (ctx
->ExecuteFlag
) {
1904 (*ctx
->Exec
->MapGrid2f
)( un
, u1
, u2
, vn
, v1
, v2
);
1910 static void save_MapGrid2d( GLint un
, GLdouble u1
, GLdouble u2
,
1911 GLint vn
, GLdouble v1
, GLdouble v2
)
1913 save_MapGrid2f(un
, u1
, u2
, vn
, v1
, v2
);
1917 static void save_MatrixMode( GLenum mode
)
1919 GET_CURRENT_CONTEXT(ctx
);
1921 FLUSH_VB(ctx
, "dlist");
1922 n
= alloc_instruction( ctx
, OPCODE_MATRIX_MODE
, 1 );
1926 if (ctx
->ExecuteFlag
) {
1927 (*ctx
->Exec
->MatrixMode
)( mode
);
1932 static void save_MultMatrixf( const GLfloat
*m
)
1934 GET_CURRENT_CONTEXT(ctx
);
1936 FLUSH_VB(ctx
, "dlist");
1937 n
= alloc_instruction( ctx
, OPCODE_MULT_MATRIX
, 16 );
1940 for (i
=0;i
<16;i
++) {
1944 if (ctx
->ExecuteFlag
) {
1945 (*ctx
->Exec
->MultMatrixf
)( m
);
1950 static void save_MultMatrixd( const GLdouble
*m
)
1954 for (i
= 0; i
< 16; i
++) {
1957 save_MultMatrixf(f
);
1961 static void save_NewList( GLuint list
, GLenum mode
)
1963 GET_CURRENT_CONTEXT(ctx
);
1964 /* It's an error to call this function while building a display list */
1965 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
1972 static void save_Ortho( GLdouble left
, GLdouble right
,
1973 GLdouble bottom
, GLdouble top
,
1974 GLdouble nearval
, GLdouble farval
)
1976 GET_CURRENT_CONTEXT(ctx
);
1978 FLUSH_VB(ctx
, "dlist");
1979 n
= alloc_instruction( ctx
, OPCODE_ORTHO
, 6 );
1988 if (ctx
->ExecuteFlag
) {
1989 (*ctx
->Exec
->Ortho
)( left
, right
, bottom
, top
, nearval
, farval
);
1994 static void save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
1996 GET_CURRENT_CONTEXT(ctx
);
1998 FLUSH_VB(ctx
, "dlist");
1999 n
= alloc_instruction( ctx
, OPCODE_PIXEL_MAP
, 3 );
2003 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
2004 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
2006 if (ctx
->ExecuteFlag
) {
2007 (*ctx
->Exec
->PixelMapfv
)( map
, mapsize
, values
);
2012 static void save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2014 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2016 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2017 for (i
=0;i
<mapsize
;i
++) {
2018 fvalues
[i
] = (GLfloat
) values
[i
];
2022 for (i
=0;i
<mapsize
;i
++) {
2023 fvalues
[i
] = UINT_TO_FLOAT( values
[i
] );
2026 save_PixelMapfv(map
, mapsize
, fvalues
);
2030 static void save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2032 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2034 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2035 for (i
=0;i
<mapsize
;i
++) {
2036 fvalues
[i
] = (GLfloat
) values
[i
];
2040 for (i
=0;i
<mapsize
;i
++) {
2041 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2044 save_PixelMapfv(map
, mapsize
, fvalues
);
2048 static void save_PixelTransferf( GLenum pname
, GLfloat param
)
2050 GET_CURRENT_CONTEXT(ctx
);
2052 FLUSH_VB(ctx
, "dlist");
2053 n
= alloc_instruction( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2058 if (ctx
->ExecuteFlag
) {
2059 (*ctx
->Exec
->PixelTransferf
)( pname
, param
);
2064 static void save_PixelTransferi( GLenum pname
, GLint param
)
2066 save_PixelTransferf( pname
, (GLfloat
) param
);
2070 static void save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2072 GET_CURRENT_CONTEXT(ctx
);
2074 FLUSH_VB(ctx
, "dlist");
2075 n
= alloc_instruction( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2080 if (ctx
->ExecuteFlag
) {
2081 (*ctx
->Exec
->PixelZoom
)( xfactor
, yfactor
);
2086 static void save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2088 GET_CURRENT_CONTEXT(ctx
);
2090 FLUSH_VB(ctx
, "dlist");
2091 n
= alloc_instruction( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2098 if (ctx
->ExecuteFlag
) {
2099 (*ctx
->Exec
->PointParameterfvEXT
)( pname
, params
);
2104 static void save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2106 save_PointParameterfvEXT(pname
, ¶m
);
2110 static void save_PointSize( GLfloat size
)
2112 GET_CURRENT_CONTEXT(ctx
);
2114 FLUSH_VB(ctx
, "dlist");
2115 n
= alloc_instruction( ctx
, OPCODE_POINT_SIZE
, 1 );
2119 if (ctx
->ExecuteFlag
) {
2120 (*ctx
->Exec
->PointSize
)( size
);
2125 static void save_PolygonMode( GLenum face
, GLenum mode
)
2127 GET_CURRENT_CONTEXT(ctx
);
2129 FLUSH_VB(ctx
, "dlist");
2130 n
= alloc_instruction( ctx
, OPCODE_POLYGON_MODE
, 2 );
2135 if (ctx
->ExecuteFlag
) {
2136 (*ctx
->Exec
->PolygonMode
)( face
, mode
);
2142 * Polygon stipple must have been upacked already!
2144 static void save_PolygonStipple( const GLubyte
*pattern
)
2146 GET_CURRENT_CONTEXT(ctx
);
2148 FLUSH_VB(ctx
, "dlist");
2149 n
= alloc_instruction( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2152 n
[1].data
= MALLOC( 32 * 4 );
2153 data
= n
[1].data
; /* This needed for Acorn compiler */
2154 MEMCPY( data
, pattern
, 32 * 4 );
2156 if (ctx
->ExecuteFlag
) {
2157 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) pattern
);
2162 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2164 GET_CURRENT_CONTEXT(ctx
);
2166 FLUSH_VB(ctx
, "dlist");
2167 n
= alloc_instruction( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2172 if (ctx
->ExecuteFlag
) {
2173 (*ctx
->Exec
->PolygonOffset
)( factor
, units
);
2178 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2180 GET_CURRENT_CONTEXT(ctx
);
2181 save_PolygonOffset(factor
, ctx
->Visual
->DepthMaxF
* bias
);
2185 static void save_PopAttrib( void )
2187 GET_CURRENT_CONTEXT(ctx
);
2188 FLUSH_VB(ctx
, "dlist");
2189 (void) alloc_instruction( ctx
, OPCODE_POP_ATTRIB
, 0 );
2190 if (ctx
->ExecuteFlag
) {
2191 (*ctx
->Exec
->PopAttrib
)();
2196 static void save_PopMatrix( void )
2198 GET_CURRENT_CONTEXT(ctx
);
2199 FLUSH_VB(ctx
, "dlist");
2200 (void) alloc_instruction( ctx
, OPCODE_POP_MATRIX
, 0 );
2201 if (ctx
->ExecuteFlag
) {
2202 (*ctx
->Exec
->PopMatrix
)();
2207 static void save_PopName( void )
2209 GET_CURRENT_CONTEXT(ctx
);
2210 FLUSH_VB(ctx
, "dlist");
2211 (void) alloc_instruction( ctx
, OPCODE_POP_NAME
, 0 );
2212 if (ctx
->ExecuteFlag
) {
2213 (*ctx
->Exec
->PopName
)();
2218 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2219 const GLclampf
*priorities
)
2221 GET_CURRENT_CONTEXT(ctx
);
2223 FLUSH_VB(ctx
, "dlist");
2225 for (i
=0;i
<num
;i
++) {
2227 n
= alloc_instruction( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2229 n
[1].ui
= textures
[i
];
2230 n
[2].f
= priorities
[i
];
2233 if (ctx
->ExecuteFlag
) {
2234 (*ctx
->Exec
->PrioritizeTextures
)( num
, textures
, priorities
);
2239 static void save_PushAttrib( GLbitfield mask
)
2241 GET_CURRENT_CONTEXT(ctx
);
2243 FLUSH_VB(ctx
, "dlist");
2244 n
= alloc_instruction( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2248 if (ctx
->ExecuteFlag
) {
2249 (*ctx
->Exec
->PushAttrib
)( mask
);
2254 static void save_PushMatrix( void )
2256 GET_CURRENT_CONTEXT(ctx
);
2257 FLUSH_VB(ctx
, "dlist");
2258 (void) alloc_instruction( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2259 if (ctx
->ExecuteFlag
) {
2260 (*ctx
->Exec
->PushMatrix
)();
2265 static void save_PushName( GLuint name
)
2267 GET_CURRENT_CONTEXT(ctx
);
2269 FLUSH_VB(ctx
, "dlist");
2270 n
= alloc_instruction( ctx
, OPCODE_PUSH_NAME
, 1 );
2274 if (ctx
->ExecuteFlag
) {
2275 (*ctx
->Exec
->PushName
)( name
);
2280 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2282 GET_CURRENT_CONTEXT(ctx
);
2284 FLUSH_VB(ctx
, "dlist");
2285 n
= alloc_instruction( ctx
, OPCODE_RASTER_POS
, 4 );
2292 if (ctx
->ExecuteFlag
) {
2293 (*ctx
->Exec
->RasterPos4f
)( x
, y
, z
, w
);
2297 static void save_RasterPos2d(GLdouble x
, GLdouble y
)
2299 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2302 static void save_RasterPos2f(GLfloat x
, GLfloat y
)
2304 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2307 static void save_RasterPos2i(GLint x
, GLint y
)
2309 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2312 static void save_RasterPos2s(GLshort x
, GLshort y
)
2314 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2317 static void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2319 save_RasterPos4f(x
, y
, z
, 1.0F
);
2322 static void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2324 save_RasterPos4f(x
, y
, z
, 1.0F
);
2327 static void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2329 save_RasterPos4f(x
, y
, z
, 1.0F
);
2332 static void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2334 save_RasterPos4f(x
, y
, z
, 1.0F
);
2337 static void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2339 save_RasterPos4f(x
, y
, z
, w
);
2342 static void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2344 save_RasterPos4f(x
, y
, z
, w
);
2347 static void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2349 save_RasterPos4f(x
, y
, z
, w
);
2352 static void save_RasterPos2dv(const GLdouble
*v
)
2354 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2357 static void save_RasterPos2fv(const GLfloat
*v
)
2359 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2362 static void save_RasterPos2iv(const GLint
*v
)
2364 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2367 static void save_RasterPos2sv(const GLshort
*v
)
2369 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2372 static void save_RasterPos3dv(const GLdouble
*v
)
2374 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2377 static void save_RasterPos3fv(const GLfloat
*v
)
2379 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2382 static void save_RasterPos3iv(const GLint
*v
)
2384 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2387 static void save_RasterPos3sv(const GLshort
*v
)
2389 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2392 static void save_RasterPos4dv(const GLdouble
*v
)
2394 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2397 static void save_RasterPos4fv(const GLfloat
*v
)
2399 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2402 static void save_RasterPos4iv(const GLint
*v
)
2404 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2407 static void save_RasterPos4sv(const GLshort
*v
)
2409 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2413 static void save_PassThrough( GLfloat token
)
2415 GET_CURRENT_CONTEXT(ctx
);
2417 FLUSH_VB(ctx
, "dlist");
2418 n
= alloc_instruction( ctx
, OPCODE_PASSTHROUGH
, 1 );
2422 if (ctx
->ExecuteFlag
) {
2423 (*ctx
->Exec
->PassThrough
)( token
);
2428 static void save_ReadBuffer( GLenum mode
)
2430 GET_CURRENT_CONTEXT(ctx
);
2432 FLUSH_VB(ctx
, "dlist");
2433 n
= alloc_instruction( ctx
, OPCODE_READ_BUFFER
, 1 );
2437 if (ctx
->ExecuteFlag
) {
2438 (*ctx
->Exec
->ReadBuffer
)( mode
);
2443 static void save_Rectf( GLfloat x1
, GLfloat y1
, GLfloat x2
, GLfloat y2
)
2445 GET_CURRENT_CONTEXT(ctx
);
2447 FLUSH_VB(ctx
, "dlist");
2448 n
= alloc_instruction( ctx
, OPCODE_RECTF
, 4 );
2455 if (ctx
->ExecuteFlag
) {
2456 (*ctx
->Exec
->Rectf
)( x1
, y1
, x2
, y2
);
2460 static void save_Rectd(GLdouble x1
, GLdouble y1
, GLdouble x2
, GLdouble y2
)
2462 save_Rectf(x1
, y1
, x2
, y2
);
2465 static void save_Rectdv(const GLdouble
*v1
, const GLdouble
*v2
)
2467 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2470 static void save_Rectfv( const GLfloat
*v1
, const GLfloat
*v2
)
2472 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2475 static void save_Recti(GLint x1
, GLint y1
, GLint x2
, GLint y2
)
2477 save_Rectf(x1
, y1
, x2
, y2
);
2480 static void save_Rectiv(const GLint
*v1
, const GLint
*v2
)
2482 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2485 static void save_Rects(GLshort x1
, GLshort y1
, GLshort x2
, GLshort y2
)
2487 save_Rectf(x1
, y1
, x2
, y2
);
2490 static void save_Rectsv(const GLshort
*v1
, const GLshort
*v2
)
2492 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2496 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2499 gl_rotation_matrix( angle
, x
, y
, z
, m
);
2500 save_MultMatrixf( m
); /* save and maybe execute */
2504 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2506 save_Rotatef(angle
, x
, y
, z
);
2510 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2512 GET_CURRENT_CONTEXT(ctx
);
2514 FLUSH_VB(ctx
, "dlist");
2515 n
= alloc_instruction( ctx
, OPCODE_SCALE
, 3 );
2521 if (ctx
->ExecuteFlag
) {
2522 (*ctx
->Exec
->Scalef
)( x
, y
, z
);
2527 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
2529 save_Scalef(x
, y
, z
);
2533 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
2535 GET_CURRENT_CONTEXT(ctx
);
2537 FLUSH_VB(ctx
, "dlist");
2538 n
= alloc_instruction( ctx
, OPCODE_SCISSOR
, 4 );
2545 if (ctx
->ExecuteFlag
) {
2546 (*ctx
->Exec
->Scissor
)( x
, y
, width
, height
);
2551 static void save_ShadeModel( GLenum mode
)
2553 GET_CURRENT_CONTEXT(ctx
);
2555 FLUSH_VB(ctx
, "dlist");
2556 n
= alloc_instruction( ctx
, OPCODE_SHADE_MODEL
, 1 );
2560 if (ctx
->ExecuteFlag
) {
2561 (*ctx
->Exec
->ShadeModel
)( mode
);
2566 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
2568 GET_CURRENT_CONTEXT(ctx
);
2570 FLUSH_VB(ctx
, "dlist");
2571 n
= alloc_instruction( ctx
, OPCODE_STENCIL_FUNC
, 3 );
2577 if (ctx
->ExecuteFlag
) {
2578 (*ctx
->Exec
->StencilFunc
)( func
, ref
, mask
);
2583 static void save_StencilMask( GLuint mask
)
2585 GET_CURRENT_CONTEXT(ctx
);
2587 FLUSH_VB(ctx
, "dlist");
2588 n
= alloc_instruction( ctx
, OPCODE_STENCIL_MASK
, 1 );
2592 if (ctx
->ExecuteFlag
) {
2593 (*ctx
->Exec
->StencilMask
)( mask
);
2598 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
2600 GET_CURRENT_CONTEXT(ctx
);
2602 FLUSH_VB(ctx
, "dlist");
2603 n
= alloc_instruction( ctx
, OPCODE_STENCIL_OP
, 3 );
2609 if (ctx
->ExecuteFlag
) {
2610 (*ctx
->Exec
->StencilOp
)( fail
, zfail
, zpass
);
2615 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
2617 GET_CURRENT_CONTEXT(ctx
);
2619 FLUSH_VB(ctx
, "dlist");
2620 n
= alloc_instruction( ctx
, OPCODE_TEXENV
, 6 );
2629 if (ctx
->ExecuteFlag
) {
2630 (*ctx
->Exec
->TexEnvfv
)( target
, pname
, params
);
2635 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
2637 save_TexEnvfv( target
, pname
, ¶m
);
2641 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
2644 p
[0] = (GLfloat
) param
;
2645 p
[1] = p
[2] = p
[3] = 0.0;
2646 save_TexEnvfv( target
, pname
, p
);
2650 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
2653 p
[0] = INT_TO_FLOAT( param
[0] );
2654 p
[1] = INT_TO_FLOAT( param
[1] );
2655 p
[2] = INT_TO_FLOAT( param
[2] );
2656 p
[3] = INT_TO_FLOAT( param
[3] );
2657 save_TexEnvfv( target
, pname
, p
);
2661 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
2663 GET_CURRENT_CONTEXT(ctx
);
2665 FLUSH_VB(ctx
, "dlist");
2666 n
= alloc_instruction( ctx
, OPCODE_TEXGEN
, 6 );
2675 if (ctx
->ExecuteFlag
) {
2676 (*ctx
->Exec
->TexGenfv
)( coord
, pname
, params
);
2681 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
2688 save_TexGenfv(coord
, pname
, p
);
2692 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
2694 GLfloat p
= (GLfloat
) param
;
2695 save_TexGenfv( coord
, pname
, &p
);
2699 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
2706 save_TexGenfv( coord
, pname
, p
);
2710 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
2712 save_TexGenfv(coord
, pname
, ¶m
);
2716 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
2718 save_TexGeniv( coord
, pname
, ¶m
);
2722 static void save_TexParameterfv( GLenum target
,
2723 GLenum pname
, const GLfloat
*params
)
2725 GET_CURRENT_CONTEXT(ctx
);
2727 FLUSH_VB(ctx
, "dlist");
2728 n
= alloc_instruction( ctx
, OPCODE_TEXPARAMETER
, 6 );
2737 if (ctx
->ExecuteFlag
) {
2738 (*ctx
->Exec
->TexParameterfv
)( target
, pname
, params
);
2743 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
2745 save_TexParameterfv(target
, pname
, ¶m
);
2749 static void save_TexParameteri( GLenum target
, GLenum pname
, const GLint param
)
2752 fparam
[0] = (GLfloat
) param
;
2753 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
2754 save_TexParameterfv(target
, pname
, fparam
);
2758 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
2761 fparam
[0] = (GLfloat
) params
[0];
2762 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
2763 save_TexParameterfv(target
, pname
, fparam
);
2767 static void save_TexImage1D( GLenum target
,
2768 GLint level
, GLint components
,
2769 GLsizei width
, GLint border
,
2770 GLenum format
, GLenum type
,
2771 const GLvoid
*pixels
)
2773 GET_CURRENT_CONTEXT(ctx
);
2774 if (target
== GL_PROXY_TEXTURE_1D
) {
2775 /* don't compile, execute immediately */
2776 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
2777 border
, format
, type
, pixels
);
2780 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
2781 pixels
, &ctx
->Unpack
);
2783 FLUSH_VB(ctx
, "dlist");
2784 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
2788 n
[3].i
= components
;
2789 n
[4].i
= (GLint
) width
;
2798 if (ctx
->ExecuteFlag
) {
2799 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
2800 border
, format
, type
, pixels
);
2806 static void save_TexImage2D( GLenum target
,
2807 GLint level
, GLint components
,
2808 GLsizei width
, GLsizei height
, GLint border
,
2809 GLenum format
, GLenum type
,
2810 const GLvoid
*pixels
)
2812 GET_CURRENT_CONTEXT(ctx
);
2813 if (target
== GL_PROXY_TEXTURE_2D
) {
2814 /* don't compile, execute immediately */
2815 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
2816 height
, border
, format
, type
, pixels
);
2819 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
2820 pixels
, &ctx
->Unpack
);
2822 FLUSH_VB(ctx
, "dlist");
2823 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
2827 n
[3].i
= components
;
2828 n
[4].i
= (GLint
) width
;
2829 n
[5].i
= (GLint
) height
;
2838 if (ctx
->ExecuteFlag
) {
2839 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
2840 height
, border
, format
, type
, pixels
);
2846 static void save_TexImage3D( GLenum target
,
2847 GLint level
, GLint components
,
2848 GLsizei width
, GLsizei height
, GLsizei depth
,
2850 GLenum format
, GLenum type
,
2851 const GLvoid
*pixels
)
2853 GET_CURRENT_CONTEXT(ctx
);
2854 if (target
== GL_PROXY_TEXTURE_3D
) {
2855 /* don't compile, execute immediately */
2856 (*ctx
->Exec
->TexImage3D
)( target
, level
, components
, width
,
2857 height
, depth
, border
, format
, type
, pixels
);
2861 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
2862 pixels
, &ctx
->Unpack
);
2863 FLUSH_VB(ctx
, "dlist");
2864 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
2868 n
[3].i
= components
;
2869 n
[4].i
= (GLint
) width
;
2870 n
[5].i
= (GLint
) height
;
2871 n
[6].i
= (GLint
) depth
;
2880 if (ctx
->ExecuteFlag
) {
2881 (*ctx
->Exec
->TexImage3D
)( target
, level
, components
, width
,
2882 height
, depth
, border
, format
, type
, pixels
);
2888 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
2889 GLsizei width
, GLenum format
, GLenum type
,
2890 const GLvoid
*pixels
)
2892 GET_CURRENT_CONTEXT(ctx
);
2894 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
2895 pixels
, &ctx
->Unpack
);
2896 FLUSH_VB(ctx
, "dlist");
2897 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
2902 n
[4].i
= (GLint
) width
;
2910 if (ctx
->ExecuteFlag
) {
2911 (*ctx
->Exec
->TexSubImage1D
)( target
, level
, xoffset
, width
,
2912 format
, type
, pixels
);
2917 static void save_TexSubImage2D( GLenum target
, GLint level
,
2918 GLint xoffset
, GLint yoffset
,
2919 GLsizei width
, GLsizei height
,
2920 GLenum format
, GLenum type
,
2921 const GLvoid
*pixels
)
2923 GET_CURRENT_CONTEXT(ctx
);
2925 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
2926 pixels
, &ctx
->Unpack
);
2927 FLUSH_VB(ctx
, "dlist");
2928 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
2934 n
[5].i
= (GLint
) width
;
2935 n
[6].i
= (GLint
) height
;
2943 if (ctx
->ExecuteFlag
) {
2944 (*ctx
->Exec
->TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
2945 width
, height
, format
, type
, pixels
);
2950 static void save_TexSubImage3D( GLenum target
, GLint level
,
2951 GLint xoffset
, GLint yoffset
,GLint zoffset
,
2952 GLsizei width
, GLsizei height
, GLsizei depth
,
2953 GLenum format
, GLenum type
,
2954 const GLvoid
*pixels
)
2956 GET_CURRENT_CONTEXT(ctx
);
2958 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
2959 pixels
, &ctx
->Unpack
);
2960 FLUSH_VB(ctx
, "dlist");
2961 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
2968 n
[6].i
= (GLint
) width
;
2969 n
[7].i
= (GLint
) height
;
2970 n
[8].i
= (GLint
) depth
;
2978 if (ctx
->ExecuteFlag
) {
2979 (*ctx
->Exec
->TexSubImage3D
)( target
, level
,
2980 xoffset
, yoffset
, zoffset
,
2981 width
, height
, depth
, format
, type
, pixels
);
2986 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
2988 GET_CURRENT_CONTEXT(ctx
);
2990 FLUSH_VB(ctx
, "dlist");
2991 n
= alloc_instruction( ctx
, OPCODE_TRANSLATE
, 3 );
2997 if (ctx
->ExecuteFlag
) {
2998 (*ctx
->Exec
->Translatef
)( x
, y
, z
);
3003 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3005 save_Translatef(x
, y
, z
);
3010 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3012 GET_CURRENT_CONTEXT(ctx
);
3014 FLUSH_VB(ctx
, "dlist");
3015 n
= alloc_instruction( ctx
, OPCODE_VIEWPORT
, 4 );
3019 n
[3].i
= (GLint
) width
;
3020 n
[4].i
= (GLint
) height
;
3022 if (ctx
->ExecuteFlag
) {
3023 (*ctx
->Exec
->Viewport
)( x
, y
, width
, height
);
3028 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3030 GET_CURRENT_CONTEXT(ctx
);
3032 FLUSH_VB(ctx
, "dlist");
3033 n
= alloc_instruction( ctx
, OPCODE_WINDOW_POS
, 4 );
3040 if (ctx
->ExecuteFlag
) {
3041 (*ctx
->Exec
->WindowPos4fMESA
)( x
, y
, z
, w
);
3045 static void save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3047 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3050 static void save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3052 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3055 static void save_WindowPos2iMESA(GLint x
, GLint y
)
3057 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3060 static void save_WindowPos2sMESA(GLshort x
, GLshort y
)
3062 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3065 static void save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3067 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3070 static void save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3072 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3075 static void save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3077 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3080 static void save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3082 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3085 static void save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3087 save_WindowPos4fMESA(x
, y
, z
, w
);
3090 static void save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3092 save_WindowPos4fMESA(x
, y
, z
, w
);
3095 static void save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3097 save_WindowPos4fMESA(x
, y
, z
, w
);
3100 static void save_WindowPos2dvMESA(const GLdouble
*v
)
3102 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3105 static void save_WindowPos2fvMESA(const GLfloat
*v
)
3107 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3110 static void save_WindowPos2ivMESA(const GLint
*v
)
3112 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3115 static void save_WindowPos2svMESA(const GLshort
*v
)
3117 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3120 static void save_WindowPos3dvMESA(const GLdouble
*v
)
3122 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3125 static void save_WindowPos3fvMESA(const GLfloat
*v
)
3127 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3130 static void save_WindowPos3ivMESA(const GLint
*v
)
3132 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3135 static void save_WindowPos3svMESA(const GLshort
*v
)
3137 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3140 static void save_WindowPos4dvMESA(const GLdouble
*v
)
3142 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3145 static void save_WindowPos4fvMESA(const GLfloat
*v
)
3147 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3150 static void save_WindowPos4ivMESA(const GLint
*v
)
3152 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3155 static void save_WindowPos4svMESA(const GLshort
*v
)
3157 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3162 /* GL_ARB_multitexture */
3163 static void save_ActiveTextureARB( GLenum target
)
3165 GET_CURRENT_CONTEXT(ctx
);
3167 FLUSH_VB(ctx
, "dlist");
3168 n
= alloc_instruction( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3172 if (ctx
->ExecuteFlag
) {
3173 (*ctx
->Exec
->ActiveTextureARB
)( target
);
3178 /* GL_ARB_multitexture */
3179 static void save_ClientActiveTextureARB( GLenum target
)
3181 GET_CURRENT_CONTEXT(ctx
);
3183 FLUSH_VB(ctx
, "dlist");
3184 n
= alloc_instruction( ctx
, OPCODE_CLIENT_ACTIVE_TEXTURE
, 1 );
3188 if (ctx
->ExecuteFlag
) {
3189 (*ctx
->Exec
->ClientActiveTextureARB
)( target
);
3195 static void save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3198 gl_matrix_transposed(tm
, m
);
3199 save_LoadMatrixd(tm
);
3203 static void save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3206 gl_matrix_transposef(tm
, m
);
3207 save_LoadMatrixf(tm
);
3211 static void save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3214 gl_matrix_transposed(tm
, m
);
3215 save_MultMatrixd(tm
);
3219 static void save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3222 gl_matrix_transposef(tm
, m
);
3223 save_MultMatrixf(tm
);
3228 void gl_compile_cassette( GLcontext
*ctx
)
3230 Node
*n
= alloc_instruction( ctx
, OPCODE_VERTEX_CASSETTE
, 8 );
3231 struct immediate
*im
= ctx
->input
;
3237 /* Do some easy optimizations of the cassette.
3240 if (0 && im
->v
.Obj
.size
< 4 && im
->Count
> 15) {
3241 im
->Bounds
= (GLfloat (*)[3]) MALLOC(6 * sizeof(GLfloat
));
3242 (gl_calc_bound_tab
[im
->v
.Obj
.size
])( im
->Bounds
, &im
->v
.Obj
);
3246 n
[1].data
= (void *)im
;
3247 n
[2].ui
= im
->Start
;
3248 n
[3].ui
= im
->Count
;
3249 n
[4].ui
= im
->BeginState
;
3250 n
[5].ui
= im
->OrFlag
;
3251 n
[6].ui
= im
->AndFlag
;
3252 n
[7].ui
= im
->LastData
;
3253 n
[8].ui
= im
->LastPrimitive
;
3255 if (im
->Count
> VB_MAX
- 4) {
3257 struct immediate
*new_im
= gl_immediate_alloc(ctx
);
3258 if (!new_im
) return;
3259 SET_IMMEDIATE( ctx
, new_im
);
3260 gl_reset_input( ctx
);
3264 im
->Start
= im
->Count
; /* don't clear anything in reset_input */
3267 im
->Primitive
[im
->Start
] = ctx
->Current
.Primitive
;
3268 im
->LastPrimitive
= im
->Start
;
3269 im
->BeginState
= VERT_BEGIN_0
;
3274 fprintf(stderr
, "in compile_cassette, BeginState is %x\n",
3279 /* KW: Compile commands
3281 * Will appear in the list before the vertex buffer containing the
3282 * command that provoked the error. I don't see this as a problem.
3284 void gl_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
3287 n
= alloc_instruction( ctx
, OPCODE_ERROR
, 2 );
3290 n
[2].data
= (void *) s
;
3292 /* execute already done */
3297 islist(GLcontext
*ctx
, GLuint list
)
3299 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
3309 /**********************************************************************/
3310 /* Display list execution */
3311 /**********************************************************************/
3315 * Execute a display list. Note that the ListBase offset must have already
3316 * been added before calling this function. I.e. the list argument is
3317 * the absolute list number, not relative to ListBase.
3318 * Input: list - display list number
3320 static void execute_list( GLcontext
*ctx
, GLuint list
)
3326 if (!islist(ctx
,list
))
3329 /* mesa_print_display_list( list ); */
3333 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
3337 opcode
= n
[0].opcode
;
3341 gl_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
3343 case OPCODE_VERTEX_CASSETTE
: {
3344 struct immediate
*IM
;
3347 gl_update_state(ctx
);
3348 if (ctx
->CompileCVAFlag
) {
3349 ctx
->CompileCVAFlag
= 0;
3350 ctx
->CVA
.elt
.pipeline_valid
= 0;
3352 if (!ctx
->CVA
.elt
.pipeline_valid
)
3353 gl_build_immediate_pipeline( ctx
);
3356 IM
= (struct immediate
*) n
[1].data
;
3357 IM
->Start
= n
[2].ui
;
3358 IM
->Count
= n
[3].ui
;
3359 IM
->BeginState
= n
[4].ui
;
3360 IM
->OrFlag
= n
[5].ui
;
3361 IM
->AndFlag
= n
[6].ui
;
3362 IM
->LastData
= n
[7].ui
;
3363 IM
->LastPrimitive
= n
[8].ui
;
3365 if ((MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
) &&
3366 (MESA_VERBOSE
& VERBOSE_IMMEDIATE
))
3367 gl_print_cassette( (struct immediate
*) n
[1].data
);
3369 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
) {
3370 fprintf(stderr
, "Run cassette %d, rows %d..%d, beginstate %x ",
3372 IM
->Start
, IM
->Count
, IM
->BeginState
);
3373 gl_print_vert_flags("orflag", IM
->OrFlag
);
3376 gl_fixup_cassette( ctx
, (struct immediate
*) n
[1].data
);
3377 gl_execute_cassette( ctx
, (struct immediate
*) n
[1].data
);
3381 (*ctx
->Exec
->Accum
)( n
[1].e
, n
[2].f
);
3383 case OPCODE_ALPHA_FUNC
:
3384 (*ctx
->Exec
->AlphaFunc
)( n
[1].e
, n
[2].f
);
3386 case OPCODE_BIND_TEXTURE
:
3387 (*ctx
->Exec
->BindTexture
)( n
[1].e
, n
[2].ui
);
3391 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3392 ctx
->Unpack
= _mesa_native_packing
;
3393 (*ctx
->Exec
->Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
3394 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (const GLubyte
*) n
[7].data
);
3395 ctx
->Unpack
= save
; /* restore */
3398 case OPCODE_BLEND_COLOR
:
3399 (*ctx
->Exec
->BlendColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3401 case OPCODE_BLEND_EQUATION
:
3402 (*ctx
->Exec
->BlendEquation
)( n
[1].e
);
3404 case OPCODE_BLEND_FUNC
:
3405 (*ctx
->Exec
->BlendFunc
)( n
[1].e
, n
[2].e
);
3407 case OPCODE_BLEND_FUNC_SEPARATE
:
3408 (*ctx
->Exec
->BlendFuncSeparateEXT
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
3410 case OPCODE_CALL_LIST
:
3411 /* Generated by glCallList(), don't add ListBase */
3412 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
3413 execute_list( ctx
, n
[1].ui
);
3416 case OPCODE_CALL_LIST_OFFSET
:
3417 /* Generated by glCallLists() so we must add ListBase */
3418 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
3419 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
3423 (*ctx
->Exec
->Clear
)( n
[1].bf
);
3425 case OPCODE_CLEAR_COLOR
:
3426 (*ctx
->Exec
->ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3428 case OPCODE_CLEAR_ACCUM
:
3429 (*ctx
->Exec
->ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3431 case OPCODE_CLEAR_DEPTH
:
3432 (*ctx
->Exec
->ClearDepth
)( (GLclampd
) n
[1].f
);
3434 case OPCODE_CLEAR_INDEX
:
3435 (*ctx
->Exec
->ClearIndex
)( n
[1].ui
);
3437 case OPCODE_CLEAR_STENCIL
:
3438 (*ctx
->Exec
->ClearStencil
)( n
[1].i
);
3440 case OPCODE_CLIP_PLANE
:
3447 (*ctx
->Exec
->ClipPlane
)( n
[1].e
, eq
);
3450 case OPCODE_COLOR_MASK
:
3451 (*ctx
->Exec
->ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
3453 case OPCODE_COLOR_MATERIAL
:
3454 (*ctx
->Exec
->ColorMaterial
)( n
[1].e
, n
[2].e
);
3456 case OPCODE_COLOR_TABLE
:
3458 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3459 ctx
->Unpack
= _mesa_native_packing
;
3460 (*ctx
->Exec
->ColorTable
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
3461 n
[5].e
, n
[6].data
);
3462 ctx
->Unpack
= save
; /* restore */
3465 case OPCODE_COLOR_SUB_TABLE
:
3467 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3468 ctx
->Unpack
= _mesa_native_packing
;
3469 (*ctx
->Exec
->ColorSubTable
)( n
[1].e
, n
[2].i
, n
[3].i
,
3470 n
[4].e
, n
[5].e
, n
[6].data
);
3471 ctx
->Unpack
= save
; /* restore */
3474 case OPCODE_COPY_PIXELS
:
3475 (*ctx
->Exec
->CopyPixels
)( n
[1].i
, n
[2].i
,
3476 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
3478 case OPCODE_COPY_TEX_IMAGE1D
:
3479 (*ctx
->Exec
->CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
3480 n
[5].i
, n
[6].i
, n
[7].i
);
3482 case OPCODE_COPY_TEX_IMAGE2D
:
3483 (*ctx
->Exec
->CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
3484 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
3486 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
3487 (*ctx
->Exec
->CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3488 n
[4].i
, n
[5].i
, n
[6].i
);
3490 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
3491 (*ctx
->Exec
->CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3492 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
3494 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
3495 (*ctx
->Exec
->CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3496 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
3498 case OPCODE_CULL_FACE
:
3499 (*ctx
->Exec
->CullFace
)( n
[1].e
);
3501 case OPCODE_DEPTH_FUNC
:
3502 (*ctx
->Exec
->DepthFunc
)( n
[1].e
);
3504 case OPCODE_DEPTH_MASK
:
3505 (*ctx
->Exec
->DepthMask
)( n
[1].b
);
3507 case OPCODE_DEPTH_RANGE
:
3508 (*ctx
->Exec
->DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
3510 case OPCODE_DISABLE
:
3511 (*ctx
->Exec
->Disable
)( n
[1].e
);
3513 case OPCODE_DRAW_BUFFER
:
3514 (*ctx
->Exec
->DrawBuffer
)( n
[1].e
);
3516 case OPCODE_DRAW_PIXELS
:
3518 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3519 ctx
->Unpack
= _mesa_native_packing
;
3520 (*ctx
->Exec
->DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
3522 ctx
->Unpack
= save
; /* restore */
3526 (*ctx
->Exec
->Enable
)( n
[1].e
);
3528 case OPCODE_EVALMESH1
:
3529 (*ctx
->Exec
->EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
3531 case OPCODE_EVALMESH2
:
3532 (*ctx
->Exec
->EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
3541 (*ctx
->Exec
->Fogfv
)( n
[1].e
, p
);
3544 case OPCODE_FRONT_FACE
:
3545 (*ctx
->Exec
->FrontFace
)( n
[1].e
);
3547 case OPCODE_FRUSTUM
:
3548 (*ctx
->Exec
->Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
3551 (*ctx
->Exec
->Hint
)( n
[1].e
, n
[2].e
);
3553 case OPCODE_HINT_PGI
:
3554 (*ctx
->Exec
->HintPGI
)( n
[1].e
, n
[2].i
);
3556 case OPCODE_INDEX_MASK
:
3557 (*ctx
->Exec
->IndexMask
)( n
[1].ui
);
3559 case OPCODE_INIT_NAMES
:
3560 (*ctx
->Exec
->InitNames
)();
3569 (*ctx
->Exec
->Lightfv
)( n
[1].e
, n
[2].e
, p
);
3572 case OPCODE_LIGHT_MODEL
:
3579 (*ctx
->Exec
->LightModelfv
)( n
[1].e
, p
);
3582 case OPCODE_LINE_STIPPLE
:
3583 (*ctx
->Exec
->LineStipple
)( n
[1].i
, n
[2].us
);
3585 case OPCODE_LINE_WIDTH
:
3586 (*ctx
->Exec
->LineWidth
)( n
[1].f
);
3588 case OPCODE_LIST_BASE
:
3589 (*ctx
->Exec
->ListBase
)( n
[1].ui
);
3591 case OPCODE_LOAD_IDENTITY
:
3592 (*ctx
->Exec
->LoadIdentity
)();
3594 case OPCODE_LOAD_MATRIX
:
3595 if (sizeof(Node
)==sizeof(GLfloat
)) {
3596 (*ctx
->Exec
->LoadMatrixf
)( &n
[1].f
);
3601 for (i
=0;i
<16;i
++) {
3604 (*ctx
->Exec
->LoadMatrixf
)( m
);
3607 case OPCODE_LOAD_NAME
:
3608 (*ctx
->Exec
->LoadName
)( n
[1].ui
);
3610 case OPCODE_LOGIC_OP
:
3611 (*ctx
->Exec
->LogicOp
)( n
[1].e
);
3615 GLenum target
= n
[1].e
;
3616 GLint ustride
= _mesa_evaluator_components(target
);
3617 GLint uorder
= n
[5].i
;
3618 GLfloat u1
= n
[2].f
;
3619 GLfloat u2
= n
[3].f
;
3620 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, ustride
, uorder
,
3621 (GLfloat
*) n
[6].data
);
3626 GLenum target
= n
[1].e
;
3627 GLfloat u1
= n
[2].f
;
3628 GLfloat u2
= n
[3].f
;
3629 GLfloat v1
= n
[4].f
;
3630 GLfloat v2
= n
[5].f
;
3631 GLint ustride
= n
[6].i
;
3632 GLint vstride
= n
[7].i
;
3633 GLint uorder
= n
[8].i
;
3634 GLint vorder
= n
[9].i
;
3635 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
3636 v1
, v2
, vstride
, vorder
,
3637 (GLfloat
*) n
[10].data
);
3640 case OPCODE_MAPGRID1
:
3641 (*ctx
->Exec
->MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
3643 case OPCODE_MAPGRID2
:
3644 (*ctx
->Exec
->MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
3646 case OPCODE_MATRIX_MODE
:
3647 (*ctx
->Exec
->MatrixMode
)( n
[1].e
);
3649 case OPCODE_MULT_MATRIX
:
3650 if (sizeof(Node
)==sizeof(GLfloat
)) {
3651 (*ctx
->Exec
->MultMatrixf
)( &n
[1].f
);
3656 for (i
=0;i
<16;i
++) {
3659 (*ctx
->Exec
->MultMatrixf
)( m
);
3663 (*ctx
->Exec
->Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
3665 case OPCODE_PASSTHROUGH
:
3666 (*ctx
->Exec
->PassThrough
)( n
[1].f
);
3668 case OPCODE_PIXEL_MAP
:
3669 (*ctx
->Exec
->PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
3671 case OPCODE_PIXEL_TRANSFER
:
3672 (*ctx
->Exec
->PixelTransferf
)( n
[1].e
, n
[2].f
);
3674 case OPCODE_PIXEL_ZOOM
:
3675 (*ctx
->Exec
->PixelZoom
)( n
[1].f
, n
[2].f
);
3677 case OPCODE_POINT_SIZE
:
3678 (*ctx
->Exec
->PointSize
)( n
[1].f
);
3680 case OPCODE_POINT_PARAMETERS
:
3686 (*ctx
->Exec
->PointParameterfvEXT
)( n
[1].e
, params
);
3689 case OPCODE_POLYGON_MODE
:
3690 (*ctx
->Exec
->PolygonMode
)( n
[1].e
, n
[2].e
);
3692 case OPCODE_POLYGON_STIPPLE
:
3693 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) n
[1].data
);
3695 case OPCODE_POLYGON_OFFSET
:
3696 (*ctx
->Exec
->PolygonOffset
)( n
[1].f
, n
[2].f
);
3698 case OPCODE_POP_ATTRIB
:
3699 (*ctx
->Exec
->PopAttrib
)();
3701 case OPCODE_POP_MATRIX
:
3702 (*ctx
->Exec
->PopMatrix
)();
3704 case OPCODE_POP_NAME
:
3705 (*ctx
->Exec
->PopName
)();
3707 case OPCODE_PRIORITIZE_TEXTURE
:
3708 (*ctx
->Exec
->PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
3710 case OPCODE_PUSH_ATTRIB
:
3711 (*ctx
->Exec
->PushAttrib
)( n
[1].bf
);
3713 case OPCODE_PUSH_MATRIX
:
3714 (*ctx
->Exec
->PushMatrix
)();
3716 case OPCODE_PUSH_NAME
:
3717 (*ctx
->Exec
->PushName
)( n
[1].ui
);
3719 case OPCODE_RASTER_POS
:
3720 (*ctx
->Exec
->RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3722 case OPCODE_READ_BUFFER
:
3723 (*ctx
->Exec
->ReadBuffer
)( n
[1].e
);
3726 (*ctx
->Exec
->Rectf
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3729 (*ctx
->Exec
->Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
3731 case OPCODE_SCISSOR
:
3732 (*ctx
->Exec
->Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
3734 case OPCODE_SHADE_MODEL
:
3735 (*ctx
->Exec
->ShadeModel
)( n
[1].e
);
3737 case OPCODE_STENCIL_FUNC
:
3738 (*ctx
->Exec
->StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
3740 case OPCODE_STENCIL_MASK
:
3741 (*ctx
->Exec
->StencilMask
)( n
[1].ui
);
3743 case OPCODE_STENCIL_OP
:
3744 (*ctx
->Exec
->StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
3753 (*ctx
->Exec
->TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
3763 (*ctx
->Exec
->TexGenfv
)( n
[1].e
, n
[2].e
, params
);
3766 case OPCODE_TEXPARAMETER
:
3773 (*ctx
->Exec
->TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
3776 case OPCODE_TEX_IMAGE1D
:
3778 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3779 ctx
->Unpack
= _mesa_native_packing
;
3780 (*ctx
->Exec
->TexImage1D
)(
3781 n
[1].e
, /* target */
3783 n
[3].i
, /* components */
3785 n
[5].e
, /* border */
3786 n
[6].e
, /* format */
3789 ctx
->Unpack
= save
; /* restore */
3792 case OPCODE_TEX_IMAGE2D
:
3794 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3795 ctx
->Unpack
= _mesa_native_packing
;
3796 (*ctx
->Exec
->TexImage2D
)(
3797 n
[1].e
, /* target */
3799 n
[3].i
, /* components */
3801 n
[5].i
, /* height */
3802 n
[6].e
, /* border */
3803 n
[7].e
, /* format */
3806 ctx
->Unpack
= save
; /* restore */
3809 case OPCODE_TEX_IMAGE3D
:
3811 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3812 ctx
->Unpack
= _mesa_native_packing
;
3813 (*ctx
->Exec
->TexImage3D
)(
3814 n
[1].e
, /* target */
3816 n
[3].i
, /* components */
3818 n
[5].i
, /* height */
3820 n
[7].e
, /* border */
3821 n
[8].e
, /* format */
3824 ctx
->Unpack
= save
; /* restore */
3827 case OPCODE_TEX_SUB_IMAGE1D
:
3829 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3830 ctx
->Unpack
= _mesa_native_packing
;
3831 (*ctx
->Exec
->TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3833 n
[6].e
, n
[7].data
);
3834 ctx
->Unpack
= save
; /* restore */
3837 case OPCODE_TEX_SUB_IMAGE2D
:
3839 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3840 ctx
->Unpack
= _mesa_native_packing
;
3841 (*ctx
->Exec
->TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3843 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
3844 ctx
->Unpack
= save
; /* restore */
3847 case OPCODE_TEX_SUB_IMAGE3D
:
3849 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3850 ctx
->Unpack
= _mesa_native_packing
;
3851 (*ctx
->Exec
->TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3852 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
3853 n
[8].i
, n
[9].e
, n
[10].e
,
3855 ctx
->Unpack
= save
; /* restore */
3858 case OPCODE_TRANSLATE
:
3859 (*ctx
->Exec
->Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
3861 case OPCODE_VIEWPORT
:
3862 (*ctx
->Exec
->Viewport
)(n
[1].i
, n
[2].i
,
3863 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
3865 case OPCODE_WINDOW_POS
:
3866 (*ctx
->Exec
->WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3868 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
3869 (*ctx
->Exec
->ActiveTextureARB
)( n
[1].e
);
3871 case OPCODE_CLIENT_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
3872 (*ctx
->Exec
->ClientActiveTextureARB
)( n
[1].e
);
3874 case OPCODE_CONTINUE
:
3875 n
= (Node
*) n
[1].next
;
3877 case OPCODE_END_OF_LIST
:
3883 sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
3884 gl_problem( ctx
, msg
);
3889 /* increment n to point to next compiled command */
3890 if (opcode
!=OPCODE_CONTINUE
) {
3891 n
+= InstSize
[opcode
];
3902 /**********************************************************************/
3904 /**********************************************************************/
3910 * Test if a display list number is valid.
3913 _mesa_IsList( GLuint list
)
3915 GET_CURRENT_CONTEXT(ctx
);
3916 return islist(ctx
, list
);
3921 * Delete a sequence of consecutive display lists.
3924 _mesa_DeleteLists( GLuint list
, GLsizei range
)
3926 GET_CURRENT_CONTEXT(ctx
);
3929 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glDeleteLists");
3931 gl_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
3934 for (i
=list
;i
<list
+range
;i
++) {
3935 gl_destroy_list( ctx
, i
);
3942 * Return a display list number, n, such that lists n through n+range-1
3946 _mesa_GenLists(GLsizei range
)
3948 GET_CURRENT_CONTEXT(ctx
);
3951 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx
, "glGenLists", 0);
3953 gl_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
3960 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
3962 /* reserve the list IDs by with empty/dummy lists */
3964 for (i
=0; i
<range
; i
++) {
3965 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
3974 * Begin a new display list.
3977 _mesa_NewList( GLuint list
, GLenum mode
)
3979 GET_CURRENT_CONTEXT(ctx
);
3980 struct immediate
*IM
;
3981 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glNewList");
3983 if (MESA_VERBOSE
&VERBOSE_API
)
3984 fprintf(stderr
, "glNewList %u %s\n", list
, gl_lookup_enum_by_nr(mode
));
3987 gl_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
3991 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
3992 gl_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
3996 if (ctx
->CurrentListPtr
) {
3997 /* already compiling a display list */
3998 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
4002 /* Allocate new display list */
4003 ctx
->CurrentListNum
= list
;
4004 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
4005 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
4006 ctx
->CurrentPos
= 0;
4008 IM
= gl_immediate_alloc( ctx
);
4009 SET_IMMEDIATE( ctx
, IM
);
4010 gl_reset_input( ctx
);
4012 ctx
->CompileFlag
= GL_TRUE
;
4013 ctx
->CompileCVAFlag
= GL_FALSE
;
4014 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
4016 ctx
->CurrentDispatch
= ctx
->Save
;
4017 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4023 * End definition of current display list.
4026 _mesa_EndList( void )
4028 GET_CURRENT_CONTEXT(ctx
);
4029 if (MESA_VERBOSE
&VERBOSE_API
)
4030 fprintf(stderr
, "glEndList\n");
4032 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
, "glEndList" );
4034 /* Check that a list is under construction */
4035 if (!ctx
->CurrentListPtr
) {
4036 gl_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
4040 (void) alloc_instruction( ctx
, OPCODE_END_OF_LIST
, 0 );
4042 /* Destroy old list, if any */
4043 gl_destroy_list(ctx
, ctx
->CurrentListNum
);
4044 /* Install the list */
4045 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
4048 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
4049 mesa_print_display_list(ctx
->CurrentListNum
);
4051 ctx
->CurrentListNum
= 0;
4052 ctx
->CurrentListPtr
= NULL
;
4053 ctx
->ExecuteFlag
= GL_TRUE
;
4054 ctx
->CompileFlag
= GL_FALSE
;
4055 /* ctx->CompileCVAFlag = ...; */
4057 /* KW: Put back the old input pointer.
4059 if (--ctx
->input
->ref_count
== 0)
4060 gl_immediate_free( ctx
->input
);
4062 SET_IMMEDIATE( ctx
, ctx
->VB
->IM
);
4063 gl_reset_input( ctx
);
4065 /* Haven't tracked down why this is needed.
4069 ctx
->CurrentDispatch
= ctx
->Exec
;
4070 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4076 _mesa_CallList( GLuint list
)
4078 GET_CURRENT_CONTEXT(ctx
);
4079 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
4080 /* execute the display list, and restore the CompileFlag. */
4081 GLboolean save_compile_flag
;
4083 if (MESA_VERBOSE
&VERBOSE_API
) {
4084 fprintf(stderr
, "glCallList %u\n", list
);
4085 mesa_print_display_list( list
);
4088 save_compile_flag
= ctx
->CompileFlag
;
4089 ctx
->CompileFlag
= GL_FALSE
;
4091 FLUSH_VB( ctx
, "call list" );
4092 execute_list( ctx
, list
);
4093 ctx
->CompileFlag
= save_compile_flag
;
4095 /* also restore API function pointers to point to "save" versions */
4096 if (save_compile_flag
) {
4097 ctx
->CurrentDispatch
= ctx
->Save
;
4098 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4105 * Execute glCallLists: call multiple display lists.
4108 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
4110 GET_CURRENT_CONTEXT(ctx
);
4113 GLboolean save_compile_flag
;
4115 /* Save the CompileFlag status, turn it off, execute display list,
4116 * and restore the CompileFlag.
4118 save_compile_flag
= ctx
->CompileFlag
;
4119 ctx
->CompileFlag
= GL_FALSE
;
4121 FLUSH_VB( ctx
, "call lists" );
4124 list
= translate_id( i
, type
, lists
);
4125 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
4128 ctx
->CompileFlag
= save_compile_flag
;
4130 /* also restore API function pointers to point to "save" versions */
4131 if (save_compile_flag
) {
4132 ctx
->CurrentDispatch
= ctx
->Save
;
4133 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4136 /* RESET_IMMEDIATE( ctx ); */
4142 * Set the offset added to list numbers in glCallLists.
4145 _mesa_ListBase( GLuint base
)
4147 GET_CURRENT_CONTEXT(ctx
);
4148 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glListBase");
4149 ctx
->List
.ListBase
= base
;
4156 * Assign all the pointers in 'table' to point to Mesa's display list
4157 * building functions.
4160 _mesa_init_dlist_table( struct _glapi_table
*table
)
4162 _mesa_init_no_op_table(table
);
4165 table
->Accum
= save_Accum
;
4166 table
->AlphaFunc
= save_AlphaFunc
;
4167 table
->Begin
= save_Begin
;
4168 table
->Bitmap
= save_Bitmap
;
4169 table
->BlendFunc
= save_BlendFunc
;
4170 table
->CallList
= save_CallList
;
4171 table
->CallLists
= save_CallLists
;
4172 table
->Clear
= save_Clear
;
4173 table
->ClearAccum
= save_ClearAccum
;
4174 table
->ClearColor
= save_ClearColor
;
4175 table
->ClearDepth
= save_ClearDepth
;
4176 table
->ClearIndex
= save_ClearIndex
;
4177 table
->ClearStencil
= save_ClearStencil
;
4178 table
->ClipPlane
= save_ClipPlane
;
4179 table
->Color3b
= _mesa_Color3b
;
4180 table
->Color3bv
= _mesa_Color3bv
;
4181 table
->Color3d
= _mesa_Color3d
;
4182 table
->Color3dv
= _mesa_Color3dv
;
4183 table
->Color3f
= _mesa_Color3f
;
4184 table
->Color3fv
= _mesa_Color3fv
;
4185 table
->Color3i
= _mesa_Color3i
;
4186 table
->Color3iv
= _mesa_Color3iv
;
4187 table
->Color3s
= _mesa_Color3s
;
4188 table
->Color3sv
= _mesa_Color3sv
;
4189 table
->Color3ub
= _mesa_Color3ub
;
4190 table
->Color3ubv
= _mesa_Color3ubv
;
4191 table
->Color3ui
= _mesa_Color3ui
;
4192 table
->Color3uiv
= _mesa_Color3uiv
;
4193 table
->Color3us
= _mesa_Color3us
;
4194 table
->Color3usv
= _mesa_Color3usv
;
4195 table
->Color4b
= _mesa_Color4b
;
4196 table
->Color4bv
= _mesa_Color4bv
;
4197 table
->Color4d
= _mesa_Color4d
;
4198 table
->Color4dv
= _mesa_Color4dv
;
4199 table
->Color4f
= _mesa_Color4f
;
4200 table
->Color4fv
= _mesa_Color4fv
;
4201 table
->Color4i
= _mesa_Color4i
;
4202 table
->Color4iv
= _mesa_Color4iv
;
4203 table
->Color4s
= _mesa_Color4s
;
4204 table
->Color4sv
= _mesa_Color4sv
;
4205 table
->Color4ub
= _mesa_Color4ub
;
4206 table
->Color4ubv
= _mesa_Color4ubv
;
4207 table
->Color4ui
= _mesa_Color4ui
;
4208 table
->Color4uiv
= _mesa_Color4uiv
;
4209 table
->Color4us
= _mesa_Color4us
;
4210 table
->Color4usv
= _mesa_Color4usv
;
4211 table
->ColorMask
= save_ColorMask
;
4212 table
->ColorMaterial
= save_ColorMaterial
;
4213 table
->CopyPixels
= save_CopyPixels
;
4214 table
->CullFace
= save_CullFace
;
4215 table
->DeleteLists
= _mesa_DeleteLists
;
4216 table
->DepthFunc
= save_DepthFunc
;
4217 table
->DepthMask
= save_DepthMask
;
4218 table
->DepthRange
= save_DepthRange
;
4219 table
->Disable
= save_Disable
;
4220 table
->DrawBuffer
= save_DrawBuffer
;
4221 table
->DrawPixels
= save_DrawPixels
;
4222 table
->EdgeFlag
= _mesa_EdgeFlag
;
4223 table
->EdgeFlagv
= _mesa_EdgeFlagv
;
4224 table
->Enable
= save_Enable
;
4225 table
->End
= _mesa_End
;
4226 table
->EndList
= _mesa_EndList
;
4227 table
->EvalCoord1d
= _mesa_EvalCoord1d
;
4228 table
->EvalCoord1dv
= _mesa_EvalCoord1dv
;
4229 table
->EvalCoord1f
= _mesa_EvalCoord1f
;
4230 table
->EvalCoord1fv
= _mesa_EvalCoord1fv
;
4231 table
->EvalCoord2d
= _mesa_EvalCoord2d
;
4232 table
->EvalCoord2dv
= _mesa_EvalCoord2dv
;
4233 table
->EvalCoord2f
= _mesa_EvalCoord2f
;
4234 table
->EvalCoord2fv
= _mesa_EvalCoord2fv
;
4235 table
->EvalMesh1
= save_EvalMesh1
;
4236 table
->EvalMesh2
= save_EvalMesh2
;
4237 table
->EvalPoint1
= _mesa_EvalPoint1
;
4238 table
->EvalPoint2
= _mesa_EvalPoint2
;
4239 table
->FeedbackBuffer
= _mesa_FeedbackBuffer
;
4240 table
->Finish
= _mesa_Finish
;
4241 table
->Flush
= _mesa_Flush
;
4242 table
->Fogf
= save_Fogf
;
4243 table
->Fogfv
= save_Fogfv
;
4244 table
->Fogi
= save_Fogi
;
4245 table
->Fogiv
= save_Fogiv
;
4246 table
->FrontFace
= save_FrontFace
;
4247 table
->Frustum
= save_Frustum
;
4248 table
->GenLists
= _mesa_GenLists
;
4249 table
->GetBooleanv
= _mesa_GetBooleanv
;
4250 table
->GetClipPlane
= _mesa_GetClipPlane
;
4251 table
->GetDoublev
= _mesa_GetDoublev
;
4252 table
->GetError
= _mesa_GetError
;
4253 table
->GetFloatv
= _mesa_GetFloatv
;
4254 table
->GetIntegerv
= _mesa_GetIntegerv
;
4255 table
->GetLightfv
= _mesa_GetLightfv
;
4256 table
->GetLightiv
= _mesa_GetLightiv
;
4257 table
->GetMapdv
= _mesa_GetMapdv
;
4258 table
->GetMapfv
= _mesa_GetMapfv
;
4259 table
->GetMapiv
= _mesa_GetMapiv
;
4260 table
->GetMaterialfv
= _mesa_GetMaterialfv
;
4261 table
->GetMaterialiv
= _mesa_GetMaterialiv
;
4262 table
->GetPixelMapfv
= _mesa_GetPixelMapfv
;
4263 table
->GetPixelMapuiv
= _mesa_GetPixelMapuiv
;
4264 table
->GetPixelMapusv
= _mesa_GetPixelMapusv
;
4265 table
->GetPolygonStipple
= _mesa_GetPolygonStipple
;
4266 table
->GetString
= _mesa_GetString
;
4267 table
->GetTexEnvfv
= _mesa_GetTexEnvfv
;
4268 table
->GetTexEnviv
= _mesa_GetTexEnviv
;
4269 table
->GetTexGendv
= _mesa_GetTexGendv
;
4270 table
->GetTexGenfv
= _mesa_GetTexGenfv
;
4271 table
->GetTexGeniv
= _mesa_GetTexGeniv
;
4272 table
->GetTexImage
= _mesa_GetTexImage
;
4273 table
->GetTexLevelParameterfv
= _mesa_GetTexLevelParameterfv
;
4274 table
->GetTexLevelParameteriv
= _mesa_GetTexLevelParameteriv
;
4275 table
->GetTexParameterfv
= _mesa_GetTexParameterfv
;
4276 table
->GetTexParameteriv
= _mesa_GetTexParameteriv
;
4277 table
->Hint
= save_Hint
;
4278 table
->IndexMask
= save_IndexMask
;
4279 table
->Indexd
= _mesa_Indexd
;
4280 table
->Indexdv
= _mesa_Indexdv
;
4281 table
->Indexf
= _mesa_Indexf
;
4282 table
->Indexfv
= _mesa_Indexfv
;
4283 table
->Indexi
= _mesa_Indexi
;
4284 table
->Indexiv
= _mesa_Indexiv
;
4285 table
->Indexs
= _mesa_Indexs
;
4286 table
->Indexsv
= _mesa_Indexsv
;
4287 table
->InitNames
= save_InitNames
;
4288 table
->IsEnabled
= _mesa_IsEnabled
;
4289 table
->IsList
= _mesa_IsList
;
4290 table
->LightModelf
= save_LightModelf
;
4291 table
->LightModelfv
= save_LightModelfv
;
4292 table
->LightModeli
= save_LightModeli
;
4293 table
->LightModeliv
= save_LightModeliv
;
4294 table
->Lightf
= save_Lightf
;
4295 table
->Lightfv
= save_Lightfv
;
4296 table
->Lighti
= save_Lighti
;
4297 table
->Lightiv
= save_Lightiv
;
4298 table
->LineStipple
= save_LineStipple
;
4299 table
->LineWidth
= save_LineWidth
;
4300 table
->ListBase
= save_ListBase
;
4301 table
->LoadIdentity
= save_LoadIdentity
;
4302 table
->LoadMatrixd
= save_LoadMatrixd
;
4303 table
->LoadMatrixf
= save_LoadMatrixf
;
4304 table
->LoadName
= save_LoadName
;
4305 table
->LogicOp
= save_LogicOp
;
4306 table
->Map1d
= save_Map1d
;
4307 table
->Map1f
= save_Map1f
;
4308 table
->Map2d
= save_Map2d
;
4309 table
->Map2f
= save_Map2f
;
4310 table
->MapGrid1d
= save_MapGrid1d
;
4311 table
->MapGrid1f
= save_MapGrid1f
;
4312 table
->MapGrid2d
= save_MapGrid2d
;
4313 table
->MapGrid2f
= save_MapGrid2f
;
4314 table
->Materialf
= _mesa_Materialf
;
4315 table
->Materialfv
= _mesa_Materialfv
;
4316 table
->Materiali
= _mesa_Materiali
;
4317 table
->Materialiv
= _mesa_Materialiv
;
4318 table
->MatrixMode
= save_MatrixMode
;
4319 table
->MultMatrixd
= save_MultMatrixd
;
4320 table
->MultMatrixf
= save_MultMatrixf
;
4321 table
->NewList
= save_NewList
;
4322 table
->Normal3b
= _mesa_Normal3b
;
4323 table
->Normal3bv
= _mesa_Normal3bv
;
4324 table
->Normal3d
= _mesa_Normal3d
;
4325 table
->Normal3dv
= _mesa_Normal3dv
;
4326 table
->Normal3f
= _mesa_Normal3f
;
4327 table
->Normal3fv
= _mesa_Normal3fv
;
4328 table
->Normal3i
= _mesa_Normal3i
;
4329 table
->Normal3iv
= _mesa_Normal3iv
;
4330 table
->Normal3s
= _mesa_Normal3s
;
4331 table
->Normal3sv
= _mesa_Normal3sv
;
4332 table
->Ortho
= save_Ortho
;
4333 table
->PassThrough
= save_PassThrough
;
4334 table
->PixelMapfv
= save_PixelMapfv
;
4335 table
->PixelMapuiv
= save_PixelMapuiv
;
4336 table
->PixelMapusv
= save_PixelMapusv
;
4337 table
->PixelStoref
= _mesa_PixelStoref
;
4338 table
->PixelStorei
= _mesa_PixelStorei
;
4339 table
->PixelTransferf
= save_PixelTransferf
;
4340 table
->PixelTransferi
= save_PixelTransferi
;
4341 table
->PixelZoom
= save_PixelZoom
;
4342 table
->PointSize
= save_PointSize
;
4343 table
->PolygonMode
= save_PolygonMode
;
4344 table
->PolygonOffset
= save_PolygonOffset
;
4345 table
->PolygonStipple
= save_PolygonStipple
;
4346 table
->PopAttrib
= save_PopAttrib
;
4347 table
->PopMatrix
= save_PopMatrix
;
4348 table
->PopName
= save_PopName
;
4349 table
->PushAttrib
= save_PushAttrib
;
4350 table
->PushMatrix
= save_PushMatrix
;
4351 table
->PushName
= save_PushName
;
4352 table
->RasterPos2d
= save_RasterPos2d
;
4353 table
->RasterPos2dv
= save_RasterPos2dv
;
4354 table
->RasterPos2f
= save_RasterPos2f
;
4355 table
->RasterPos2fv
= save_RasterPos2fv
;
4356 table
->RasterPos2i
= save_RasterPos2i
;
4357 table
->RasterPos2iv
= save_RasterPos2iv
;
4358 table
->RasterPos2s
= save_RasterPos2s
;
4359 table
->RasterPos2sv
= save_RasterPos2sv
;
4360 table
->RasterPos3d
= save_RasterPos3d
;
4361 table
->RasterPos3dv
= save_RasterPos3dv
;
4362 table
->RasterPos3f
= save_RasterPos3f
;
4363 table
->RasterPos3fv
= save_RasterPos3fv
;
4364 table
->RasterPos3i
= save_RasterPos3i
;
4365 table
->RasterPos3iv
= save_RasterPos3iv
;
4366 table
->RasterPos3s
= save_RasterPos3s
;
4367 table
->RasterPos3sv
= save_RasterPos3sv
;
4368 table
->RasterPos4d
= save_RasterPos4d
;
4369 table
->RasterPos4dv
= save_RasterPos4dv
;
4370 table
->RasterPos4f
= save_RasterPos4f
;
4371 table
->RasterPos4fv
= save_RasterPos4fv
;
4372 table
->RasterPos4i
= save_RasterPos4i
;
4373 table
->RasterPos4iv
= save_RasterPos4iv
;
4374 table
->RasterPos4s
= save_RasterPos4s
;
4375 table
->RasterPos4sv
= save_RasterPos4sv
;
4376 table
->ReadBuffer
= save_ReadBuffer
;
4377 table
->ReadPixels
= _mesa_ReadPixels
;
4378 table
->Rectd
= save_Rectd
;
4379 table
->Rectdv
= save_Rectdv
;
4380 table
->Rectf
= save_Rectf
;
4381 table
->Rectfv
= save_Rectfv
;
4382 table
->Recti
= save_Recti
;
4383 table
->Rectiv
= save_Rectiv
;
4384 table
->Rects
= save_Rects
;
4385 table
->Rectsv
= save_Rectsv
;
4386 table
->RenderMode
= _mesa_RenderMode
;
4387 table
->Rotated
= save_Rotated
;
4388 table
->Rotatef
= save_Rotatef
;
4389 table
->Scaled
= save_Scaled
;
4390 table
->Scalef
= save_Scalef
;
4391 table
->Scissor
= save_Scissor
;
4392 table
->SelectBuffer
= _mesa_SelectBuffer
;
4393 table
->ShadeModel
= save_ShadeModel
;
4394 table
->StencilFunc
= save_StencilFunc
;
4395 table
->StencilMask
= save_StencilMask
;
4396 table
->StencilOp
= save_StencilOp
;
4397 table
->TexCoord1d
= _mesa_TexCoord1d
;
4398 table
->TexCoord1dv
= _mesa_TexCoord1dv
;
4399 table
->TexCoord1f
= _mesa_TexCoord1f
;
4400 table
->TexCoord1fv
= _mesa_TexCoord1fv
;
4401 table
->TexCoord1i
= _mesa_TexCoord1i
;
4402 table
->TexCoord1iv
= _mesa_TexCoord1iv
;
4403 table
->TexCoord1s
= _mesa_TexCoord1s
;
4404 table
->TexCoord1sv
= _mesa_TexCoord1sv
;
4405 table
->TexCoord2d
= _mesa_TexCoord2d
;
4406 table
->TexCoord2dv
= _mesa_TexCoord2dv
;
4407 table
->TexCoord2f
= _mesa_TexCoord2f
;
4408 table
->TexCoord2fv
= _mesa_TexCoord2fv
;
4409 table
->TexCoord2i
= _mesa_TexCoord2i
;
4410 table
->TexCoord2iv
= _mesa_TexCoord2iv
;
4411 table
->TexCoord2s
= _mesa_TexCoord2s
;
4412 table
->TexCoord2sv
= _mesa_TexCoord2sv
;
4413 table
->TexCoord3d
= _mesa_TexCoord3d
;
4414 table
->TexCoord3dv
= _mesa_TexCoord3dv
;
4415 table
->TexCoord3f
= _mesa_TexCoord3f
;
4416 table
->TexCoord3fv
= _mesa_TexCoord3fv
;
4417 table
->TexCoord3i
= _mesa_TexCoord3i
;
4418 table
->TexCoord3iv
= _mesa_TexCoord3iv
;
4419 table
->TexCoord3s
= _mesa_TexCoord3s
;
4420 table
->TexCoord3sv
= _mesa_TexCoord3sv
;
4421 table
->TexCoord4d
= _mesa_TexCoord4d
;
4422 table
->TexCoord4dv
= _mesa_TexCoord4dv
;
4423 table
->TexCoord4f
= _mesa_TexCoord4f
;
4424 table
->TexCoord4fv
= _mesa_TexCoord4fv
;
4425 table
->TexCoord4i
= _mesa_TexCoord4i
;
4426 table
->TexCoord4iv
= _mesa_TexCoord4iv
;
4427 table
->TexCoord4s
= _mesa_TexCoord4s
;
4428 table
->TexCoord4sv
= _mesa_TexCoord4sv
;
4429 table
->TexEnvf
= save_TexEnvf
;
4430 table
->TexEnvfv
= save_TexEnvfv
;
4431 table
->TexEnvi
= save_TexEnvi
;
4432 table
->TexEnviv
= save_TexEnviv
;
4433 table
->TexGend
= save_TexGend
;
4434 table
->TexGendv
= save_TexGendv
;
4435 table
->TexGenf
= save_TexGenf
;
4436 table
->TexGenfv
= save_TexGenfv
;
4437 table
->TexGeni
= save_TexGeni
;
4438 table
->TexGeniv
= save_TexGeniv
;
4439 table
->TexImage1D
= save_TexImage1D
;
4440 table
->TexImage2D
= save_TexImage2D
;
4441 table
->TexParameterf
= save_TexParameterf
;
4442 table
->TexParameterfv
= save_TexParameterfv
;
4443 table
->TexParameteri
= save_TexParameteri
;
4444 table
->TexParameteriv
= save_TexParameteriv
;
4445 table
->Translated
= save_Translated
;
4446 table
->Translatef
= save_Translatef
;
4447 table
->Vertex2d
= _mesa_Vertex2d
;
4448 table
->Vertex2dv
= _mesa_Vertex2dv
;
4449 table
->Vertex2f
= _mesa_Vertex2f
;
4450 table
->Vertex2fv
= _mesa_Vertex2fv
;
4451 table
->Vertex2i
= _mesa_Vertex2i
;
4452 table
->Vertex2iv
= _mesa_Vertex2iv
;
4453 table
->Vertex2s
= _mesa_Vertex2s
;
4454 table
->Vertex2sv
= _mesa_Vertex2sv
;
4455 table
->Vertex3d
= _mesa_Vertex3d
;
4456 table
->Vertex3dv
= _mesa_Vertex3dv
;
4457 table
->Vertex3f
= _mesa_Vertex3f
;
4458 table
->Vertex3fv
= _mesa_Vertex3fv
;
4459 table
->Vertex3i
= _mesa_Vertex3i
;
4460 table
->Vertex3iv
= _mesa_Vertex3iv
;
4461 table
->Vertex3s
= _mesa_Vertex3s
;
4462 table
->Vertex3sv
= _mesa_Vertex3sv
;
4463 table
->Vertex4d
= _mesa_Vertex4d
;
4464 table
->Vertex4dv
= _mesa_Vertex4dv
;
4465 table
->Vertex4f
= _mesa_Vertex4f
;
4466 table
->Vertex4fv
= _mesa_Vertex4fv
;
4467 table
->Vertex4i
= _mesa_Vertex4i
;
4468 table
->Vertex4iv
= _mesa_Vertex4iv
;
4469 table
->Vertex4s
= _mesa_Vertex4s
;
4470 table
->Vertex4sv
= _mesa_Vertex4sv
;
4471 table
->Viewport
= save_Viewport
;
4474 table
->AreTexturesResident
= _mesa_AreTexturesResident
;
4475 table
->ArrayElement
= _mesa_ArrayElement
;
4476 table
->BindTexture
= save_BindTexture
;
4477 table
->ColorPointer
= _mesa_ColorPointer
;
4478 table
->CopyTexImage1D
= save_CopyTexImage1D
;
4479 table
->CopyTexImage2D
= save_CopyTexImage2D
;
4480 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
4481 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
4482 table
->DeleteTextures
= _mesa_DeleteTextures
;
4483 table
->DisableClientState
= _mesa_DisableClientState
;
4484 table
->DrawArrays
= _mesa_DrawArrays
;
4485 table
->DrawElements
= _mesa_DrawElements
;
4486 table
->EdgeFlagPointer
= _mesa_EdgeFlagPointer
;
4487 table
->EnableClientState
= _mesa_EnableClientState
;
4488 table
->GenTextures
= _mesa_GenTextures
;
4489 table
->GetPointerv
= _mesa_GetPointerv
;
4490 table
->IndexPointer
= _mesa_IndexPointer
;
4491 table
->Indexub
= _mesa_Indexub
;
4492 table
->Indexubv
= _mesa_Indexubv
;
4493 table
->InterleavedArrays
= _mesa_InterleavedArrays
;
4494 table
->IsTexture
= _mesa_IsTexture
;
4495 table
->NormalPointer
= _mesa_NormalPointer
;
4496 table
->PopClientAttrib
= _mesa_PopClientAttrib
;
4497 table
->PrioritizeTextures
= save_PrioritizeTextures
;
4498 table
->PushClientAttrib
= _mesa_PushClientAttrib
;
4499 table
->TexCoordPointer
= _mesa_TexCoordPointer
;
4500 table
->TexSubImage1D
= save_TexSubImage1D
;
4501 table
->TexSubImage2D
= save_TexSubImage2D
;
4502 table
->VertexPointer
= _mesa_VertexPointer
;
4505 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
4506 table
->DrawRangeElements
= _mesa_DrawRangeElements
;
4507 table
->TexImage3D
= save_TexImage3D
;
4508 table
->TexSubImage3D
= save_TexSubImage3D
;
4510 /* GL_ARB_imaging */
4511 /* Not all are supported */
4512 table
->BlendColor
= save_BlendColor
;
4513 table
->BlendEquation
= save_BlendEquation
;
4514 table
->ColorSubTable
= save_ColorSubTable
;
4515 table
->ColorTable
= save_ColorTable
;
4516 table
->ColorTableParameterfv
= _mesa_ColorTableParameterfv
;
4517 table
->ColorTableParameteriv
= _mesa_ColorTableParameteriv
;
4518 table
->ConvolutionFilter1D
= _mesa_ConvolutionFilter1D
;
4519 table
->ConvolutionFilter2D
= _mesa_ConvolutionFilter2D
;
4520 table
->ConvolutionParameterf
= _mesa_ConvolutionParameterf
;
4521 table
->ConvolutionParameterfv
= _mesa_ConvolutionParameterfv
;
4522 table
->ConvolutionParameteri
= _mesa_ConvolutionParameteri
;
4523 table
->ConvolutionParameteriv
= _mesa_ConvolutionParameteriv
;
4524 table
->CopyColorSubTable
= _mesa_CopyColorSubTable
;
4525 table
->CopyColorTable
= _mesa_CopyColorTable
;
4526 table
->CopyConvolutionFilter1D
= _mesa_CopyConvolutionFilter1D
;
4527 table
->CopyConvolutionFilter2D
= _mesa_CopyConvolutionFilter2D
;
4528 table
->GetColorTable
= _mesa_GetColorTable
;
4529 table
->GetColorTableParameterfv
= _mesa_GetColorTableParameterfv
;
4530 table
->GetColorTableParameteriv
= _mesa_GetColorTableParameteriv
;
4531 table
->GetConvolutionFilter
= _mesa_GetConvolutionFilter
;
4532 table
->GetConvolutionParameterfv
= _mesa_GetConvolutionParameterfv
;
4533 table
->GetConvolutionParameteriv
= _mesa_GetConvolutionParameteriv
;
4534 table
->GetHistogram
= _mesa_GetHistogram
;
4535 table
->GetHistogramParameterfv
= _mesa_GetHistogramParameterfv
;
4536 table
->GetHistogramParameteriv
= _mesa_GetHistogramParameteriv
;
4537 table
->GetMinmax
= _mesa_GetMinmax
;
4538 table
->GetMinmaxParameterfv
= _mesa_GetMinmaxParameterfv
;
4539 table
->GetMinmaxParameteriv
= _mesa_GetMinmaxParameteriv
;
4540 table
->GetSeparableFilter
= _mesa_GetSeparableFilter
;
4541 table
->Histogram
= _mesa_Histogram
;
4542 table
->Minmax
= _mesa_Minmax
;
4543 table
->ResetHistogram
= _mesa_ResetHistogram
;
4544 table
->ResetMinmax
= _mesa_ResetMinmax
;
4545 table
->SeparableFilter2D
= _mesa_SeparableFilter2D
;
4547 /* GL_EXT_texture3d */
4549 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
4550 table
->TexImage3DEXT
= save_TexImage3DEXT
;
4551 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
4554 /* GL_EXT_paletted_texture */
4556 table
->ColorTableEXT
= save_ColorTable
;
4557 table
->ColorSubTableEXT
= save_ColorSubTable
;
4559 table
->GetColorTableEXT
= _mesa_GetColorTable
;
4560 table
->GetColorTableParameterfvEXT
= _mesa_GetColorTableParameterfv
;
4561 table
->GetColorTableParameterivEXT
= _mesa_GetColorTableParameteriv
;
4563 /* GL_EXT_compiled_vertex_array */
4564 table
->LockArraysEXT
= _mesa_LockArraysEXT
;
4565 table
->UnlockArraysEXT
= _mesa_UnlockArraysEXT
;
4567 /* GL_EXT_point_parameters */
4568 table
->PointParameterfEXT
= save_PointParameterfEXT
;
4569 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
4571 /* GL_PGI_misc_hints */
4572 table
->HintPGI
= save_HintPGI
;
4574 /* GL_EXT_polygon_offset */
4575 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
4577 /* GL_EXT_blend_minmax */
4579 table
->BlendEquationEXT
= save_BlendEquationEXT
;
4582 /* GL_EXT_blend_color */
4584 table
->BlendColorEXT
= save_BlendColorEXT
;
4587 /* GL_ARB_multitexture */
4588 table
->ActiveTextureARB
= save_ActiveTextureARB
;
4589 table
->ClientActiveTextureARB
= save_ClientActiveTextureARB
;
4590 table
->MultiTexCoord1dARB
= _mesa_MultiTexCoord1dARB
;
4591 table
->MultiTexCoord1dvARB
= _mesa_MultiTexCoord1dvARB
;
4592 table
->MultiTexCoord1fARB
= _mesa_MultiTexCoord1fARB
;
4593 table
->MultiTexCoord1fvARB
= _mesa_MultiTexCoord1fvARB
;
4594 table
->MultiTexCoord1iARB
= _mesa_MultiTexCoord1iARB
;
4595 table
->MultiTexCoord1ivARB
= _mesa_MultiTexCoord1ivARB
;
4596 table
->MultiTexCoord1sARB
= _mesa_MultiTexCoord1sARB
;
4597 table
->MultiTexCoord1svARB
= _mesa_MultiTexCoord1svARB
;
4598 table
->MultiTexCoord2dARB
= _mesa_MultiTexCoord2dARB
;
4599 table
->MultiTexCoord2dvARB
= _mesa_MultiTexCoord2dvARB
;
4600 table
->MultiTexCoord2fARB
= _mesa_MultiTexCoord2fARB
;
4601 table
->MultiTexCoord2fvARB
= _mesa_MultiTexCoord2fvARB
;
4602 table
->MultiTexCoord2iARB
= _mesa_MultiTexCoord2iARB
;
4603 table
->MultiTexCoord2ivARB
= _mesa_MultiTexCoord2ivARB
;
4604 table
->MultiTexCoord2sARB
= _mesa_MultiTexCoord2sARB
;
4605 table
->MultiTexCoord2svARB
= _mesa_MultiTexCoord2svARB
;
4606 table
->MultiTexCoord3dARB
= _mesa_MultiTexCoord3dARB
;
4607 table
->MultiTexCoord3dvARB
= _mesa_MultiTexCoord3dvARB
;
4608 table
->MultiTexCoord3fARB
= _mesa_MultiTexCoord3fARB
;
4609 table
->MultiTexCoord3fvARB
= _mesa_MultiTexCoord3fvARB
;
4610 table
->MultiTexCoord3iARB
= _mesa_MultiTexCoord3iARB
;
4611 table
->MultiTexCoord3ivARB
= _mesa_MultiTexCoord3ivARB
;
4612 table
->MultiTexCoord3sARB
= _mesa_MultiTexCoord3sARB
;
4613 table
->MultiTexCoord3svARB
= _mesa_MultiTexCoord3svARB
;
4614 table
->MultiTexCoord4dARB
= _mesa_MultiTexCoord4dARB
;
4615 table
->MultiTexCoord4dvARB
= _mesa_MultiTexCoord4dvARB
;
4616 table
->MultiTexCoord4fARB
= _mesa_MultiTexCoord4fARB
;
4617 table
->MultiTexCoord4fvARB
= _mesa_MultiTexCoord4fvARB
;
4618 table
->MultiTexCoord4iARB
= _mesa_MultiTexCoord4iARB
;
4619 table
->MultiTexCoord4ivARB
= _mesa_MultiTexCoord4ivARB
;
4620 table
->MultiTexCoord4sARB
= _mesa_MultiTexCoord4sARB
;
4621 table
->MultiTexCoord4svARB
= _mesa_MultiTexCoord4svARB
;
4623 /* GL_EXT_blend_func_separate */
4624 table
->BlendFuncSeparateEXT
= save_BlendFuncSeparateEXT
;
4626 /* GL_MESA_window_pos */
4627 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
4628 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
4629 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
4630 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
4631 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
4632 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
4633 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
4634 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
4635 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
4636 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
4637 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
4638 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
4639 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
4640 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
4641 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
4642 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
4643 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
4644 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
4645 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
4646 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
4647 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
4648 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
4649 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
4650 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
4652 /* GL_MESA_resize_buffers */
4653 table
->ResizeBuffersMESA
= _mesa_ResizeBuffersMESA
;
4655 /* GL_ARB_transpose_matrix */
4656 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
4657 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
4658 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
4659 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
4668 static const char *enum_string( GLenum k
)
4670 return gl_lookup_enum_by_nr( k
);
4675 * Print the commands in a display list. For debugging only.
4676 * TODO: many commands aren't handled yet.
4678 static void print_list( GLcontext
*ctx
, FILE *f
, GLuint list
)
4684 if (!glIsList(list
)) {
4685 fprintf(f
,"%u is not a display list ID\n",list
);
4689 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
4691 fprintf( f
, "START-LIST %u, address %p\n", list
, (void*)n
);
4693 done
= n
? GL_FALSE
: GL_TRUE
;
4695 opcode
= n
[0].opcode
;
4699 fprintf(f
,"accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
4702 fprintf(f
,"Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
4703 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
4705 case OPCODE_CALL_LIST
:
4706 fprintf(f
,"CallList %d\n", (int) n
[1].ui
);
4708 case OPCODE_CALL_LIST_OFFSET
:
4709 fprintf(f
,"CallList %d + offset %u = %u\n", (int) n
[1].ui
,
4710 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
4712 case OPCODE_DISABLE
:
4713 fprintf(f
,"Disable %s\n", enum_string(n
[1].e
));
4716 fprintf(f
,"Enable %s\n", enum_string(n
[1].e
));
4718 case OPCODE_FRUSTUM
:
4719 fprintf(f
,"Frustum %g %g %g %g %g %g\n",
4720 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4722 case OPCODE_LINE_STIPPLE
:
4723 fprintf(f
,"LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
4725 case OPCODE_LOAD_IDENTITY
:
4726 fprintf(f
,"LoadIdentity\n");
4728 case OPCODE_LOAD_MATRIX
:
4729 fprintf(f
,"LoadMatrix\n");
4730 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
4731 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
4732 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
4733 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
4735 case OPCODE_MULT_MATRIX
:
4736 fprintf(f
,"MultMatrix (or Rotate)\n");
4737 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
4738 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
4739 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
4740 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
4743 fprintf(f
,"Ortho %g %g %g %g %g %g\n",
4744 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4746 case OPCODE_POP_ATTRIB
:
4747 fprintf(f
,"PopAttrib\n");
4749 case OPCODE_POP_MATRIX
:
4750 fprintf(f
,"PopMatrix\n");
4752 case OPCODE_POP_NAME
:
4753 fprintf(f
,"PopName\n");
4755 case OPCODE_PUSH_ATTRIB
:
4756 fprintf(f
,"PushAttrib %x\n", n
[1].bf
);
4758 case OPCODE_PUSH_MATRIX
:
4759 fprintf(f
,"PushMatrix\n");
4761 case OPCODE_PUSH_NAME
:
4762 fprintf(f
,"PushName %d\n", (int) n
[1].ui
);
4764 case OPCODE_RASTER_POS
:
4765 fprintf(f
,"RasterPos %g %g %g %g\n", n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
4768 fprintf( f
, "Rectf %g %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4771 fprintf(f
,"Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
4773 case OPCODE_TRANSLATE
:
4774 fprintf(f
,"Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
4776 case OPCODE_BIND_TEXTURE
:
4777 fprintf(f
,"BindTexture %s %d\n", gl_lookup_enum_by_nr(n
[1].ui
),
4780 case OPCODE_SHADE_MODEL
:
4781 fprintf(f
,"ShadeModel %s\n", gl_lookup_enum_by_nr(n
[1].ui
));
4785 * meta opcodes/commands
4788 fprintf(f
,"Error: %s %s\n", enum_string(n
[1].e
), (const char *)n
[2].data
);
4790 case OPCODE_VERTEX_CASSETTE
:
4791 fprintf(f
,"VERTEX-CASSETTE, id %u, rows %u..%u\n",
4792 ((struct immediate
*) n
[1].data
)->id
,
4795 gl_print_cassette( (struct immediate
*) n
[1].data
);
4797 case OPCODE_CONTINUE
:
4798 fprintf(f
,"DISPLAY-LIST-CONTINUE\n");
4799 n
= (Node
*) n
[1].next
;
4801 case OPCODE_END_OF_LIST
:
4802 fprintf(f
,"END-LIST %u\n", list
);
4806 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
4807 fprintf(f
,"ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
4812 fprintf(f
,"command %d, %u operands\n",opcode
,InstSize
[opcode
]);
4816 /* increment n to point to next compiled command */
4817 if (opcode
!=OPCODE_CONTINUE
) {
4818 n
+= InstSize
[opcode
];
4826 * Clients may call this function to help debug display list problems.
4827 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
4828 * changed, or break in the future without notice.
4830 void mesa_print_display_list( GLuint list
)
4832 GET_CURRENT_CONTEXT(ctx
);
4833 print_list( ctx
, stderr
, list
);