1 /* $Id: dlist.c,v 1.18 1999/11/12 23:38:42 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999 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.
48 #include "extensions.h"
88 Functions which aren't compiled but executed immediately:
103 Functions which cause errors if called while compiling a display list:
110 * Display list instructions are stored as sequences of "nodes". Nodes
111 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
112 * are linked together with a pointer.
116 /* How many nodes to allocate at a time:
117 * - reduced now that we hold vertices etc. elsewhere.
119 #define BLOCK_SIZE 64
123 * Display list opcodes.
125 * The fact that these identifiers are assigned consecutive
126 * integer values starting at 0 is very important, see InstSize array usage)
128 * KW: Commented out opcodes now handled by vertex-cassettes.
136 OPCODE_BLEND_EQUATION
,
138 OPCODE_BLEND_FUNC_SEPARATE
,
140 OPCODE_CALL_LIST_OFFSET
,
146 OPCODE_CLEAR_STENCIL
,
149 OPCODE_COLOR_MATERIAL
,
151 OPCODE_COLOR_SUB_TABLE
,
153 OPCODE_COPY_TEX_IMAGE1D
,
154 OPCODE_COPY_TEX_IMAGE2D
,
155 OPCODE_COPY_TEX_SUB_IMAGE1D
,
156 OPCODE_COPY_TEX_SUB_IMAGE2D
,
157 OPCODE_COPY_TEX_SUB_IMAGE3D
,
183 OPCODE_LOAD_IDENTITY
,
196 OPCODE_PIXEL_TRANSFER
,
199 OPCODE_POINT_PARAMETERS
,
201 OPCODE_POLYGON_STIPPLE
,
202 OPCODE_POLYGON_OFFSET
,
206 OPCODE_PRIORITIZE_TEXTURE
,
215 OPCODE_SELECT_TEXTURE_SGIS
,
216 OPCODE_SELECT_TEXTURE_COORD_SET
,
227 OPCODE_TEX_SUB_IMAGE1D
,
228 OPCODE_TEX_SUB_IMAGE2D
,
229 OPCODE_TEX_SUB_IMAGE3D
,
233 /* GL_ARB_multitexture */
234 OPCODE_ACTIVE_TEXTURE
,
235 OPCODE_CLIENT_ACTIVE_TEXTURE
,
236 /* The following three are meta instructions */
237 OPCODE_ERROR
, /* raise compiled-in error */
238 OPCODE_VERTEX_CASSETTE
, /* render prebuilt vertex buffer */
245 * Each instruction in the display list is stored as a sequence of
246 * contiguous nodes in memory.
247 * Each node is the union of a variety of datatypes.
261 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
266 /* Number of nodes of storage needed for each instruction: */
267 static GLuint InstSize
[ OPCODE_END_OF_LIST
+1 ];
269 void mesa_print_display_list( GLuint list
);
272 /**********************************************************************/
273 /***** Private *****/
274 /**********************************************************************/
278 * Allocate space for a display list instruction.
279 * Input: opcode - type of instruction
280 * argcount - number of arguments following the instruction
281 * Return: pointer to first node in the instruction
283 static Node
*alloc_instruction( GLcontext
*ctx
, OpCode opcode
, GLint argcount
)
286 GLuint count
= InstSize
[opcode
];
288 assert( (GLint
) count
== argcount
+1 );
290 if (ctx
->CurrentPos
+ count
+ 2 > BLOCK_SIZE
) {
291 /* This block is full. Allocate a new block and chain to it */
292 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
293 n
[0].opcode
= OPCODE_CONTINUE
;
294 newblock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
296 gl_error( ctx
, GL_OUT_OF_MEMORY
, "Building display list" );
299 n
[1].next
= (Node
*) newblock
;
300 ctx
->CurrentBlock
= newblock
;
304 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
305 ctx
->CurrentPos
+= count
;
307 n
[0].opcode
= opcode
;
315 * Make an empty display list. This is used by glGenLists() to
316 * reserver display list IDs.
318 static Node
*make_empty_list( void )
320 Node
*n
= (Node
*) MALLOC( sizeof(Node
) );
321 n
[0].opcode
= OPCODE_END_OF_LIST
;
328 * Destroy all nodes in a display list.
329 * Input: list - display list number
331 void gl_destroy_list( GLcontext
*ctx
, GLuint list
)
339 block
= (Node
*) HashLookup(ctx
->Shared
->DisplayList
, list
);
342 done
= block
? GL_FALSE
: GL_TRUE
;
344 switch (n
[0].opcode
) {
345 /* special cases first */
346 case OPCODE_VERTEX_CASSETTE
:
347 if ( ! -- ((struct immediate
*) n
[1].data
)->ref_count
)
348 gl_immediate_free( (struct immediate
*) n
[1].data
);
349 n
+= InstSize
[n
[0].opcode
];
353 n
+= InstSize
[n
[0].opcode
];
357 n
+= InstSize
[n
[0].opcode
];
359 case OPCODE_DRAW_PIXELS
:
361 n
+= InstSize
[n
[0].opcode
];
365 n
+= InstSize
[n
[0].opcode
];
367 case OPCODE_COLOR_TABLE
:
369 n
+= InstSize
[n
[0].opcode
];
371 case OPCODE_COLOR_SUB_TABLE
:
373 n
+= InstSize
[n
[0].opcode
];
375 case OPCODE_POLYGON_STIPPLE
:
377 n
+= InstSize
[n
[0].opcode
];
379 case OPCODE_TEX_IMAGE1D
:
381 n
+= InstSize
[n
[0].opcode
];
383 case OPCODE_TEX_IMAGE2D
:
385 n
+= InstSize
[n
[0].opcode
];
387 case OPCODE_TEX_IMAGE3D
:
389 n
+= InstSize
[n
[0].opcode
];
391 case OPCODE_TEX_SUB_IMAGE1D
:
393 n
+= InstSize
[n
[0].opcode
];
395 case OPCODE_TEX_SUB_IMAGE2D
:
397 n
+= InstSize
[n
[0].opcode
];
399 case OPCODE_TEX_SUB_IMAGE3D
:
401 n
+= InstSize
[n
[0].opcode
];
403 case OPCODE_CONTINUE
:
404 n
= (Node
*) n
[1].next
;
408 case OPCODE_END_OF_LIST
:
413 /* Most frequent case */
414 n
+= InstSize
[n
[0].opcode
];
419 HashRemove(ctx
->Shared
->DisplayList
, list
);
425 * Translate the nth element of list from type to GLuint.
427 static GLuint
translate_id( GLsizei n
, GLenum type
, const GLvoid
*list
)
439 bptr
= (GLbyte
*) list
;
440 return (GLuint
) *(bptr
+n
);
441 case GL_UNSIGNED_BYTE
:
442 ubptr
= (GLubyte
*) list
;
443 return (GLuint
) *(ubptr
+n
);
445 sptr
= (GLshort
*) list
;
446 return (GLuint
) *(sptr
+n
);
447 case GL_UNSIGNED_SHORT
:
448 usptr
= (GLushort
*) list
;
449 return (GLuint
) *(usptr
+n
);
451 iptr
= (GLint
*) list
;
452 return (GLuint
) *(iptr
+n
);
453 case GL_UNSIGNED_INT
:
454 uiptr
= (GLuint
*) list
;
455 return (GLuint
) *(uiptr
+n
);
457 fptr
= (GLfloat
*) list
;
458 return (GLuint
) *(fptr
+n
);
460 ubptr
= ((GLubyte
*) list
) + 2*n
;
461 return (GLuint
) *ubptr
* 256 + (GLuint
) *(ubptr
+1);
463 ubptr
= ((GLubyte
*) list
) + 3*n
;
464 return (GLuint
) *ubptr
* 65536
465 + (GLuint
) *(ubptr
+1) * 256
466 + (GLuint
) *(ubptr
+2);
468 ubptr
= ((GLubyte
*) list
) + 4*n
;
469 return (GLuint
) *ubptr
* 16777216
470 + (GLuint
) *(ubptr
+1) * 65536
471 + (GLuint
) *(ubptr
+2) * 256
472 + (GLuint
) *(ubptr
+3);
481 /**********************************************************************/
483 /**********************************************************************/
485 void gl_init_lists( void )
487 static int init_flag
= 0;
490 InstSize
[OPCODE_ACCUM
] = 3;
491 InstSize
[OPCODE_ALPHA_FUNC
] = 3;
492 InstSize
[OPCODE_BIND_TEXTURE
] = 3;
493 InstSize
[OPCODE_BITMAP
] = 8;
494 InstSize
[OPCODE_BLEND_COLOR
] = 5;
495 InstSize
[OPCODE_BLEND_EQUATION
] = 2;
496 InstSize
[OPCODE_BLEND_FUNC
] = 3;
497 InstSize
[OPCODE_BLEND_FUNC_SEPARATE
] = 5;
498 InstSize
[OPCODE_CALL_LIST
] = 2;
499 InstSize
[OPCODE_CALL_LIST_OFFSET
] = 2;
500 InstSize
[OPCODE_CLEAR
] = 2;
501 InstSize
[OPCODE_CLEAR_ACCUM
] = 5;
502 InstSize
[OPCODE_CLEAR_COLOR
] = 5;
503 InstSize
[OPCODE_CLEAR_DEPTH
] = 2;
504 InstSize
[OPCODE_CLEAR_INDEX
] = 2;
505 InstSize
[OPCODE_CLEAR_STENCIL
] = 2;
506 InstSize
[OPCODE_CLIP_PLANE
] = 6;
507 InstSize
[OPCODE_COLOR_MASK
] = 5;
508 InstSize
[OPCODE_COLOR_MATERIAL
] = 3;
509 InstSize
[OPCODE_COLOR_TABLE
] = 7;
510 InstSize
[OPCODE_COLOR_SUB_TABLE
] = 7;
511 InstSize
[OPCODE_COPY_PIXELS
] = 6;
512 InstSize
[OPCODE_COPY_TEX_IMAGE1D
] = 8;
513 InstSize
[OPCODE_COPY_TEX_IMAGE2D
] = 9;
514 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE1D
] = 7;
515 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE2D
] = 9;
516 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE3D
] = 10;
517 InstSize
[OPCODE_CULL_FACE
] = 2;
518 InstSize
[OPCODE_DEPTH_FUNC
] = 2;
519 InstSize
[OPCODE_DEPTH_MASK
] = 2;
520 InstSize
[OPCODE_DEPTH_RANGE
] = 3;
521 InstSize
[OPCODE_DISABLE
] = 2;
522 InstSize
[OPCODE_DRAW_BUFFER
] = 2;
523 InstSize
[OPCODE_DRAW_PIXELS
] = 6;
524 InstSize
[OPCODE_ENABLE
] = 2;
525 InstSize
[OPCODE_EVALCOORD1
] = 2;
526 InstSize
[OPCODE_EVALCOORD2
] = 3;
527 InstSize
[OPCODE_EVALMESH1
] = 4;
528 InstSize
[OPCODE_EVALMESH2
] = 6;
529 InstSize
[OPCODE_EVALPOINT1
] = 2;
530 InstSize
[OPCODE_EVALPOINT2
] = 3;
531 InstSize
[OPCODE_FOG
] = 6;
532 InstSize
[OPCODE_FRONT_FACE
] = 2;
533 InstSize
[OPCODE_FRUSTUM
] = 7;
534 InstSize
[OPCODE_HINT
] = 3;
535 InstSize
[OPCODE_INDEX_MASK
] = 2;
536 InstSize
[OPCODE_INIT_NAMES
] = 1;
537 InstSize
[OPCODE_LIGHT
] = 7;
538 InstSize
[OPCODE_LIGHT_MODEL
] = 6;
539 InstSize
[OPCODE_LINE_STIPPLE
] = 3;
540 InstSize
[OPCODE_LINE_WIDTH
] = 2;
541 InstSize
[OPCODE_LIST_BASE
] = 2;
542 InstSize
[OPCODE_LOAD_IDENTITY
] = 1;
543 InstSize
[OPCODE_LOAD_MATRIX
] = 17;
544 InstSize
[OPCODE_LOAD_NAME
] = 2;
545 InstSize
[OPCODE_LOGIC_OP
] = 2;
546 InstSize
[OPCODE_MAP1
] = 7;
547 InstSize
[OPCODE_MAP2
] = 11;
548 InstSize
[OPCODE_MAPGRID1
] = 4;
549 InstSize
[OPCODE_MAPGRID2
] = 7;
550 InstSize
[OPCODE_MATRIX_MODE
] = 2;
551 InstSize
[OPCODE_MULT_MATRIX
] = 17;
552 InstSize
[OPCODE_ORTHO
] = 7;
553 InstSize
[OPCODE_PASSTHROUGH
] = 2;
554 InstSize
[OPCODE_PIXEL_MAP
] = 4;
555 InstSize
[OPCODE_PIXEL_TRANSFER
] = 3;
556 InstSize
[OPCODE_PIXEL_ZOOM
] = 3;
557 InstSize
[OPCODE_POINT_SIZE
] = 2;
558 InstSize
[OPCODE_POINT_PARAMETERS
] = 5;
559 InstSize
[OPCODE_POLYGON_MODE
] = 3;
560 InstSize
[OPCODE_POLYGON_STIPPLE
] = 2;
561 InstSize
[OPCODE_POLYGON_OFFSET
] = 3;
562 InstSize
[OPCODE_POP_ATTRIB
] = 1;
563 InstSize
[OPCODE_POP_MATRIX
] = 1;
564 InstSize
[OPCODE_POP_NAME
] = 1;
565 InstSize
[OPCODE_PRIORITIZE_TEXTURE
] = 3;
566 InstSize
[OPCODE_PUSH_ATTRIB
] = 2;
567 InstSize
[OPCODE_PUSH_MATRIX
] = 1;
568 InstSize
[OPCODE_PUSH_NAME
] = 2;
569 InstSize
[OPCODE_RASTER_POS
] = 5;
570 InstSize
[OPCODE_RECTF
] = 5;
571 InstSize
[OPCODE_READ_BUFFER
] = 2;
572 InstSize
[OPCODE_SCALE
] = 4;
573 InstSize
[OPCODE_SCISSOR
] = 5;
574 InstSize
[OPCODE_STENCIL_FUNC
] = 4;
575 InstSize
[OPCODE_STENCIL_MASK
] = 2;
576 InstSize
[OPCODE_STENCIL_OP
] = 4;
577 InstSize
[OPCODE_SHADE_MODEL
] = 2;
578 InstSize
[OPCODE_TEXENV
] = 7;
579 InstSize
[OPCODE_TEXGEN
] = 7;
580 InstSize
[OPCODE_TEXPARAMETER
] = 7;
581 InstSize
[OPCODE_TEX_IMAGE1D
] = 9;
582 InstSize
[OPCODE_TEX_IMAGE2D
] = 10;
583 InstSize
[OPCODE_TEX_IMAGE3D
] = 11;
584 InstSize
[OPCODE_TEX_SUB_IMAGE1D
] = 8;
585 InstSize
[OPCODE_TEX_SUB_IMAGE2D
] = 10;
586 InstSize
[OPCODE_TEX_SUB_IMAGE3D
] = 12;
587 InstSize
[OPCODE_TRANSLATE
] = 4;
588 InstSize
[OPCODE_VIEWPORT
] = 5;
589 InstSize
[OPCODE_WINDOW_POS
] = 5;
590 InstSize
[OPCODE_CONTINUE
] = 2;
591 InstSize
[OPCODE_ERROR
] = 3;
592 InstSize
[OPCODE_VERTEX_CASSETTE
] = 9;
593 InstSize
[OPCODE_END_OF_LIST
] = 1;
594 /* GL_ARB_multitexture */
595 InstSize
[OPCODE_ACTIVE_TEXTURE
] = 2;
596 InstSize
[OPCODE_CLIENT_ACTIVE_TEXTURE
] = 2;
603 * Display List compilation functions
608 static void save_Accum( GLenum op
, GLfloat value
)
610 GET_CURRENT_CONTEXT(ctx
);
612 FLUSH_VB(ctx
, "dlist");
613 n
= alloc_instruction( ctx
, OPCODE_ACCUM
, 2 );
618 if (ctx
->ExecuteFlag
) {
619 (*ctx
->Exec
.Accum
)( op
, value
);
624 static void save_AlphaFunc( GLenum func
, GLclampf ref
)
626 GET_CURRENT_CONTEXT(ctx
);
628 FLUSH_VB(ctx
, "dlist");
629 n
= alloc_instruction( ctx
, OPCODE_ALPHA_FUNC
, 2 );
632 n
[2].f
= (GLfloat
) ref
;
634 if (ctx
->ExecuteFlag
) {
635 (*ctx
->Exec
.AlphaFunc
)( func
, ref
);
640 static void save_Begin( GLenum mode
)
642 _mesa_Begin(mode
); /* special case */
646 static void save_BindTexture( GLenum target
, GLuint texture
)
648 GET_CURRENT_CONTEXT(ctx
);
650 FLUSH_VB(ctx
, "dlist");
651 n
= alloc_instruction( ctx
, OPCODE_BIND_TEXTURE
, 2 );
656 if (ctx
->ExecuteFlag
) {
657 (*ctx
->Exec
.BindTexture
)( target
, texture
);
662 static void save_Bitmap( GLsizei width
, GLsizei height
,
663 GLfloat xorig
, GLfloat yorig
,
664 GLfloat xmove
, GLfloat ymove
,
665 const GLubyte
*pixels
)
667 GET_CURRENT_CONTEXT(ctx
);
668 GLvoid
*image
= _mesa_unpack_bitmap( width
, height
, pixels
, &ctx
->Unpack
);
670 FLUSH_VB(ctx
, "dlist");
671 n
= alloc_instruction( ctx
, OPCODE_BITMAP
, 7 );
673 n
[1].i
= (GLint
) width
;
674 n
[2].i
= (GLint
) height
;
684 if (ctx
->ExecuteFlag
) {
685 (*ctx
->Exec
.Bitmap
)( width
, height
,
686 xorig
, yorig
, xmove
, ymove
, pixels
);
691 static void save_BlendEquation( GLenum mode
)
693 GET_CURRENT_CONTEXT(ctx
);
695 FLUSH_VB(ctx
, "dlist");
696 n
= alloc_instruction( ctx
, OPCODE_BLEND_EQUATION
, 1 );
700 if (ctx
->ExecuteFlag
) {
701 (*ctx
->Exec
.BlendEquationEXT
)( mode
);
706 static void save_BlendFunc( GLenum sfactor
, GLenum dfactor
)
708 GET_CURRENT_CONTEXT(ctx
);
710 FLUSH_VB(ctx
, "dlist");
711 n
= alloc_instruction( ctx
, OPCODE_BLEND_FUNC
, 2 );
716 if (ctx
->ExecuteFlag
) {
717 (*ctx
->Exec
.BlendFunc
)( sfactor
, dfactor
);
722 static void save_BlendFuncSeparateINGR(GLenum sfactorRGB
, GLenum dfactorRGB
,
723 GLenum sfactorA
, GLenum dfactorA
)
725 GET_CURRENT_CONTEXT(ctx
);
727 FLUSH_VB(ctx
, "dlist");
728 n
= alloc_instruction( ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4 );
735 if (ctx
->ExecuteFlag
) {
736 (*ctx
->Exec
.BlendFuncSeparateINGR
)( sfactorRGB
, dfactorRGB
,
742 static void save_BlendColor( GLfloat red
, GLfloat green
,
743 GLfloat blue
, GLfloat alpha
)
745 GET_CURRENT_CONTEXT(ctx
);
747 FLUSH_VB(ctx
, "dlist");
748 n
= alloc_instruction( ctx
, OPCODE_BLEND_COLOR
, 4 );
755 if (ctx
->ExecuteFlag
) {
756 (*ctx
->Exec
.BlendColorEXT
)( red
, green
, blue
, alpha
);
761 static void save_CallList( GLuint list
)
763 GET_CURRENT_CONTEXT(ctx
);
765 FLUSH_VB(ctx
, "dlist");
766 n
= alloc_instruction( ctx
, OPCODE_CALL_LIST
, 1 );
770 if (ctx
->ExecuteFlag
) {
771 (*ctx
->Exec
.CallList
)( list
);
776 static void save_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
778 GET_CURRENT_CONTEXT(ctx
);
780 FLUSH_VB(ctx
, "dlist");
783 GLuint list
= translate_id( i
, type
, lists
);
784 Node
*n
= alloc_instruction( ctx
, OPCODE_CALL_LIST_OFFSET
, 1 );
789 if (ctx
->ExecuteFlag
) {
790 (*ctx
->Exec
.CallLists
)( n
, type
, lists
);
795 static void save_Clear( GLbitfield mask
)
797 GET_CURRENT_CONTEXT(ctx
);
799 FLUSH_VB(ctx
, "dlist");
800 n
= alloc_instruction( ctx
, OPCODE_CLEAR
, 1 );
804 if (ctx
->ExecuteFlag
) {
805 (*ctx
->Exec
.Clear
)( mask
);
810 static void save_ClearAccum( GLfloat red
, GLfloat green
,
811 GLfloat blue
, GLfloat alpha
)
813 GET_CURRENT_CONTEXT(ctx
);
815 FLUSH_VB(ctx
, "dlist");
816 n
= alloc_instruction( ctx
, OPCODE_CLEAR_ACCUM
, 4 );
823 if (ctx
->ExecuteFlag
) {
824 (*ctx
->Exec
.ClearAccum
)( red
, green
, blue
, alpha
);
829 static void save_ClearColor( GLclampf red
, GLclampf green
,
830 GLclampf blue
, GLclampf alpha
)
832 GET_CURRENT_CONTEXT(ctx
);
834 FLUSH_VB(ctx
, "dlist");
835 n
= alloc_instruction( ctx
, OPCODE_CLEAR_COLOR
, 4 );
842 if (ctx
->ExecuteFlag
) {
843 (*ctx
->Exec
.ClearColor
)( red
, green
, blue
, alpha
);
848 static void save_ClearDepth( GLclampd depth
)
850 GET_CURRENT_CONTEXT(ctx
);
852 FLUSH_VB(ctx
, "dlist");
853 n
= alloc_instruction( ctx
, OPCODE_CLEAR_DEPTH
, 1 );
855 n
[1].f
= (GLfloat
) depth
;
857 if (ctx
->ExecuteFlag
) {
858 (*ctx
->Exec
.ClearDepth
)( depth
);
863 static void save_ClearIndex( GLfloat c
)
865 GET_CURRENT_CONTEXT(ctx
);
867 FLUSH_VB(ctx
, "dlist");
868 n
= alloc_instruction( ctx
, OPCODE_CLEAR_INDEX
, 1 );
872 if (ctx
->ExecuteFlag
) {
873 (*ctx
->Exec
.ClearIndex
)( c
);
878 static void save_ClearStencil( GLint s
)
880 GET_CURRENT_CONTEXT(ctx
);
882 FLUSH_VB(ctx
, "dlist");
883 n
= alloc_instruction( ctx
, OPCODE_CLEAR_STENCIL
, 1 );
887 if (ctx
->ExecuteFlag
) {
888 (*ctx
->Exec
.ClearStencil
)( s
);
893 static void save_ClipPlane( GLenum plane
, const GLdouble
*equ
)
895 GET_CURRENT_CONTEXT(ctx
);
897 FLUSH_VB(ctx
, "dlist");
898 n
= alloc_instruction( ctx
, OPCODE_CLIP_PLANE
, 5 );
906 if (ctx
->ExecuteFlag
) {
907 (*ctx
->Exec
.ClipPlane
)( plane
, equ
);
913 static void save_ColorMask( GLboolean red
, GLboolean green
,
914 GLboolean blue
, GLboolean alpha
)
916 GET_CURRENT_CONTEXT(ctx
);
918 FLUSH_VB(ctx
, "dlist");
919 n
= alloc_instruction( ctx
, OPCODE_COLOR_MASK
, 4 );
926 if (ctx
->ExecuteFlag
) {
927 (*ctx
->Exec
.ColorMask
)( red
, green
, blue
, alpha
);
932 static void save_ColorMaterial( GLenum face
, GLenum mode
)
934 GET_CURRENT_CONTEXT(ctx
);
936 FLUSH_VB(ctx
, "dlist");
937 n
= alloc_instruction( ctx
, OPCODE_COLOR_MATERIAL
, 2 );
942 if (ctx
->ExecuteFlag
) {
943 (*ctx
->Exec
.ColorMaterial
)( face
, mode
);
948 static void save_ColorTableEXT( GLenum target
, GLenum internalFormat
,
949 GLsizei width
, GLenum format
, GLenum type
,
950 const GLvoid
*table
)
952 GET_CURRENT_CONTEXT(ctx
);
953 if (target
== GL_PROXY_TEXTURE_1D
||
954 target
== GL_PROXY_TEXTURE_2D
||
955 target
== GL_PROXY_TEXTURE_3D
) {
956 /* execute immediately */
957 (*ctx
->Exec
.ColorTableEXT
)( target
, internalFormat
, width
,
958 format
, type
, table
);
961 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, table
,
964 FLUSH_VB(ctx
, "dlist");
965 n
= alloc_instruction( ctx
, OPCODE_COLOR_TABLE
, 6 );
968 n
[2].e
= internalFormat
;
977 if (ctx
->ExecuteFlag
) {
978 (*ctx
->Exec
.ColorTableEXT
)( target
, internalFormat
, width
,
979 format
, type
, table
);
985 static void save_ColorSubTableEXT( GLenum target
, GLsizei start
, GLsizei count
,
986 GLenum format
, GLenum type
,
989 GET_CURRENT_CONTEXT(ctx
);
990 GLvoid
*image
= _mesa_unpack_image(count
, 1, 1, format
, type
, table
,
993 FLUSH_VB(ctx
, "dlist");
994 n
= alloc_instruction( ctx
, OPCODE_COLOR_SUB_TABLE
, 6 );
1006 if (ctx
->ExecuteFlag
) {
1007 (*ctx
->Exec
.ColorSubTableEXT
)(target
, start
, count
, format
, type
, table
);
1013 static void save_CopyPixels( GLint x
, GLint y
,
1014 GLsizei width
, GLsizei height
, GLenum type
)
1016 GET_CURRENT_CONTEXT(ctx
);
1018 FLUSH_VB(ctx
, "dlist");
1019 n
= alloc_instruction( ctx
, OPCODE_COPY_PIXELS
, 5 );
1023 n
[3].i
= (GLint
) width
;
1024 n
[4].i
= (GLint
) height
;
1027 if (ctx
->ExecuteFlag
) {
1028 (*ctx
->Exec
.CopyPixels
)( x
, y
, width
, height
, type
);
1035 save_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
1036 GLint x
, GLint y
, GLsizei width
, GLint border
)
1038 GET_CURRENT_CONTEXT(ctx
);
1040 FLUSH_VB(ctx
, "dlist");
1041 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7 );
1045 n
[3].e
= internalformat
;
1051 if (ctx
->ExecuteFlag
) {
1052 (*ctx
->Exec
.CopyTexImage1D
)( target
, level
, internalformat
,
1053 x
, y
, width
, border
);
1059 save_CopyTexImage2D( GLenum target
, GLint level
,
1060 GLenum internalformat
,
1061 GLint x
, GLint y
, GLsizei width
,
1062 GLsizei height
, GLint border
)
1064 GET_CURRENT_CONTEXT(ctx
);
1066 FLUSH_VB(ctx
, "dlist");
1067 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8 );
1071 n
[3].e
= internalformat
;
1078 if (ctx
->ExecuteFlag
) {
1079 (*ctx
->Exec
.CopyTexImage2D
)( target
, level
, internalformat
,
1080 x
, y
, width
, height
, border
);
1087 save_CopyTexSubImage1D( GLenum target
, GLint level
,
1088 GLint xoffset
, GLint x
, GLint y
,
1091 GET_CURRENT_CONTEXT(ctx
);
1093 FLUSH_VB(ctx
, "dlist");
1094 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6 );
1103 if (ctx
->ExecuteFlag
) {
1104 (*ctx
->Exec
.CopyTexSubImage1D
)( target
, level
, xoffset
, x
, y
, width
);
1110 save_CopyTexSubImage2D( GLenum target
, GLint level
,
1111 GLint xoffset
, GLint yoffset
,
1113 GLsizei width
, GLint height
)
1115 GET_CURRENT_CONTEXT(ctx
);
1117 FLUSH_VB(ctx
, "dlist");
1118 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8 );
1129 if (ctx
->ExecuteFlag
) {
1130 (*ctx
->Exec
.CopyTexSubImage2D
)( target
, level
, xoffset
, yoffset
,
1131 x
, y
, width
, height
);
1137 save_CopyTexSubImage3D( GLenum target
, GLint level
,
1138 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1140 GLsizei width
, GLint height
)
1142 GET_CURRENT_CONTEXT(ctx
);
1144 FLUSH_VB(ctx
, "dlist");
1145 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9 );
1157 if (ctx
->ExecuteFlag
) {
1158 (*ctx
->Exec
.CopyTexSubImage3D
)( target
, level
,
1159 xoffset
, yoffset
, zoffset
,
1160 x
, y
, width
, height
);
1165 static void save_CullFace( GLenum mode
)
1167 GET_CURRENT_CONTEXT(ctx
);
1169 FLUSH_VB(ctx
, "dlist");
1170 n
= alloc_instruction( ctx
, OPCODE_CULL_FACE
, 1 );
1174 if (ctx
->ExecuteFlag
) {
1175 (*ctx
->Exec
.CullFace
)( mode
);
1180 static void save_DepthFunc( GLenum func
)
1182 GET_CURRENT_CONTEXT(ctx
);
1184 FLUSH_VB(ctx
, "dlist");
1185 n
= alloc_instruction( ctx
, OPCODE_DEPTH_FUNC
, 1 );
1189 if (ctx
->ExecuteFlag
) {
1190 (*ctx
->Exec
.DepthFunc
)( func
);
1195 static void save_DepthMask( GLboolean mask
)
1197 GET_CURRENT_CONTEXT(ctx
);
1199 FLUSH_VB(ctx
, "dlist");
1200 n
= alloc_instruction( ctx
, OPCODE_DEPTH_MASK
, 1 );
1204 if (ctx
->ExecuteFlag
) {
1205 (*ctx
->Exec
.DepthMask
)( mask
);
1210 static void save_DepthRange( GLclampd nearval
, GLclampd farval
)
1212 GET_CURRENT_CONTEXT(ctx
);
1214 FLUSH_VB(ctx
, "dlist");
1215 n
= alloc_instruction( ctx
, OPCODE_DEPTH_RANGE
, 2 );
1217 n
[1].f
= (GLfloat
) nearval
;
1218 n
[2].f
= (GLfloat
) farval
;
1220 if (ctx
->ExecuteFlag
) {
1221 (*ctx
->Exec
.DepthRange
)( nearval
, farval
);
1226 static void save_Disable( GLenum cap
)
1228 GET_CURRENT_CONTEXT(ctx
);
1230 FLUSH_VB(ctx
, "dlist");
1231 n
= alloc_instruction( ctx
, OPCODE_DISABLE
, 1 );
1235 if (ctx
->ExecuteFlag
) {
1236 (*ctx
->Exec
.Disable
)( cap
);
1241 static void save_DrawBuffer( GLenum mode
)
1243 GET_CURRENT_CONTEXT(ctx
);
1245 FLUSH_VB(ctx
, "dlist");
1246 n
= alloc_instruction( ctx
, OPCODE_DRAW_BUFFER
, 1 );
1250 if (ctx
->ExecuteFlag
) {
1251 (*ctx
->Exec
.DrawBuffer
)( mode
);
1256 static void save_DrawPixels( GLsizei width
, GLsizei height
,
1257 GLenum format
, GLenum type
,
1258 const GLvoid
*pixels
)
1260 GET_CURRENT_CONTEXT(ctx
);
1261 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
1262 pixels
, &ctx
->Unpack
);
1264 FLUSH_VB(ctx
, "dlist");
1265 n
= alloc_instruction( ctx
, OPCODE_DRAW_PIXELS
, 5 );
1276 if (ctx
->ExecuteFlag
) {
1277 (*ctx
->Exec
.DrawPixels
)( width
, height
, format
, type
, pixels
);
1283 static void save_Enable( GLenum cap
)
1285 GET_CURRENT_CONTEXT(ctx
);
1287 FLUSH_VB(ctx
, "dlist");
1288 n
= alloc_instruction( ctx
, OPCODE_ENABLE
, 1 );
1292 if (ctx
->ExecuteFlag
) {
1293 (*ctx
->Exec
.Enable
)( cap
);
1299 static void save_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
1301 GET_CURRENT_CONTEXT(ctx
);
1303 FLUSH_VB(ctx
, "dlist");
1304 n
= alloc_instruction( ctx
, OPCODE_EVALMESH1
, 3 );
1310 if (ctx
->ExecuteFlag
) {
1311 (*ctx
->Exec
.EvalMesh1
)( mode
, i1
, i2
);
1316 static void save_EvalMesh2(
1317 GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1319 GET_CURRENT_CONTEXT(ctx
);
1321 FLUSH_VB(ctx
, "dlist");
1322 n
= alloc_instruction( ctx
, OPCODE_EVALMESH2
, 5 );
1330 if (ctx
->ExecuteFlag
) {
1331 (*ctx
->Exec
.EvalMesh2
)( mode
, i1
, i2
, j1
, j2
);
1338 static void save_Fogfv( GLenum pname
, const GLfloat
*params
)
1340 GET_CURRENT_CONTEXT(ctx
);
1342 FLUSH_VB(ctx
, "dlist");
1343 n
= alloc_instruction( ctx
, OPCODE_FOG
, 5 );
1351 if (ctx
->ExecuteFlag
) {
1352 (*ctx
->Exec
.Fogfv
)( pname
, params
);
1357 static void save_Fogf( GLenum pname
, GLfloat param
)
1359 save_Fogfv(pname
, ¶m
);
1363 static void save_Fogiv(GLenum pname
, const GLint
*params
)
1368 case GL_FOG_DENSITY
:
1372 p
[0] = (GLfloat
) *params
;
1375 p
[0] = INT_TO_FLOAT( params
[0] );
1376 p
[1] = INT_TO_FLOAT( params
[1] );
1377 p
[2] = INT_TO_FLOAT( params
[2] );
1378 p
[3] = INT_TO_FLOAT( params
[3] );
1381 /* Error will be caught later in gl_Fogfv */
1384 save_Fogfv(pname
, p
);
1388 void save_Fogi(GLenum pname
, GLint param
)
1390 save_Fogiv(pname
, ¶m
);
1394 static void save_FrontFace( GLenum mode
)
1396 GET_CURRENT_CONTEXT(ctx
);
1398 FLUSH_VB(ctx
, "dlist");
1399 n
= alloc_instruction( ctx
, OPCODE_FRONT_FACE
, 1 );
1403 if (ctx
->ExecuteFlag
) {
1404 (*ctx
->Exec
.FrontFace
)( mode
);
1409 static void save_Frustum( GLdouble left
, GLdouble right
,
1410 GLdouble bottom
, GLdouble top
,
1411 GLdouble nearval
, GLdouble farval
)
1413 GET_CURRENT_CONTEXT(ctx
);
1415 FLUSH_VB(ctx
, "dlist");
1416 n
= alloc_instruction( ctx
, OPCODE_FRUSTUM
, 6 );
1425 if (ctx
->ExecuteFlag
) {
1426 (*ctx
->Exec
.Frustum
)( left
, right
, bottom
, top
, nearval
, farval
);
1431 static void save_Hint( GLenum target
, GLenum mode
)
1433 GET_CURRENT_CONTEXT(ctx
);
1435 FLUSH_VB(ctx
, "dlist");
1436 n
= alloc_instruction( ctx
, OPCODE_HINT
, 2 );
1441 if (ctx
->ExecuteFlag
) {
1442 (*ctx
->Exec
.Hint
)( target
, mode
);
1448 static void save_IndexMask( GLuint mask
)
1450 GET_CURRENT_CONTEXT(ctx
);
1452 FLUSH_VB(ctx
, "dlist");
1453 n
= alloc_instruction( ctx
, OPCODE_INDEX_MASK
, 1 );
1457 if (ctx
->ExecuteFlag
) {
1458 (*ctx
->Exec
.IndexMask
)( mask
);
1463 static void save_InitNames( void )
1465 GET_CURRENT_CONTEXT(ctx
);
1466 FLUSH_VB(ctx
, "dlist");
1467 (void) alloc_instruction( ctx
, OPCODE_INIT_NAMES
, 0 );
1468 if (ctx
->ExecuteFlag
) {
1469 (*ctx
->Exec
.InitNames
)();
1474 static void save_Lightfv( GLenum light
, GLenum pname
, const GLfloat
*params
)
1476 GET_CURRENT_CONTEXT(ctx
);
1478 FLUSH_VB(ctx
, "dlist");
1479 n
= alloc_instruction( ctx
, OPCODE_LIGHT
, 6 );
1497 case GL_SPOT_DIRECTION
:
1500 case GL_SPOT_EXPONENT
:
1503 case GL_SPOT_CUTOFF
:
1506 case GL_CONSTANT_ATTENUATION
:
1509 case GL_LINEAR_ATTENUATION
:
1512 case GL_QUADRATIC_ATTENUATION
:
1518 for (i
= 0; i
< nParams
; i
++) {
1519 n
[3+i
].f
= params
[i
];
1522 if (ctx
->ExecuteFlag
) {
1523 (*ctx
->Exec
.Lightfv
)( light
, pname
, params
);
1528 static void save_Lightf( GLenum light
, GLenum pname
, GLfloat params
)
1530 save_Lightfv(light
, pname
, ¶ms
);
1534 static void save_Lightiv( GLenum light
, GLenum pname
, const GLint
*params
)
1541 fparam
[0] = INT_TO_FLOAT( params
[0] );
1542 fparam
[1] = INT_TO_FLOAT( params
[1] );
1543 fparam
[2] = INT_TO_FLOAT( params
[2] );
1544 fparam
[3] = INT_TO_FLOAT( params
[3] );
1547 fparam
[0] = (GLfloat
) params
[0];
1548 fparam
[1] = (GLfloat
) params
[1];
1549 fparam
[2] = (GLfloat
) params
[2];
1550 fparam
[3] = (GLfloat
) params
[3];
1552 case GL_SPOT_DIRECTION
:
1553 fparam
[0] = (GLfloat
) params
[0];
1554 fparam
[1] = (GLfloat
) params
[1];
1555 fparam
[2] = (GLfloat
) params
[2];
1557 case GL_SPOT_EXPONENT
:
1558 case GL_SPOT_CUTOFF
:
1559 case GL_CONSTANT_ATTENUATION
:
1560 case GL_LINEAR_ATTENUATION
:
1561 case GL_QUADRATIC_ATTENUATION
:
1562 fparam
[0] = (GLfloat
) params
[0];
1565 /* error will be caught later in gl_Lightfv */
1568 save_Lightfv( light
, pname
, fparam
);
1572 static void save_Lighti( GLenum light
, GLenum pname
, GLint param
)
1574 save_Lightiv( light
, pname
, ¶m
);
1578 static void save_LightModelfv( GLenum pname
, const GLfloat
*params
)
1580 GET_CURRENT_CONTEXT(ctx
);
1582 FLUSH_VB(ctx
, "dlist");
1583 n
= alloc_instruction( ctx
, OPCODE_LIGHT_MODEL
, 5 );
1591 if (ctx
->ExecuteFlag
) {
1592 (*ctx
->Exec
.LightModelfv
)( pname
, params
);
1597 static void save_LightModelf( GLenum pname
, GLfloat param
)
1599 save_LightModelfv(pname
, ¶m
);
1603 static void save_LightModeliv( GLenum pname
, const GLint
*params
)
1607 case GL_LIGHT_MODEL_AMBIENT
:
1608 fparam
[0] = INT_TO_FLOAT( params
[0] );
1609 fparam
[1] = INT_TO_FLOAT( params
[1] );
1610 fparam
[2] = INT_TO_FLOAT( params
[2] );
1611 fparam
[3] = INT_TO_FLOAT( params
[3] );
1613 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
1614 case GL_LIGHT_MODEL_TWO_SIDE
:
1615 case GL_LIGHT_MODEL_COLOR_CONTROL
:
1616 fparam
[0] = (GLfloat
) params
[0];
1619 /* Error will be caught later in gl_LightModelfv */
1622 save_LightModelfv(pname
, fparam
);
1626 static void save_LightModeli( GLenum pname
, GLint param
)
1628 save_LightModeliv(pname
, ¶m
);
1632 static void save_LineStipple( GLint factor
, GLushort pattern
)
1634 GET_CURRENT_CONTEXT(ctx
);
1636 FLUSH_VB(ctx
, "dlist");
1637 n
= alloc_instruction( ctx
, OPCODE_LINE_STIPPLE
, 2 );
1642 if (ctx
->ExecuteFlag
) {
1643 (*ctx
->Exec
.LineStipple
)( factor
, pattern
);
1648 static void save_LineWidth( GLfloat width
)
1650 GET_CURRENT_CONTEXT(ctx
);
1652 FLUSH_VB(ctx
, "dlist");
1653 n
= alloc_instruction( ctx
, OPCODE_LINE_WIDTH
, 1 );
1657 if (ctx
->ExecuteFlag
) {
1658 (*ctx
->Exec
.LineWidth
)( width
);
1663 static void save_ListBase( GLuint base
)
1665 GET_CURRENT_CONTEXT(ctx
);
1667 FLUSH_VB(ctx
, "dlist");
1668 n
= alloc_instruction( ctx
, OPCODE_LIST_BASE
, 1 );
1672 if (ctx
->ExecuteFlag
) {
1673 (*ctx
->Exec
.ListBase
)( base
);
1678 static void save_LoadIdentity( void )
1680 GET_CURRENT_CONTEXT(ctx
);
1681 FLUSH_VB(ctx
, "dlist");
1682 (void) alloc_instruction( ctx
, OPCODE_LOAD_IDENTITY
, 0 );
1683 if (ctx
->ExecuteFlag
) {
1684 (*ctx
->Exec
.LoadIdentity
)();
1689 static void save_LoadMatrixf( const GLfloat
*m
)
1691 GET_CURRENT_CONTEXT(ctx
);
1693 FLUSH_VB(ctx
, "dlist");
1694 n
= alloc_instruction( ctx
, OPCODE_LOAD_MATRIX
, 16 );
1697 for (i
=0;i
<16;i
++) {
1701 if (ctx
->ExecuteFlag
) {
1702 (*ctx
->Exec
.LoadMatrixf
)( m
);
1707 static void save_LoadMatrixd( const GLdouble
*m
)
1711 for (i
= 0; i
< 16; i
++) {
1714 save_LoadMatrixf(f
);
1718 static void save_LoadName( GLuint name
)
1720 GET_CURRENT_CONTEXT(ctx
);
1722 FLUSH_VB(ctx
, "dlist");
1723 n
= alloc_instruction( ctx
, OPCODE_LOAD_NAME
, 1 );
1727 if (ctx
->ExecuteFlag
) {
1728 (*ctx
->Exec
.LoadName
)( name
);
1733 static void save_LogicOp( GLenum opcode
)
1735 GET_CURRENT_CONTEXT(ctx
);
1737 FLUSH_VB(ctx
, "dlist");
1738 n
= alloc_instruction( ctx
, OPCODE_LOGIC_OP
, 1 );
1742 if (ctx
->ExecuteFlag
) {
1743 (*ctx
->Exec
.LogicOp
)( opcode
);
1748 static void save_Map1d( GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
1749 GLint order
, const GLdouble
*points
)
1751 GET_CURRENT_CONTEXT(ctx
);
1753 FLUSH_VB(ctx
, "dlist");
1754 n
= alloc_instruction( ctx
, OPCODE_MAP1
, 6 );
1756 GLfloat
*pnts
= gl_copy_map_points1d( target
, stride
, order
, points
);
1760 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
1762 n
[6].data
= (void *) pnts
;
1764 if (ctx
->ExecuteFlag
) {
1765 (*ctx
->Exec
.Map1d
)( target
, u1
, u2
, stride
, order
, points
);
1769 static void save_Map1f( GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
1770 GLint order
, const GLfloat
*points
)
1772 GET_CURRENT_CONTEXT(ctx
);
1774 FLUSH_VB(ctx
, "dlist");
1775 n
= alloc_instruction( ctx
, OPCODE_MAP1
, 6 );
1777 GLfloat
*pnts
= gl_copy_map_points1f( target
, stride
, order
, points
);
1781 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
1783 n
[6].data
= (void *) pnts
;
1785 if (ctx
->ExecuteFlag
) {
1786 (*ctx
->Exec
.Map1f
)( target
, u1
, u2
, stride
, order
, points
);
1791 static void save_Map2d( GLenum target
,
1792 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
1793 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
1794 const GLdouble
*points
)
1796 GET_CURRENT_CONTEXT(ctx
);
1798 FLUSH_VB(ctx
, "dlist");
1799 n
= alloc_instruction( ctx
, OPCODE_MAP2
, 10 );
1801 GLfloat
*pnts
= gl_copy_map_points2d( target
, ustride
, uorder
,
1802 vstride
, vorder
, points
);
1808 /* XXX verify these strides are correct */
1809 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
1810 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
1813 n
[10].data
= (void *) pnts
;
1815 if (ctx
->ExecuteFlag
) {
1816 (*ctx
->Exec
.Map2d
)( target
,
1817 u1
, u2
, ustride
, uorder
,
1818 v1
, v2
, vstride
, vorder
, points
);
1823 static void save_Map2f( GLenum target
,
1824 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
1825 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
1826 const GLfloat
*points
)
1828 GET_CURRENT_CONTEXT(ctx
);
1830 FLUSH_VB(ctx
, "dlist");
1831 n
= alloc_instruction( ctx
, OPCODE_MAP2
, 10 );
1833 GLfloat
*pnts
= gl_copy_map_points2f( target
, ustride
, uorder
,
1834 vstride
, vorder
, points
);
1840 /* XXX verify these strides are correct */
1841 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
1842 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
1845 n
[10].data
= (void *) pnts
;
1847 if (ctx
->ExecuteFlag
) {
1848 (*ctx
->Exec
.Map2f
)( target
, u1
, u2
, ustride
, uorder
,
1849 v1
, v2
, vstride
, vorder
, points
);
1854 static void save_MapGrid1f( GLint un
, GLfloat u1
, GLfloat u2
)
1856 GET_CURRENT_CONTEXT(ctx
);
1858 FLUSH_VB(ctx
, "dlist");
1859 n
= alloc_instruction( ctx
, OPCODE_MAPGRID1
, 3 );
1865 if (ctx
->ExecuteFlag
) {
1866 (*ctx
->Exec
.MapGrid1f
)( un
, u1
, u2
);
1871 static void save_MapGrid1d( GLint un
, GLdouble u1
, GLdouble u2
)
1873 save_MapGrid1f(un
, u1
, u2
);
1877 static void save_MapGrid2f( GLint un
, GLfloat u1
, GLfloat u2
,
1878 GLint vn
, GLfloat v1
, GLfloat v2
)
1880 GET_CURRENT_CONTEXT(ctx
);
1882 FLUSH_VB(ctx
, "dlist");
1883 n
= alloc_instruction( ctx
, OPCODE_MAPGRID2
, 6 );
1892 if (ctx
->ExecuteFlag
) {
1893 (*ctx
->Exec
.MapGrid2f
)( un
, u1
, u2
, vn
, v1
, v2
);
1899 static void save_MapGrid2d( GLint un
, GLdouble u1
, GLdouble u2
,
1900 GLint vn
, GLdouble v1
, GLdouble v2
)
1902 save_MapGrid2f(un
, u1
, u2
, vn
, v1
, v2
);
1906 static void save_MatrixMode( GLenum mode
)
1908 GET_CURRENT_CONTEXT(ctx
);
1910 FLUSH_VB(ctx
, "dlist");
1911 n
= alloc_instruction( ctx
, OPCODE_MATRIX_MODE
, 1 );
1915 if (ctx
->ExecuteFlag
) {
1916 (*ctx
->Exec
.MatrixMode
)( mode
);
1921 static void save_MultMatrixf( const GLfloat
*m
)
1923 GET_CURRENT_CONTEXT(ctx
);
1925 FLUSH_VB(ctx
, "dlist");
1926 n
= alloc_instruction( ctx
, OPCODE_MULT_MATRIX
, 16 );
1929 for (i
=0;i
<16;i
++) {
1933 if (ctx
->ExecuteFlag
) {
1934 (*ctx
->Exec
.MultMatrixf
)( m
);
1939 static void save_MultMatrixd( const GLdouble
*m
)
1943 for (i
= 0; i
< 16; i
++) {
1946 save_MultMatrixf(f
);
1950 static void save_NewList( GLuint list
, GLenum mode
)
1952 GET_CURRENT_CONTEXT(ctx
);
1953 /* It's an error to call this function while building a display list */
1954 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
1961 static void save_Ortho( GLdouble left
, GLdouble right
,
1962 GLdouble bottom
, GLdouble top
,
1963 GLdouble nearval
, GLdouble farval
)
1965 GET_CURRENT_CONTEXT(ctx
);
1967 FLUSH_VB(ctx
, "dlist");
1968 n
= alloc_instruction( ctx
, OPCODE_ORTHO
, 6 );
1977 if (ctx
->ExecuteFlag
) {
1978 (*ctx
->Exec
.Ortho
)( left
, right
, bottom
, top
, nearval
, farval
);
1983 static void save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
1985 GET_CURRENT_CONTEXT(ctx
);
1987 FLUSH_VB(ctx
, "dlist");
1988 n
= alloc_instruction( ctx
, OPCODE_PIXEL_MAP
, 3 );
1992 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
1993 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
1995 if (ctx
->ExecuteFlag
) {
1996 (*ctx
->Exec
.PixelMapfv
)( map
, mapsize
, values
);
2001 static void save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2003 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2005 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2006 for (i
=0;i
<mapsize
;i
++) {
2007 fvalues
[i
] = (GLfloat
) values
[i
];
2011 for (i
=0;i
<mapsize
;i
++) {
2012 fvalues
[i
] = UINT_TO_FLOAT( values
[i
] );
2015 save_PixelMapfv(map
, mapsize
, fvalues
);
2019 static void save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2021 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2023 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2024 for (i
=0;i
<mapsize
;i
++) {
2025 fvalues
[i
] = (GLfloat
) values
[i
];
2029 for (i
=0;i
<mapsize
;i
++) {
2030 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2033 save_PixelMapfv(map
, mapsize
, fvalues
);
2037 static void save_PixelTransferf( GLenum pname
, GLfloat param
)
2039 GET_CURRENT_CONTEXT(ctx
);
2041 FLUSH_VB(ctx
, "dlist");
2042 n
= alloc_instruction( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2047 if (ctx
->ExecuteFlag
) {
2048 (*ctx
->Exec
.PixelTransferf
)( pname
, param
);
2053 static void save_PixelTransferi( GLenum pname
, GLint param
)
2055 save_PixelTransferf( pname
, (GLfloat
) param
);
2059 static void save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2061 GET_CURRENT_CONTEXT(ctx
);
2063 FLUSH_VB(ctx
, "dlist");
2064 n
= alloc_instruction( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2069 if (ctx
->ExecuteFlag
) {
2070 (*ctx
->Exec
.PixelZoom
)( xfactor
, yfactor
);
2075 static void save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2077 GET_CURRENT_CONTEXT(ctx
);
2079 FLUSH_VB(ctx
, "dlist");
2080 n
= alloc_instruction( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2087 if (ctx
->ExecuteFlag
) {
2088 (*ctx
->Exec
.PointParameterfvEXT
)( pname
, params
);
2093 static void save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2095 save_PointParameterfvEXT(pname
, ¶m
);
2099 static void save_PointSize( GLfloat size
)
2101 GET_CURRENT_CONTEXT(ctx
);
2103 FLUSH_VB(ctx
, "dlist");
2104 n
= alloc_instruction( ctx
, OPCODE_POINT_SIZE
, 1 );
2108 if (ctx
->ExecuteFlag
) {
2109 (*ctx
->Exec
.PointSize
)( size
);
2114 static void save_PolygonMode( GLenum face
, GLenum mode
)
2116 GET_CURRENT_CONTEXT(ctx
);
2118 FLUSH_VB(ctx
, "dlist");
2119 n
= alloc_instruction( ctx
, OPCODE_POLYGON_MODE
, 2 );
2124 if (ctx
->ExecuteFlag
) {
2125 (*ctx
->Exec
.PolygonMode
)( face
, mode
);
2131 * Polygon stipple must have been upacked already!
2133 static void save_PolygonStipple( const GLubyte
*pattern
)
2135 GET_CURRENT_CONTEXT(ctx
);
2137 FLUSH_VB(ctx
, "dlist");
2138 n
= alloc_instruction( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2141 n
[1].data
= MALLOC( 32 * 4 );
2142 data
= n
[1].data
; /* This needed for Acorn compiler */
2143 MEMCPY( data
, pattern
, 32 * 4 );
2145 if (ctx
->ExecuteFlag
) {
2146 (*ctx
->Exec
.PolygonStipple
)( (GLubyte
*) pattern
);
2151 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2153 GET_CURRENT_CONTEXT(ctx
);
2155 FLUSH_VB(ctx
, "dlist");
2156 n
= alloc_instruction( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2161 if (ctx
->ExecuteFlag
) {
2162 (*ctx
->Exec
.PolygonOffset
)( factor
, units
);
2167 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2169 save_PolygonOffset(factor
, DEPTH_SCALE
* bias
);
2173 static void save_PopAttrib( void )
2175 GET_CURRENT_CONTEXT(ctx
);
2176 FLUSH_VB(ctx
, "dlist");
2177 (void) alloc_instruction( ctx
, OPCODE_POP_ATTRIB
, 0 );
2178 if (ctx
->ExecuteFlag
) {
2179 (*ctx
->Exec
.PopAttrib
)();
2184 static void save_PopMatrix( void )
2186 GET_CURRENT_CONTEXT(ctx
);
2187 FLUSH_VB(ctx
, "dlist");
2188 (void) alloc_instruction( ctx
, OPCODE_POP_MATRIX
, 0 );
2189 if (ctx
->ExecuteFlag
) {
2190 (*ctx
->Exec
.PopMatrix
)();
2195 static void save_PopName( void )
2197 GET_CURRENT_CONTEXT(ctx
);
2198 FLUSH_VB(ctx
, "dlist");
2199 (void) alloc_instruction( ctx
, OPCODE_POP_NAME
, 0 );
2200 if (ctx
->ExecuteFlag
) {
2201 (*ctx
->Exec
.PopName
)();
2206 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2207 const GLclampf
*priorities
)
2209 GET_CURRENT_CONTEXT(ctx
);
2211 FLUSH_VB(ctx
, "dlist");
2213 for (i
=0;i
<num
;i
++) {
2215 n
= alloc_instruction( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2217 n
[1].ui
= textures
[i
];
2218 n
[2].f
= priorities
[i
];
2221 if (ctx
->ExecuteFlag
) {
2222 (*ctx
->Exec
.PrioritizeTextures
)( num
, textures
, priorities
);
2227 static void save_PushAttrib( GLbitfield mask
)
2229 GET_CURRENT_CONTEXT(ctx
);
2231 FLUSH_VB(ctx
, "dlist");
2232 n
= alloc_instruction( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2236 if (ctx
->ExecuteFlag
) {
2237 (*ctx
->Exec
.PushAttrib
)( mask
);
2242 static void save_PushMatrix( void )
2244 GET_CURRENT_CONTEXT(ctx
);
2245 FLUSH_VB(ctx
, "dlist");
2246 (void) alloc_instruction( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2247 if (ctx
->ExecuteFlag
) {
2248 (*ctx
->Exec
.PushMatrix
)();
2253 static void save_PushName( GLuint name
)
2255 GET_CURRENT_CONTEXT(ctx
);
2257 FLUSH_VB(ctx
, "dlist");
2258 n
= alloc_instruction( ctx
, OPCODE_PUSH_NAME
, 1 );
2262 if (ctx
->ExecuteFlag
) {
2263 (*ctx
->Exec
.PushName
)( name
);
2268 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2270 GET_CURRENT_CONTEXT(ctx
);
2272 FLUSH_VB(ctx
, "dlist");
2273 n
= alloc_instruction( ctx
, OPCODE_RASTER_POS
, 4 );
2280 if (ctx
->ExecuteFlag
) {
2281 (*ctx
->Exec
.RasterPos4f
)( x
, y
, z
, w
);
2285 void save_RasterPos2d(GLdouble x
, GLdouble y
)
2287 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2290 void save_RasterPos2f(GLfloat x
, GLfloat y
)
2292 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2295 void save_RasterPos2i(GLint x
, GLint y
)
2297 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2300 void save_RasterPos2s(GLshort x
, GLshort y
)
2302 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2305 void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2307 save_RasterPos4f(x
, y
, z
, 1.0F
);
2310 void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2312 save_RasterPos4f(x
, y
, z
, 1.0F
);
2315 void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2317 save_RasterPos4f(x
, y
, z
, 1.0F
);
2320 void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2322 save_RasterPos4f(x
, y
, z
, 1.0F
);
2325 void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2327 save_RasterPos4f(x
, y
, z
, w
);
2330 void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2332 save_RasterPos4f(x
, y
, z
, w
);
2335 void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2337 save_RasterPos4f(x
, y
, z
, w
);
2340 void save_RasterPos2dv(const GLdouble
*v
)
2342 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2345 void save_RasterPos2fv(const GLfloat
*v
)
2347 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2350 void save_RasterPos2iv(const GLint
*v
)
2352 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2355 void save_RasterPos2sv(const GLshort
*v
)
2357 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2360 void save_RasterPos3dv(const GLdouble
*v
)
2362 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2365 void save_RasterPos3fv(const GLfloat
*v
)
2367 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2370 void save_RasterPos3iv(const GLint
*v
)
2372 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2375 void save_RasterPos3sv(const GLshort
*v
)
2377 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2380 void save_RasterPos4dv(const GLdouble
*v
)
2382 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2385 void save_RasterPos4fv(const GLfloat
*v
)
2387 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2390 void save_RasterPos4iv(const GLint
*v
)
2392 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2395 void save_RasterPos4sv(const GLshort
*v
)
2397 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2401 static void save_PassThrough( GLfloat token
)
2403 GET_CURRENT_CONTEXT(ctx
);
2405 FLUSH_VB(ctx
, "dlist");
2406 n
= alloc_instruction( ctx
, OPCODE_PASSTHROUGH
, 1 );
2410 if (ctx
->ExecuteFlag
) {
2411 (*ctx
->Exec
.PassThrough
)( token
);
2416 static void save_ReadBuffer( GLenum mode
)
2418 GET_CURRENT_CONTEXT(ctx
);
2420 FLUSH_VB(ctx
, "dlist");
2421 n
= alloc_instruction( ctx
, OPCODE_READ_BUFFER
, 1 );
2425 if (ctx
->ExecuteFlag
) {
2426 (*ctx
->Exec
.ReadBuffer
)( mode
);
2431 static void save_Rectf( GLfloat x1
, GLfloat y1
, GLfloat x2
, GLfloat y2
)
2433 GET_CURRENT_CONTEXT(ctx
);
2435 FLUSH_VB(ctx
, "dlist");
2436 n
= alloc_instruction( ctx
, OPCODE_RECTF
, 4 );
2443 if (ctx
->ExecuteFlag
) {
2444 (*ctx
->Exec
.Rectf
)( x1
, y1
, x2
, y2
);
2448 static void save_Rectd(GLdouble x1
, GLdouble y1
, GLdouble x2
, GLdouble y2
)
2450 save_Rectf(x1
, y1
, x2
, y2
);
2453 static void save_Rectdv(const GLdouble
*v1
, const GLdouble
*v2
)
2455 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2458 static void save_Rectfv( const GLfloat
*v1
, const GLfloat
*v2
)
2460 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2463 static void save_Recti(GLint x1
, GLint y1
, GLint x2
, GLint y2
)
2465 save_Rectf(x1
, y1
, x2
, y2
);
2468 static void save_Rectiv(const GLint
*v1
, const GLint
*v2
)
2470 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2473 static void save_Rects(GLshort x1
, GLshort y1
, GLshort x2
, GLshort y2
)
2475 save_Rectf(x1
, y1
, x2
, y2
);
2478 static void save_Rectsv(const GLshort
*v1
, const GLshort
*v2
)
2480 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2484 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2487 gl_rotation_matrix( angle
, x
, y
, z
, m
);
2488 save_MultMatrixf( m
); /* save and maybe execute */
2492 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2494 save_Rotatef(angle
, x
, y
, z
);
2498 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2500 GET_CURRENT_CONTEXT(ctx
);
2502 FLUSH_VB(ctx
, "dlist");
2503 n
= alloc_instruction( ctx
, OPCODE_SCALE
, 3 );
2509 if (ctx
->ExecuteFlag
) {
2510 (*ctx
->Exec
.Scalef
)( x
, y
, z
);
2515 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
2517 save_Scalef(x
, y
, z
);
2521 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
2523 GET_CURRENT_CONTEXT(ctx
);
2525 FLUSH_VB(ctx
, "dlist");
2526 n
= alloc_instruction( ctx
, OPCODE_SCISSOR
, 4 );
2533 if (ctx
->ExecuteFlag
) {
2534 (*ctx
->Exec
.Scissor
)( x
, y
, width
, height
);
2539 static void save_ShadeModel( GLenum mode
)
2541 GET_CURRENT_CONTEXT(ctx
);
2543 FLUSH_VB(ctx
, "dlist");
2544 n
= alloc_instruction( ctx
, OPCODE_SHADE_MODEL
, 1 );
2548 if (ctx
->ExecuteFlag
) {
2549 (*ctx
->Exec
.ShadeModel
)( mode
);
2554 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
2556 GET_CURRENT_CONTEXT(ctx
);
2558 FLUSH_VB(ctx
, "dlist");
2559 n
= alloc_instruction( ctx
, OPCODE_STENCIL_FUNC
, 3 );
2565 if (ctx
->ExecuteFlag
) {
2566 (*ctx
->Exec
.StencilFunc
)( func
, ref
, mask
);
2571 static void save_StencilMask( GLuint mask
)
2573 GET_CURRENT_CONTEXT(ctx
);
2575 FLUSH_VB(ctx
, "dlist");
2576 n
= alloc_instruction( ctx
, OPCODE_STENCIL_MASK
, 1 );
2580 if (ctx
->ExecuteFlag
) {
2581 (*ctx
->Exec
.StencilMask
)( mask
);
2586 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
2588 GET_CURRENT_CONTEXT(ctx
);
2590 FLUSH_VB(ctx
, "dlist");
2591 n
= alloc_instruction( ctx
, OPCODE_STENCIL_OP
, 3 );
2597 if (ctx
->ExecuteFlag
) {
2598 (*ctx
->Exec
.StencilOp
)( fail
, zfail
, zpass
);
2603 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
2605 GET_CURRENT_CONTEXT(ctx
);
2607 FLUSH_VB(ctx
, "dlist");
2608 n
= alloc_instruction( ctx
, OPCODE_TEXENV
, 6 );
2617 if (ctx
->ExecuteFlag
) {
2618 (*ctx
->Exec
.TexEnvfv
)( target
, pname
, params
);
2623 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
2625 save_TexEnvfv( target
, pname
, ¶m
);
2629 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
2632 p
[0] = (GLfloat
) param
;
2633 p
[1] = p
[2] = p
[3] = 0.0;
2634 save_TexEnvfv( target
, pname
, p
);
2638 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
2641 p
[0] = INT_TO_FLOAT( param
[0] );
2642 p
[1] = INT_TO_FLOAT( param
[1] );
2643 p
[2] = INT_TO_FLOAT( param
[2] );
2644 p
[3] = INT_TO_FLOAT( param
[3] );
2645 save_TexEnvfv( target
, pname
, p
);
2649 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
2651 GET_CURRENT_CONTEXT(ctx
);
2653 FLUSH_VB(ctx
, "dlist");
2654 n
= alloc_instruction( ctx
, OPCODE_TEXGEN
, 6 );
2663 if (ctx
->ExecuteFlag
) {
2664 (*ctx
->Exec
.TexGenfv
)( coord
, pname
, params
);
2669 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
2676 save_TexGenfv(coord
, pname
, p
);
2680 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
2682 GLfloat p
= (GLfloat
) param
;
2683 save_TexGenfv( coord
, pname
, &p
);
2687 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
2694 save_TexGenfv( coord
, pname
, p
);
2698 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
2700 save_TexGenfv(coord
, pname
, ¶m
);
2704 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
2706 save_TexGeniv( coord
, pname
, ¶m
);
2710 static void save_TexParameterfv( GLenum target
,
2711 GLenum pname
, const GLfloat
*params
)
2713 GET_CURRENT_CONTEXT(ctx
);
2715 FLUSH_VB(ctx
, "dlist");
2716 n
= alloc_instruction( ctx
, OPCODE_TEXPARAMETER
, 6 );
2725 if (ctx
->ExecuteFlag
) {
2726 (*ctx
->Exec
.TexParameterfv
)( target
, pname
, params
);
2731 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
2733 save_TexParameterfv(target
, pname
, ¶m
);
2737 static void save_TexParameteri( GLenum target
, GLenum pname
, const GLint param
)
2740 fparam
[0] = (GLfloat
) param
;
2741 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
2742 save_TexParameterfv(target
, pname
, fparam
);
2746 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
2749 fparam
[0] = (GLfloat
) params
[0];
2750 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
2751 save_TexParameterfv(target
, pname
, fparam
);
2755 static void save_TexImage1D( GLenum target
,
2756 GLint level
, GLint components
,
2757 GLsizei width
, GLint border
,
2758 GLenum format
, GLenum type
,
2759 const GLvoid
*pixels
)
2761 GET_CURRENT_CONTEXT(ctx
);
2762 if (target
== GL_PROXY_TEXTURE_1D
) {
2763 /* don't compile, execute immediately */
2764 (*ctx
->Exec
.TexImage1D
)( target
, level
, components
, width
,
2765 border
, format
, type
, pixels
);
2768 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
2769 pixels
, &ctx
->Unpack
);
2771 FLUSH_VB(ctx
, "dlist");
2772 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
2776 n
[3].i
= components
;
2777 n
[4].i
= (GLint
) width
;
2786 if (ctx
->ExecuteFlag
) {
2787 (*ctx
->Exec
.TexImage1D
)( target
, level
, components
, width
,
2788 border
, format
, type
, pixels
);
2794 static void save_TexImage2D( GLenum target
,
2795 GLint level
, GLint components
,
2796 GLsizei width
, GLsizei height
, GLint border
,
2797 GLenum format
, GLenum type
,
2798 const GLvoid
*pixels
)
2800 GET_CURRENT_CONTEXT(ctx
);
2801 if (target
== GL_PROXY_TEXTURE_2D
) {
2802 /* don't compile, execute immediately */
2803 (*ctx
->Exec
.TexImage2D
)( target
, level
, components
, width
,
2804 height
, border
, format
, type
, pixels
);
2807 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
2808 pixels
, &ctx
->Unpack
);
2810 FLUSH_VB(ctx
, "dlist");
2811 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
2815 n
[3].i
= components
;
2816 n
[4].i
= (GLint
) width
;
2817 n
[5].i
= (GLint
) height
;
2826 if (ctx
->ExecuteFlag
) {
2827 (*ctx
->Exec
.TexImage2D
)( target
, level
, components
, width
,
2828 height
, border
, format
, type
, pixels
);
2834 static void save_TexImage3D( GLenum target
,
2835 GLint level
, GLint components
,
2836 GLsizei width
, GLsizei height
, GLsizei depth
,
2838 GLenum format
, GLenum type
,
2839 const GLvoid
*pixels
)
2841 GET_CURRENT_CONTEXT(ctx
);
2842 if (target
== GL_PROXY_TEXTURE_3D
) {
2843 /* don't compile, execute immediately */
2844 (*ctx
->Exec
.TexImage3D
)( target
, level
, components
, width
,
2845 height
, depth
, border
, format
, type
, pixels
);
2849 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
2850 pixels
, &ctx
->Unpack
);
2851 FLUSH_VB(ctx
, "dlist");
2852 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
2856 n
[3].i
= components
;
2857 n
[4].i
= (GLint
) width
;
2858 n
[5].i
= (GLint
) height
;
2859 n
[6].i
= (GLint
) depth
;
2868 if (ctx
->ExecuteFlag
) {
2869 (*ctx
->Exec
.TexImage3D
)( target
, level
, components
, width
,
2870 height
, depth
, border
, format
, type
, pixels
);
2876 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
2877 GLsizei width
, GLenum format
, GLenum type
,
2878 const GLvoid
*pixels
)
2880 GET_CURRENT_CONTEXT(ctx
);
2882 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
2883 pixels
, &ctx
->Unpack
);
2884 FLUSH_VB(ctx
, "dlist");
2885 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
2890 n
[4].i
= (GLint
) width
;
2898 if (ctx
->ExecuteFlag
) {
2899 (*ctx
->Exec
.TexSubImage1D
)( target
, level
, xoffset
, width
,
2900 format
, type
, pixels
);
2905 static void save_TexSubImage2D( GLenum target
, GLint level
,
2906 GLint xoffset
, GLint yoffset
,
2907 GLsizei width
, GLsizei height
,
2908 GLenum format
, GLenum type
,
2909 const GLvoid
*pixels
)
2911 GET_CURRENT_CONTEXT(ctx
);
2913 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
2914 pixels
, &ctx
->Unpack
);
2915 FLUSH_VB(ctx
, "dlist");
2916 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
2922 n
[5].i
= (GLint
) width
;
2923 n
[6].i
= (GLint
) height
;
2931 if (ctx
->ExecuteFlag
) {
2932 (*ctx
->Exec
.TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
2933 width
, height
, format
, type
, pixels
);
2938 static void save_TexSubImage3D( GLenum target
, GLint level
,
2939 GLint xoffset
, GLint yoffset
,GLint zoffset
,
2940 GLsizei width
, GLsizei height
, GLsizei depth
,
2941 GLenum format
, GLenum type
,
2942 const GLvoid
*pixels
)
2944 GET_CURRENT_CONTEXT(ctx
);
2946 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
2947 pixels
, &ctx
->Unpack
);
2948 FLUSH_VB(ctx
, "dlist");
2949 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
2956 n
[6].i
= (GLint
) width
;
2957 n
[7].i
= (GLint
) height
;
2958 n
[8].i
= (GLint
) depth
;
2966 if (ctx
->ExecuteFlag
) {
2967 (*ctx
->Exec
.TexSubImage3D
)( target
, level
,
2968 xoffset
, yoffset
, zoffset
,
2969 width
, height
, depth
, format
, type
, pixels
);
2974 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
2976 GET_CURRENT_CONTEXT(ctx
);
2978 FLUSH_VB(ctx
, "dlist");
2979 n
= alloc_instruction( ctx
, OPCODE_TRANSLATE
, 3 );
2985 if (ctx
->ExecuteFlag
) {
2986 (*ctx
->Exec
.Translatef
)( x
, y
, z
);
2991 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
2993 save_Translatef(x
, y
, z
);
2998 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3000 GET_CURRENT_CONTEXT(ctx
);
3002 FLUSH_VB(ctx
, "dlist");
3003 n
= alloc_instruction( ctx
, OPCODE_VIEWPORT
, 4 );
3007 n
[3].i
= (GLint
) width
;
3008 n
[4].i
= (GLint
) height
;
3010 if (ctx
->ExecuteFlag
) {
3011 (*ctx
->Exec
.Viewport
)( x
, y
, width
, height
);
3016 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3018 GET_CURRENT_CONTEXT(ctx
);
3020 FLUSH_VB(ctx
, "dlist");
3021 n
= alloc_instruction( ctx
, OPCODE_WINDOW_POS
, 4 );
3028 if (ctx
->ExecuteFlag
) {
3029 (*ctx
->Exec
.WindowPos4fMESA
)( x
, y
, z
, w
);
3036 /* GL_ARB_multitexture */
3037 static void save_ActiveTextureARB( GLenum target
)
3039 GET_CURRENT_CONTEXT(ctx
);
3041 FLUSH_VB(ctx
, "dlist");
3042 n
= alloc_instruction( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3046 if (ctx
->ExecuteFlag
) {
3047 (*ctx
->Exec
.ActiveTextureARB
)( target
);
3052 /* GL_ARB_multitexture */
3053 static void save_ClientActiveTextureARB( GLenum target
)
3055 GET_CURRENT_CONTEXT(ctx
);
3057 FLUSH_VB(ctx
, "dlist");
3058 n
= alloc_instruction( ctx
, OPCODE_CLIENT_ACTIVE_TEXTURE
, 1 );
3062 if (ctx
->ExecuteFlag
) {
3063 (*ctx
->Exec
.ClientActiveTextureARB
)( target
);
3069 void gl_compile_cassette( GLcontext
*ctx
)
3071 Node
*n
= alloc_instruction( ctx
, OPCODE_VERTEX_CASSETTE
, 8 );
3072 struct immediate
*im
= ctx
->input
;
3078 /* Do some easy optimizations of the cassette.
3081 if (0 && im
->v
.Obj
.size
< 4 && im
->Count
> 15) {
3082 im
->Bounds
= (GLfloat (*)[3]) MALLOC(6 * sizeof(GLfloat
));
3083 (gl_calc_bound_tab
[im
->v
.Obj
.size
])( im
->Bounds
, &im
->v
.Obj
);
3087 n
[1].data
= (void *)im
;
3088 n
[2].ui
= im
->Start
;
3089 n
[3].ui
= im
->Count
;
3090 n
[4].ui
= im
->BeginState
;
3091 n
[5].ui
= im
->OrFlag
;
3092 n
[6].ui
= im
->AndFlag
;
3093 n
[7].ui
= im
->LastData
;
3094 n
[8].ui
= im
->LastPrimitive
;
3096 if (im
->Count
> VB_MAX
- 4) {
3098 struct immediate
*new_im
= gl_immediate_alloc(ctx
);
3099 if (!new_im
) return;
3100 SET_IMMEDIATE( ctx
, new_im
);
3101 gl_reset_input( ctx
);
3105 im
->Start
= im
->Count
; /* don't clear anything in reset_input */
3108 im
->Primitive
[im
->Start
] = ctx
->Current
.Primitive
;
3109 im
->LastPrimitive
= im
->Start
;
3110 im
->BeginState
= VERT_BEGIN_0
;
3115 fprintf(stderr
, "in compile_cassette, BeginState is %x\n",
3120 /* KW: Compile commands
3122 * Will appear in the list before the vertex buffer containing the
3123 * command that provoked the error. I don't see this as a problem.
3125 void gl_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
3128 n
= alloc_instruction( ctx
, OPCODE_ERROR
, 2 );
3131 n
[2].data
= (void *) s
;
3133 /* execute already done */
3138 islist(GLcontext
*ctx
, GLuint list
)
3140 if (list
> 0 && HashLookup(ctx
->Shared
->DisplayList
, list
)) {
3150 /**********************************************************************/
3151 /* Display list execution */
3152 /**********************************************************************/
3156 * Execute a display list. Note that the ListBase offset must have already
3157 * been added before calling this function. I.e. the list argument is
3158 * the absolute list number, not relative to ListBase.
3159 * Input: list - display list number
3161 static void execute_list( GLcontext
*ctx
, GLuint list
)
3167 if (!islist(ctx
,list
))
3170 /* mesa_print_display_list( list ); */
3174 n
= (Node
*) HashLookup(ctx
->Shared
->DisplayList
, list
);
3178 opcode
= n
[0].opcode
;
3182 gl_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
3184 case OPCODE_VERTEX_CASSETTE
: {
3185 struct immediate
*IM
;
3188 gl_update_state(ctx
);
3189 if (ctx
->CompileCVAFlag
) {
3190 ctx
->CompileCVAFlag
= 0;
3191 ctx
->CVA
.elt
.pipeline_valid
= 0;
3193 if (!ctx
->CVA
.elt
.pipeline_valid
)
3194 gl_build_immediate_pipeline( ctx
);
3197 IM
= (struct immediate
*) n
[1].data
;
3198 IM
->Start
= n
[2].ui
;
3199 IM
->Count
= n
[3].ui
;
3200 IM
->BeginState
= n
[4].ui
;
3201 IM
->OrFlag
= n
[5].ui
;
3202 IM
->AndFlag
= n
[6].ui
;
3203 IM
->LastData
= n
[7].ui
;
3204 IM
->LastPrimitive
= n
[8].ui
;
3206 if ((MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
) &&
3207 (MESA_VERBOSE
& VERBOSE_IMMEDIATE
))
3208 gl_print_cassette( (struct immediate
*) n
[1].data
);
3211 fprintf(stderr
, "Run cassette %d, rows %d..%d, beginstate %x\n",
3213 IM
->Start
, IM
->Count
, IM
->BeginState
);
3215 gl_fixup_cassette( ctx
, (struct immediate
*) n
[1].data
);
3216 gl_execute_cassette( ctx
, (struct immediate
*) n
[1].data
);
3220 (*ctx
->Exec
.Accum
)( n
[1].e
, n
[2].f
);
3222 case OPCODE_ALPHA_FUNC
:
3223 (*ctx
->Exec
.AlphaFunc
)( n
[1].e
, n
[2].f
);
3225 case OPCODE_BIND_TEXTURE
:
3226 (*ctx
->Exec
.BindTexture
)( n
[1].e
, n
[2].ui
);
3230 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3231 ctx
->Unpack
= _mesa_native_packing
;
3232 (*ctx
->Exec
.Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
3233 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, n
[7].data
);
3234 ctx
->Unpack
= save
; /* restore */
3237 case OPCODE_BLEND_COLOR
:
3238 (*ctx
->Exec
.BlendColorEXT
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3240 case OPCODE_BLEND_EQUATION
:
3241 (*ctx
->Exec
.BlendEquationEXT
)( n
[1].e
);
3243 case OPCODE_BLEND_FUNC
:
3244 (*ctx
->Exec
.BlendFunc
)( n
[1].e
, n
[2].e
);
3246 case OPCODE_BLEND_FUNC_SEPARATE
:
3247 (*ctx
->Exec
.BlendFuncSeparateINGR
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
3249 case OPCODE_CALL_LIST
:
3250 /* Generated by glCallList(), don't add ListBase */
3251 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
3252 execute_list( ctx
, n
[1].ui
);
3255 case OPCODE_CALL_LIST_OFFSET
:
3256 /* Generated by glCallLists() so we must add ListBase */
3257 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
3258 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
3262 (*ctx
->Exec
.Clear
)( n
[1].bf
);
3264 case OPCODE_CLEAR_COLOR
:
3265 (*ctx
->Exec
.ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3267 case OPCODE_CLEAR_ACCUM
:
3268 (*ctx
->Exec
.ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3270 case OPCODE_CLEAR_DEPTH
:
3271 (*ctx
->Exec
.ClearDepth
)( (GLclampd
) n
[1].f
);
3273 case OPCODE_CLEAR_INDEX
:
3274 (*ctx
->Exec
.ClearIndex
)( n
[1].ui
);
3276 case OPCODE_CLEAR_STENCIL
:
3277 (*ctx
->Exec
.ClearStencil
)( n
[1].i
);
3279 case OPCODE_CLIP_PLANE
:
3286 (*ctx
->Exec
.ClipPlane
)( n
[1].e
, eq
);
3289 case OPCODE_COLOR_MASK
:
3290 (*ctx
->Exec
.ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
3292 case OPCODE_COLOR_MATERIAL
:
3293 (*ctx
->Exec
.ColorMaterial
)( n
[1].e
, n
[2].e
);
3295 case OPCODE_COLOR_TABLE
:
3297 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3298 ctx
->Unpack
= _mesa_native_packing
;
3299 (*ctx
->Exec
.ColorTableEXT
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
3300 n
[5].e
, n
[6].data
);
3301 ctx
->Unpack
= save
; /* restore */
3304 case OPCODE_COLOR_SUB_TABLE
:
3306 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3307 ctx
->Unpack
= _mesa_native_packing
;
3308 (*ctx
->Exec
.ColorSubTableEXT
)( n
[1].e
, n
[2].i
, n
[3].i
,
3309 n
[4].e
, n
[5].e
, n
[6].data
);
3310 ctx
->Unpack
= save
; /* restore */
3313 case OPCODE_COPY_PIXELS
:
3314 (*ctx
->Exec
.CopyPixels
)( n
[1].i
, n
[2].i
,
3315 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
3317 case OPCODE_COPY_TEX_IMAGE1D
:
3318 (*ctx
->Exec
.CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
3319 n
[5].i
, n
[6].i
, n
[7].i
);
3321 case OPCODE_COPY_TEX_IMAGE2D
:
3322 (*ctx
->Exec
.CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
3323 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
3325 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
3326 (*ctx
->Exec
.CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3327 n
[4].i
, n
[5].i
, n
[6].i
);
3329 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
3330 (*ctx
->Exec
.CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3331 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
3333 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
3334 (*ctx
->Exec
.CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3335 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
3337 case OPCODE_CULL_FACE
:
3338 (*ctx
->Exec
.CullFace
)( n
[1].e
);
3340 case OPCODE_DEPTH_FUNC
:
3341 (*ctx
->Exec
.DepthFunc
)( n
[1].e
);
3343 case OPCODE_DEPTH_MASK
:
3344 (*ctx
->Exec
.DepthMask
)( n
[1].b
);
3346 case OPCODE_DEPTH_RANGE
:
3347 (*ctx
->Exec
.DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
3349 case OPCODE_DISABLE
:
3350 (*ctx
->Exec
.Disable
)( n
[1].e
);
3352 case OPCODE_DRAW_BUFFER
:
3353 (*ctx
->Exec
.DrawBuffer
)( n
[1].e
);
3355 case OPCODE_DRAW_PIXELS
:
3357 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3358 ctx
->Unpack
= _mesa_native_packing
;
3359 (*ctx
->Exec
.DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
3361 ctx
->Unpack
= save
; /* restore */
3365 (*ctx
->Exec
.Enable
)( n
[1].e
);
3367 case OPCODE_EVALMESH1
:
3368 (*ctx
->Exec
.EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
3370 case OPCODE_EVALMESH2
:
3371 (*ctx
->Exec
.EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
3380 (*ctx
->Exec
.Fogfv
)( n
[1].e
, p
);
3383 case OPCODE_FRONT_FACE
:
3384 (*ctx
->Exec
.FrontFace
)( n
[1].e
);
3386 case OPCODE_FRUSTUM
:
3387 (*ctx
->Exec
.Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
3390 (*ctx
->Exec
.Hint
)( n
[1].e
, n
[2].e
);
3392 case OPCODE_INDEX_MASK
:
3393 (*ctx
->Exec
.IndexMask
)( n
[1].ui
);
3395 case OPCODE_INIT_NAMES
:
3396 (*ctx
->Exec
.InitNames
)();
3405 (*ctx
->Exec
.Lightfv
)( n
[1].e
, n
[2].e
, p
);
3408 case OPCODE_LIGHT_MODEL
:
3415 (*ctx
->Exec
.LightModelfv
)( n
[1].e
, p
);
3418 case OPCODE_LINE_STIPPLE
:
3419 (*ctx
->Exec
.LineStipple
)( n
[1].i
, n
[2].us
);
3421 case OPCODE_LINE_WIDTH
:
3422 (*ctx
->Exec
.LineWidth
)( n
[1].f
);
3424 case OPCODE_LIST_BASE
:
3425 (*ctx
->Exec
.ListBase
)( n
[1].ui
);
3427 case OPCODE_LOAD_IDENTITY
:
3428 (*ctx
->Exec
.LoadIdentity
)();
3430 case OPCODE_LOAD_MATRIX
:
3431 if (sizeof(Node
)==sizeof(GLfloat
)) {
3432 (*ctx
->Exec
.LoadMatrixf
)( &n
[1].f
);
3437 for (i
=0;i
<16;i
++) {
3440 (*ctx
->Exec
.LoadMatrixf
)( m
);
3443 case OPCODE_LOAD_NAME
:
3444 (*ctx
->Exec
.LoadName
)( n
[1].ui
);
3446 case OPCODE_LOGIC_OP
:
3447 (*ctx
->Exec
.LogicOp
)( n
[1].e
);
3451 GLenum target
= n
[1].e
;
3452 GLint ustride
= _mesa_evaluator_components(target
);
3453 GLint uorder
= n
[5].i
;
3454 GLfloat u1
= n
[2].f
;
3455 GLfloat u2
= n
[3].f
;
3456 (*ctx
->Exec
.Map1f
)( target
, u1
, u2
, ustride
, uorder
,
3457 (GLfloat
*) n
[6].data
);
3462 GLenum target
= n
[1].e
;
3463 GLfloat u1
= n
[2].f
;
3464 GLfloat u2
= n
[3].f
;
3465 GLfloat v1
= n
[4].f
;
3466 GLfloat v2
= n
[5].f
;
3467 GLint ustride
= n
[6].i
;
3468 GLint vstride
= n
[7].i
;
3469 GLint uorder
= n
[8].i
;
3470 GLint vorder
= n
[9].i
;
3471 (*ctx
->Exec
.Map2f
)( target
, u1
, u2
, ustride
, uorder
,
3472 v1
, v2
, vstride
, vorder
,
3473 (GLfloat
*) n
[10].data
);
3476 case OPCODE_MAPGRID1
:
3477 (*ctx
->Exec
.MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
3479 case OPCODE_MAPGRID2
:
3480 (*ctx
->Exec
.MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
3482 case OPCODE_MATRIX_MODE
:
3483 (*ctx
->Exec
.MatrixMode
)( n
[1].e
);
3485 case OPCODE_MULT_MATRIX
:
3486 if (sizeof(Node
)==sizeof(GLfloat
)) {
3487 (*ctx
->Exec
.MultMatrixf
)( &n
[1].f
);
3492 for (i
=0;i
<16;i
++) {
3495 (*ctx
->Exec
.MultMatrixf
)( m
);
3499 (*ctx
->Exec
.Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
3501 case OPCODE_PASSTHROUGH
:
3502 (*ctx
->Exec
.PassThrough
)( n
[1].f
);
3504 case OPCODE_PIXEL_MAP
:
3505 (*ctx
->Exec
.PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
3507 case OPCODE_PIXEL_TRANSFER
:
3508 (*ctx
->Exec
.PixelTransferf
)( n
[1].e
, n
[2].f
);
3510 case OPCODE_PIXEL_ZOOM
:
3511 (*ctx
->Exec
.PixelZoom
)( n
[1].f
, n
[2].f
);
3513 case OPCODE_POINT_SIZE
:
3514 (*ctx
->Exec
.PointSize
)( n
[1].f
);
3516 case OPCODE_POINT_PARAMETERS
:
3522 (*ctx
->Exec
.PointParameterfvEXT
)( n
[1].e
, params
);
3525 case OPCODE_POLYGON_MODE
:
3526 (*ctx
->Exec
.PolygonMode
)( n
[1].e
, n
[2].e
);
3528 case OPCODE_POLYGON_STIPPLE
:
3529 (*ctx
->Exec
.PolygonStipple
)( (GLubyte
*) n
[1].data
);
3531 case OPCODE_POLYGON_OFFSET
:
3532 (*ctx
->Exec
.PolygonOffset
)( n
[1].f
, n
[2].f
);
3534 case OPCODE_POP_ATTRIB
:
3535 (*ctx
->Exec
.PopAttrib
)();
3537 case OPCODE_POP_MATRIX
:
3538 (*ctx
->Exec
.PopMatrix
)();
3540 case OPCODE_POP_NAME
:
3541 (*ctx
->Exec
.PopName
)();
3543 case OPCODE_PRIORITIZE_TEXTURE
:
3544 (*ctx
->Exec
.PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
3546 case OPCODE_PUSH_ATTRIB
:
3547 (*ctx
->Exec
.PushAttrib
)( n
[1].bf
);
3549 case OPCODE_PUSH_MATRIX
:
3550 (*ctx
->Exec
.PushMatrix
)();
3552 case OPCODE_PUSH_NAME
:
3553 (*ctx
->Exec
.PushName
)( n
[1].ui
);
3555 case OPCODE_RASTER_POS
:
3556 (*ctx
->Exec
.RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3558 case OPCODE_READ_BUFFER
:
3559 (*ctx
->Exec
.ReadBuffer
)( n
[1].e
);
3562 (*ctx
->Exec
.Rectf
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3565 (*ctx
->Exec
.Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
3567 case OPCODE_SCISSOR
:
3568 (*ctx
->Exec
.Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
3570 case OPCODE_SHADE_MODEL
:
3571 (*ctx
->Exec
.ShadeModel
)( n
[1].e
);
3573 case OPCODE_STENCIL_FUNC
:
3574 (*ctx
->Exec
.StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
3576 case OPCODE_STENCIL_MASK
:
3577 (*ctx
->Exec
.StencilMask
)( n
[1].ui
);
3579 case OPCODE_STENCIL_OP
:
3580 (*ctx
->Exec
.StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
3589 (*ctx
->Exec
.TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
3599 (*ctx
->Exec
.TexGenfv
)( n
[1].e
, n
[2].e
, params
);
3602 case OPCODE_TEXPARAMETER
:
3609 (*ctx
->Exec
.TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
3612 case OPCODE_TEX_IMAGE1D
:
3614 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3615 ctx
->Unpack
= _mesa_native_packing
;
3616 (*ctx
->Exec
.TexImage1D
)(
3617 n
[1].e
, /* target */
3619 n
[3].i
, /* components */
3621 n
[5].e
, /* border */
3622 n
[6].e
, /* format */
3625 ctx
->Unpack
= save
; /* restore */
3628 case OPCODE_TEX_IMAGE2D
:
3630 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3631 ctx
->Unpack
= _mesa_native_packing
;
3632 (*ctx
->Exec
.TexImage2D
)(
3633 n
[1].e
, /* target */
3635 n
[3].i
, /* components */
3637 n
[5].i
, /* height */
3638 n
[6].e
, /* border */
3639 n
[7].e
, /* format */
3642 ctx
->Unpack
= save
; /* restore */
3645 case OPCODE_TEX_IMAGE3D
:
3647 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3648 ctx
->Unpack
= _mesa_native_packing
;
3649 (*ctx
->Exec
.TexImage3D
)(
3650 n
[1].e
, /* target */
3652 n
[3].i
, /* components */
3654 n
[5].i
, /* height */
3656 n
[7].e
, /* border */
3657 n
[8].e
, /* format */
3660 ctx
->Unpack
= save
; /* restore */
3663 case OPCODE_TEX_SUB_IMAGE1D
:
3665 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3666 ctx
->Unpack
= _mesa_native_packing
;
3667 (*ctx
->Exec
.TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3669 n
[6].e
, n
[7].data
);
3670 ctx
->Unpack
= save
; /* restore */
3673 case OPCODE_TEX_SUB_IMAGE2D
:
3675 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3676 ctx
->Unpack
= _mesa_native_packing
;
3677 (*ctx
->Exec
.TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3679 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
3680 ctx
->Unpack
= save
; /* restore */
3683 case OPCODE_TEX_SUB_IMAGE3D
:
3685 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3686 ctx
->Unpack
= _mesa_native_packing
;
3687 (*ctx
->Exec
.TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3688 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
3689 n
[8].i
, n
[9].e
, n
[10].e
,
3691 ctx
->Unpack
= save
; /* restore */
3694 case OPCODE_TRANSLATE
:
3695 (*ctx
->Exec
.Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
3697 case OPCODE_VIEWPORT
:
3698 (*ctx
->Exec
.Viewport
)(n
[1].i
, n
[2].i
,
3699 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
3701 case OPCODE_WINDOW_POS
:
3702 (*ctx
->Exec
.WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3704 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
3705 (*ctx
->Exec
.ActiveTextureARB
)( n
[1].e
);
3707 case OPCODE_CLIENT_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
3708 (*ctx
->Exec
.ClientActiveTextureARB
)( n
[1].e
);
3710 case OPCODE_CONTINUE
:
3711 n
= (Node
*) n
[1].next
;
3713 case OPCODE_END_OF_LIST
:
3719 sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
3720 gl_problem( ctx
, msg
);
3725 /* increment n to point to next compiled command */
3726 if (opcode
!=OPCODE_CONTINUE
) {
3727 n
+= InstSize
[opcode
];
3738 /**********************************************************************/
3740 /**********************************************************************/
3746 * Test if a display list number is valid.
3749 _mesa_IsList( GLuint list
)
3751 GET_CURRENT_CONTEXT(ctx
);
3752 return islist(ctx
, list
);
3757 * Delete a sequence of consecutive display lists.
3760 _mesa_DeleteLists( GLuint list
, GLsizei range
)
3762 GET_CURRENT_CONTEXT(ctx
);
3765 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glDeleteLists");
3767 gl_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
3770 for (i
=list
;i
<list
+range
;i
++) {
3771 gl_destroy_list( ctx
, i
);
3778 * Return a display list number, n, such that lists n through n+range-1
3782 _mesa_GenLists(GLsizei range
)
3784 GET_CURRENT_CONTEXT(ctx
);
3787 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx
, "glGenLists", 0);
3789 gl_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
3796 base
= HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
3798 /* reserve the list IDs by with empty/dummy lists */
3800 for (i
=0; i
<range
; i
++) {
3801 HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
3810 * Begin a new display list.
3813 _mesa_NewList( GLuint list
, GLenum mode
)
3815 GET_CURRENT_CONTEXT(ctx
);
3816 struct immediate
*IM
;
3817 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glNewList");
3819 if (MESA_VERBOSE
&VERBOSE_API
)
3820 fprintf(stderr
, "glNewList %u %s\n", list
, gl_lookup_enum_by_nr(mode
));
3823 gl_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
3827 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
3828 gl_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
3832 if (ctx
->CurrentListPtr
) {
3833 /* already compiling a display list */
3834 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
3838 /* Allocate new display list */
3839 ctx
->CurrentListNum
= list
;
3840 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
3841 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
3842 ctx
->CurrentPos
= 0;
3844 IM
= gl_immediate_alloc( ctx
);
3845 SET_IMMEDIATE( ctx
, IM
);
3846 gl_reset_input( ctx
);
3848 ctx
->CompileFlag
= GL_TRUE
;
3849 ctx
->CompileCVAFlag
= GL_FALSE
;
3850 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
3852 ctx
->CurrentDispatch
= &ctx
->Save
;
3853 _glapi_set_dispatch( ctx
->CurrentDispatch
);
3859 * End definition of current display list.
3862 _mesa_EndList( void )
3864 GET_CURRENT_CONTEXT(ctx
);
3865 if (MESA_VERBOSE
&VERBOSE_API
)
3866 fprintf(stderr
, "glEndList\n");
3868 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
, "glEndList" );
3870 /* Check that a list is under construction */
3871 if (!ctx
->CurrentListPtr
) {
3872 gl_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
3876 (void) alloc_instruction( ctx
, OPCODE_END_OF_LIST
, 0 );
3878 /* Destroy old list, if any */
3879 gl_destroy_list(ctx
, ctx
->CurrentListNum
);
3880 /* Install the list */
3881 HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
3884 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
3885 mesa_print_display_list(ctx
->CurrentListNum
);
3887 ctx
->CurrentListNum
= 0;
3888 ctx
->CurrentListPtr
= NULL
;
3889 ctx
->ExecuteFlag
= GL_TRUE
;
3890 ctx
->CompileFlag
= GL_FALSE
;
3891 /* ctx->CompileCVAFlag = ...; */
3893 /* KW: Put back the old input pointer.
3895 if (--ctx
->input
->ref_count
== 0)
3896 gl_immediate_free( ctx
->input
);
3898 SET_IMMEDIATE( ctx
, ctx
->VB
->IM
);
3899 gl_reset_input( ctx
);
3901 /* Haven't tracked down why this is needed.
3905 ctx
->CurrentDispatch
= &ctx
->Exec
;
3906 _glapi_set_dispatch( ctx
->CurrentDispatch
);
3912 _mesa_CallList( GLuint list
)
3914 GET_CURRENT_CONTEXT(ctx
);
3915 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
3916 /* execute the display list, and restore the CompileFlag. */
3917 GLboolean save_compile_flag
;
3919 if (MESA_VERBOSE
&VERBOSE_API
) {
3920 fprintf(stderr
, "glCallList %u\n", list
);
3921 mesa_print_display_list( list
);
3924 save_compile_flag
= ctx
->CompileFlag
;
3925 ctx
->CompileFlag
= GL_FALSE
;
3927 FLUSH_VB( ctx
, "call list" );
3928 execute_list( ctx
, list
);
3929 ctx
->CompileFlag
= save_compile_flag
;
3931 /* also restore API function pointers to point to "save" versions */
3932 if (save_compile_flag
) {
3933 ctx
->CurrentDispatch
= &ctx
->Save
;
3934 _glapi_set_dispatch( ctx
->CurrentDispatch
);
3941 * Execute glCallLists: call multiple display lists.
3944 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
3946 GET_CURRENT_CONTEXT(ctx
);
3949 GLboolean save_compile_flag
;
3951 /* Save the CompileFlag status, turn it off, execute display list,
3952 * and restore the CompileFlag.
3954 save_compile_flag
= ctx
->CompileFlag
;
3955 ctx
->CompileFlag
= GL_FALSE
;
3957 FLUSH_VB( ctx
, "call lists" );
3960 list
= translate_id( i
, type
, lists
);
3961 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
3964 ctx
->CompileFlag
= save_compile_flag
;
3966 /* also restore API function pointers to point to "save" versions */
3967 if (save_compile_flag
) {
3968 ctx
->CurrentDispatch
= &ctx
->Save
;
3969 _glapi_set_dispatch( ctx
->CurrentDispatch
);
3972 /* RESET_IMMEDIATE( ctx ); */
3978 * Set the offset added to list numbers in glCallLists.
3981 _mesa_ListBase( GLuint base
)
3983 GET_CURRENT_CONTEXT(ctx
);
3984 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glListBase");
3985 ctx
->List
.ListBase
= base
;
3992 * Assign all the pointers in 'table' to point to Mesa's display list
3993 * building functions.
3996 _mesa_init_dlist_table( struct _glapi_table
*table
)
3998 table
->Accum
= save_Accum
;
3999 table
->AlphaFunc
= save_AlphaFunc
;
4000 table
->Begin
= save_Begin
;
4001 table
->Bitmap
= save_Bitmap
;
4002 table
->BlendFunc
= save_BlendFunc
;
4003 table
->CallList
= save_CallList
;
4004 table
->CallLists
= save_CallLists
;
4005 table
->Clear
= save_Clear
;
4006 table
->ClearAccum
= save_ClearAccum
;
4007 table
->ClearColor
= save_ClearColor
;
4008 table
->ClearDepth
= save_ClearDepth
;
4009 table
->ClearIndex
= save_ClearIndex
;
4010 table
->ClearStencil
= save_ClearStencil
;
4011 table
->ClipPlane
= save_ClipPlane
;
4012 table
->Color3b
= _mesa_Color3b
;
4013 table
->Color3bv
= _mesa_Color3bv
;
4014 table
->Color3d
= _mesa_Color3d
;
4015 table
->Color3dv
= _mesa_Color3dv
;
4016 table
->Color3f
= _mesa_Color3f
;
4017 table
->Color3fv
= _mesa_Color3fv
;
4018 table
->Color3i
= _mesa_Color3i
;
4019 table
->Color3iv
= _mesa_Color3iv
;
4020 table
->Color3s
= _mesa_Color3s
;
4021 table
->Color3sv
= _mesa_Color3sv
;
4022 table
->Color3ub
= _mesa_Color3ub
;
4023 table
->Color3ubv
= _mesa_Color3ubv
;
4024 table
->Color3ui
= _mesa_Color3ui
;
4025 table
->Color3uiv
= _mesa_Color3uiv
;
4026 table
->Color3us
= _mesa_Color3us
;
4027 table
->Color3usv
= _mesa_Color3usv
;
4028 table
->Color4b
= _mesa_Color4b
;
4029 table
->Color4bv
= _mesa_Color4bv
;
4030 table
->Color4d
= _mesa_Color4d
;
4031 table
->Color4dv
= _mesa_Color4dv
;
4032 table
->Color4f
= _mesa_Color4f
;
4033 table
->Color4fv
= _mesa_Color4fv
;
4034 table
->Color4i
= _mesa_Color4i
;
4035 table
->Color4iv
= _mesa_Color4iv
;
4036 table
->Color4s
= _mesa_Color4s
;
4037 table
->Color4sv
= _mesa_Color4sv
;
4038 table
->Color4ub
= _mesa_Color4ub
;
4039 table
->Color4ubv
= _mesa_Color4ubv
;
4040 table
->Color4ui
= _mesa_Color4ui
;
4041 table
->Color4uiv
= _mesa_Color4uiv
;
4042 table
->Color4us
= _mesa_Color4us
;
4043 table
->Color4usv
= _mesa_Color4usv
;
4044 table
->ColorMask
= save_ColorMask
;
4045 table
->ColorMaterial
= save_ColorMaterial
;
4046 table
->CopyPixels
= save_CopyPixels
;
4047 table
->CullFace
= save_CullFace
;
4048 table
->DeleteLists
= _mesa_DeleteLists
;
4049 table
->DepthFunc
= save_DepthFunc
;
4050 table
->DepthMask
= save_DepthMask
;
4051 table
->DepthRange
= save_DepthRange
;
4052 table
->Disable
= save_Disable
;
4053 table
->DrawBuffer
= save_DrawBuffer
;
4054 table
->DrawPixels
= save_DrawPixels
;
4055 table
->EdgeFlag
= _mesa_EdgeFlag
;
4056 table
->EdgeFlagv
= _mesa_EdgeFlagv
;
4057 table
->Enable
= save_Enable
;
4058 table
->End
= _mesa_End
;
4059 table
->EndList
= _mesa_EndList
;
4060 table
->EvalCoord1d
= _mesa_EvalCoord1d
;
4061 table
->EvalCoord1dv
= _mesa_EvalCoord1dv
;
4062 table
->EvalCoord1f
= _mesa_EvalCoord1f
;
4063 table
->EvalCoord1fv
= _mesa_EvalCoord1fv
;
4064 table
->EvalCoord2d
= _mesa_EvalCoord2d
;
4065 table
->EvalCoord2dv
= _mesa_EvalCoord2dv
;
4066 table
->EvalCoord2f
= _mesa_EvalCoord2f
;
4067 table
->EvalCoord2fv
= _mesa_EvalCoord2fv
;
4068 table
->EvalMesh1
= save_EvalMesh1
;
4069 table
->EvalMesh2
= save_EvalMesh2
;
4070 table
->EvalPoint1
= _mesa_EvalPoint1
;
4071 table
->EvalPoint2
= _mesa_EvalPoint2
;
4072 table
->FeedbackBuffer
= _mesa_FeedbackBuffer
;
4073 table
->Finish
= _mesa_Finish
;
4074 table
->Flush
= _mesa_Flush
;
4075 table
->Fogf
= save_Fogf
;
4076 table
->Fogfv
= save_Fogfv
;
4077 table
->Fogi
= save_Fogi
;
4078 table
->Fogiv
= save_Fogiv
;
4079 table
->FrontFace
= save_FrontFace
;
4080 table
->Frustum
= save_Frustum
;
4081 table
->GenLists
= _mesa_GenLists
;
4082 table
->GetBooleanv
= _mesa_GetBooleanv
;
4083 table
->GetClipPlane
= _mesa_GetClipPlane
;
4084 table
->GetDoublev
= _mesa_GetDoublev
;
4085 table
->GetError
= _mesa_GetError
;
4086 table
->GetFloatv
= _mesa_GetFloatv
;
4087 table
->GetIntegerv
= _mesa_GetIntegerv
;
4088 table
->GetLightfv
= _mesa_GetLightfv
;
4089 table
->GetLightiv
= _mesa_GetLightiv
;
4090 table
->GetMapdv
= _mesa_GetMapdv
;
4091 table
->GetMapfv
= _mesa_GetMapfv
;
4092 table
->GetMapiv
= _mesa_GetMapiv
;
4093 table
->GetMaterialfv
= _mesa_GetMaterialfv
;
4094 table
->GetMaterialiv
= _mesa_GetMaterialiv
;
4095 table
->GetPixelMapfv
= _mesa_GetPixelMapfv
;
4096 table
->GetPixelMapuiv
= _mesa_GetPixelMapuiv
;
4097 table
->GetPixelMapusv
= _mesa_GetPixelMapusv
;
4098 table
->GetPolygonStipple
= _mesa_GetPolygonStipple
;
4099 table
->GetString
= _mesa_GetString
;
4100 table
->GetTexEnvfv
= _mesa_GetTexEnvfv
;
4101 table
->GetTexEnviv
= _mesa_GetTexEnviv
;
4102 table
->GetTexGendv
= _mesa_GetTexGendv
;
4103 table
->GetTexGenfv
= _mesa_GetTexGenfv
;
4104 table
->GetTexGeniv
= _mesa_GetTexGeniv
;
4105 table
->GetTexImage
= _mesa_GetTexImage
;
4106 table
->GetTexLevelParameterfv
= _mesa_GetTexLevelParameterfv
;
4107 table
->GetTexLevelParameteriv
= _mesa_GetTexLevelParameteriv
;
4108 table
->GetTexParameterfv
= _mesa_GetTexParameterfv
;
4109 table
->GetTexParameteriv
= _mesa_GetTexParameteriv
;
4110 table
->Hint
= save_Hint
;
4111 table
->IndexMask
= save_IndexMask
;
4112 table
->Indexd
= _mesa_Indexd
;
4113 table
->Indexdv
= _mesa_Indexdv
;
4114 table
->Indexf
= _mesa_Indexf
;
4115 table
->Indexfv
= _mesa_Indexfv
;
4116 table
->Indexi
= _mesa_Indexi
;
4117 table
->Indexiv
= _mesa_Indexiv
;
4118 table
->Indexs
= _mesa_Indexs
;
4119 table
->Indexsv
= _mesa_Indexsv
;
4120 table
->InitNames
= save_InitNames
;
4121 table
->IsEnabled
= _mesa_IsEnabled
;
4122 table
->IsList
= _mesa_IsList
;
4123 table
->LightModelf
= save_LightModelf
;
4124 table
->LightModelfv
= save_LightModelfv
;
4125 table
->LightModeli
= save_LightModeli
;
4126 table
->LightModeliv
= save_LightModeliv
;
4127 table
->Lightf
= save_Lightf
;
4128 table
->Lightfv
= save_Lightfv
;
4129 table
->Lighti
= save_Lighti
;
4130 table
->Lightiv
= save_Lightiv
;
4131 table
->LineStipple
= save_LineStipple
;
4132 table
->LineWidth
= save_LineWidth
;
4133 table
->ListBase
= save_ListBase
;
4134 table
->LoadIdentity
= save_LoadIdentity
;
4135 table
->LoadMatrixd
= save_LoadMatrixd
;
4136 table
->LoadMatrixf
= save_LoadMatrixf
;
4137 table
->LoadName
= save_LoadName
;
4138 table
->LogicOp
= save_LogicOp
;
4139 table
->Map1d
= save_Map1d
;
4140 table
->Map1f
= save_Map1f
;
4141 table
->Map2d
= save_Map2d
;
4142 table
->Map2f
= save_Map2f
;
4143 table
->MapGrid1d
= save_MapGrid1d
;
4144 table
->MapGrid1f
= save_MapGrid1f
;
4145 table
->MapGrid2d
= save_MapGrid2d
;
4146 table
->MapGrid2f
= save_MapGrid2f
;
4147 table
->Materialf
= _mesa_Materialf
;
4148 table
->Materialfv
= _mesa_Materialfv
;
4149 table
->Materiali
= _mesa_Materiali
;
4150 table
->Materialiv
= _mesa_Materialiv
;
4151 table
->MatrixMode
= save_MatrixMode
;
4152 table
->MultMatrixd
= save_MultMatrixd
;
4153 table
->MultMatrixf
= save_MultMatrixf
;
4154 table
->NewList
= save_NewList
;
4155 table
->Normal3b
= _mesa_Normal3b
;
4156 table
->Normal3bv
= _mesa_Normal3bv
;
4157 table
->Normal3d
= _mesa_Normal3d
;
4158 table
->Normal3dv
= _mesa_Normal3dv
;
4159 table
->Normal3f
= _mesa_Normal3f
;
4160 table
->Normal3fv
= _mesa_Normal3fv
;
4161 table
->Normal3i
= _mesa_Normal3i
;
4162 table
->Normal3iv
= _mesa_Normal3iv
;
4163 table
->Normal3s
= _mesa_Normal3s
;
4164 table
->Normal3sv
= _mesa_Normal3sv
;
4165 table
->Ortho
= save_Ortho
;
4166 table
->PassThrough
= save_PassThrough
;
4167 table
->PixelMapfv
= save_PixelMapfv
;
4168 table
->PixelMapuiv
= save_PixelMapuiv
;
4169 table
->PixelMapusv
= save_PixelMapusv
;
4170 table
->PixelStoref
= _mesa_PixelStoref
;
4171 table
->PixelStorei
= _mesa_PixelStorei
;
4172 table
->PixelTransferf
= save_PixelTransferf
;
4173 table
->PixelTransferi
= save_PixelTransferi
;
4174 table
->PixelZoom
= save_PixelZoom
;
4175 table
->PointSize
= save_PointSize
;
4176 table
->PolygonMode
= save_PolygonMode
;
4177 table
->PolygonOffset
= save_PolygonOffset
;
4178 table
->PolygonStipple
= save_PolygonStipple
;
4179 table
->PopAttrib
= save_PopAttrib
;
4180 table
->PopMatrix
= save_PopMatrix
;
4181 table
->PopName
= save_PopName
;
4182 table
->PushAttrib
= save_PushAttrib
;
4183 table
->PushMatrix
= save_PushMatrix
;
4184 table
->PushName
= save_PushName
;
4185 table
->RasterPos2d
= save_RasterPos2d
;
4186 table
->RasterPos2dv
= save_RasterPos2dv
;
4187 table
->RasterPos2f
= save_RasterPos2f
;
4188 table
->RasterPos2fv
= save_RasterPos2fv
;
4189 table
->RasterPos2i
= save_RasterPos2i
;
4190 table
->RasterPos2iv
= save_RasterPos2iv
;
4191 table
->RasterPos2s
= save_RasterPos2s
;
4192 table
->RasterPos2sv
= save_RasterPos2sv
;
4193 table
->RasterPos3d
= save_RasterPos3d
;
4194 table
->RasterPos3dv
= save_RasterPos3dv
;
4195 table
->RasterPos3f
= save_RasterPos3f
;
4196 table
->RasterPos3fv
= save_RasterPos3fv
;
4197 table
->RasterPos3i
= save_RasterPos3i
;
4198 table
->RasterPos3iv
= save_RasterPos3iv
;
4199 table
->RasterPos3s
= save_RasterPos3s
;
4200 table
->RasterPos3sv
= save_RasterPos3sv
;
4201 table
->RasterPos4d
= save_RasterPos4d
;
4202 table
->RasterPos4dv
= save_RasterPos4dv
;
4203 table
->RasterPos4f
= save_RasterPos4f
;
4204 table
->RasterPos4fv
= save_RasterPos4fv
;
4205 table
->RasterPos4i
= save_RasterPos4i
;
4206 table
->RasterPos4iv
= save_RasterPos4iv
;
4207 table
->RasterPos4s
= save_RasterPos4s
;
4208 table
->RasterPos4sv
= save_RasterPos4sv
;
4209 table
->ReadBuffer
= save_ReadBuffer
;
4210 table
->ReadPixels
= _mesa_ReadPixels
;
4211 table
->Rectd
= save_Rectd
;
4212 table
->Rectdv
= save_Rectdv
;
4213 table
->Rectf
= save_Rectf
;
4214 table
->Rectfv
= save_Rectfv
;
4215 table
->Recti
= save_Recti
;
4216 table
->Rectiv
= save_Rectiv
;
4217 table
->Rects
= save_Rects
;
4218 table
->Rectsv
= save_Rectsv
;
4219 table
->RenderMode
= _mesa_RenderMode
;
4220 table
->Rotated
= save_Rotated
;
4221 table
->Rotatef
= save_Rotatef
;
4222 table
->Scaled
= save_Scaled
;
4223 table
->Scalef
= save_Scalef
;
4224 table
->Scissor
= save_Scissor
;
4225 table
->SelectBuffer
= _mesa_SelectBuffer
;
4226 table
->ShadeModel
= save_ShadeModel
;
4227 table
->StencilFunc
= save_StencilFunc
;
4228 table
->StencilMask
= save_StencilMask
;
4229 table
->StencilOp
= save_StencilOp
;
4230 table
->TexCoord1d
= _mesa_TexCoord1d
;
4231 table
->TexCoord1dv
= _mesa_TexCoord1dv
;
4232 table
->TexCoord1f
= _mesa_TexCoord1f
;
4233 table
->TexCoord1fv
= _mesa_TexCoord1fv
;
4234 table
->TexCoord1i
= _mesa_TexCoord1i
;
4235 table
->TexCoord1iv
= _mesa_TexCoord1iv
;
4236 table
->TexCoord1s
= _mesa_TexCoord1s
;
4237 table
->TexCoord1sv
= _mesa_TexCoord1sv
;
4238 table
->TexCoord2d
= _mesa_TexCoord2d
;
4239 table
->TexCoord2dv
= _mesa_TexCoord2dv
;
4240 table
->TexCoord2f
= _mesa_TexCoord2f
;
4241 table
->TexCoord2fv
= _mesa_TexCoord2fv
;
4242 table
->TexCoord2i
= _mesa_TexCoord2i
;
4243 table
->TexCoord2iv
= _mesa_TexCoord2iv
;
4244 table
->TexCoord2s
= _mesa_TexCoord2s
;
4245 table
->TexCoord2sv
= _mesa_TexCoord2sv
;
4246 table
->TexCoord3d
= _mesa_TexCoord3d
;
4247 table
->TexCoord3dv
= _mesa_TexCoord3dv
;
4248 table
->TexCoord3f
= _mesa_TexCoord3f
;
4249 table
->TexCoord3fv
= _mesa_TexCoord3fv
;
4250 table
->TexCoord3i
= _mesa_TexCoord3i
;
4251 table
->TexCoord3iv
= _mesa_TexCoord3iv
;
4252 table
->TexCoord3s
= _mesa_TexCoord3s
;
4253 table
->TexCoord3sv
= _mesa_TexCoord3sv
;
4254 table
->TexCoord4d
= _mesa_TexCoord4d
;
4255 table
->TexCoord4dv
= _mesa_TexCoord4dv
;
4256 table
->TexCoord4f
= _mesa_TexCoord4f
;
4257 table
->TexCoord4fv
= _mesa_TexCoord4fv
;
4258 table
->TexCoord4i
= _mesa_TexCoord4i
;
4259 table
->TexCoord4iv
= _mesa_TexCoord4iv
;
4260 table
->TexCoord4s
= _mesa_TexCoord4s
;
4261 table
->TexCoord4sv
= _mesa_TexCoord4sv
;
4262 table
->TexEnvf
= save_TexEnvf
;
4263 table
->TexEnvfv
= save_TexEnvfv
;
4264 table
->TexEnvi
= save_TexEnvi
;
4265 table
->TexEnviv
= save_TexEnviv
;
4266 table
->TexGend
= save_TexGend
;
4267 table
->TexGendv
= save_TexGendv
;
4268 table
->TexGenf
= save_TexGenf
;
4269 table
->TexGenfv
= save_TexGenfv
;
4270 table
->TexGeni
= save_TexGeni
;
4271 table
->TexGeniv
= save_TexGeniv
;
4272 table
->TexImage1D
= save_TexImage1D
;
4273 table
->TexImage2D
= save_TexImage2D
;
4274 table
->TexParameterf
= save_TexParameterf
;
4275 table
->TexParameterfv
= save_TexParameterfv
;
4276 table
->TexParameteri
= save_TexParameteri
;
4277 table
->TexParameteriv
= save_TexParameteriv
;
4278 table
->Translated
= save_Translated
;
4279 table
->Translatef
= save_Translatef
;
4280 table
->Vertex2d
= _mesa_Vertex2d
;
4281 table
->Vertex2dv
= _mesa_Vertex2dv
;
4282 table
->Vertex2f
= _mesa_Vertex2f
;
4283 table
->Vertex2fv
= _mesa_Vertex2fv
;
4284 table
->Vertex2i
= _mesa_Vertex2i
;
4285 table
->Vertex2iv
= _mesa_Vertex2iv
;
4286 table
->Vertex2s
= _mesa_Vertex2s
;
4287 table
->Vertex2sv
= _mesa_Vertex2sv
;
4288 table
->Vertex3d
= _mesa_Vertex3d
;
4289 table
->Vertex3dv
= _mesa_Vertex3dv
;
4290 table
->Vertex3f
= _mesa_Vertex3f
;
4291 table
->Vertex3fv
= _mesa_Vertex3fv
;
4292 table
->Vertex3i
= _mesa_Vertex3i
;
4293 table
->Vertex3iv
= _mesa_Vertex3iv
;
4294 table
->Vertex3s
= _mesa_Vertex3s
;
4295 table
->Vertex3sv
= _mesa_Vertex3sv
;
4296 table
->Vertex4d
= _mesa_Vertex4d
;
4297 table
->Vertex4dv
= _mesa_Vertex4dv
;
4298 table
->Vertex4f
= _mesa_Vertex4f
;
4299 table
->Vertex4fv
= _mesa_Vertex4fv
;
4300 table
->Vertex4i
= _mesa_Vertex4i
;
4301 table
->Vertex4iv
= _mesa_Vertex4iv
;
4302 table
->Vertex4s
= _mesa_Vertex4s
;
4303 table
->Vertex4sv
= _mesa_Vertex4sv
;
4304 table
->Viewport
= save_Viewport
;
4306 #ifdef _GLAPI_VERSION_1_1
4307 table
->AreTexturesResident
= _mesa_AreTexturesResident
;
4308 table
->ArrayElement
= _mesa_ArrayElement
;
4309 table
->BindTexture
= save_BindTexture
;
4310 table
->ColorPointer
= _mesa_ColorPointer
;
4311 table
->CopyTexImage1D
= save_CopyTexImage1D
;
4312 table
->CopyTexImage2D
= save_CopyTexImage2D
;
4313 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
4314 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
4315 table
->DeleteTextures
= _mesa_DeleteTextures
;
4316 table
->DisableClientState
= _mesa_DisableClientState
;
4317 table
->DrawArrays
= _mesa_DrawArrays
;
4318 table
->DrawElements
= _mesa_DrawElements
;
4319 table
->EdgeFlagPointer
= _mesa_EdgeFlagPointer
;
4320 table
->EnableClientState
= _mesa_EnableClientState
;
4321 table
->GenTextures
= _mesa_GenTextures
;
4322 table
->GetPointerv
= _mesa_GetPointerv
;
4323 table
->IndexPointer
= _mesa_IndexPointer
;
4324 table
->Indexub
= _mesa_Indexub
;
4325 table
->Indexubv
= _mesa_Indexubv
;
4326 table
->InterleavedArrays
= _mesa_InterleavedArrays
;
4327 table
->IsTexture
= _mesa_IsTexture
;
4328 table
->NormalPointer
= _mesa_NormalPointer
;
4329 table
->PopClientAttrib
= _mesa_PopClientAttrib
;
4330 table
->PrioritizeTextures
= save_PrioritizeTextures
;
4331 table
->PushClientAttrib
= _mesa_PushClientAttrib
;
4332 table
->TexCoordPointer
= _mesa_TexCoordPointer
;
4333 table
->TexSubImage1D
= save_TexSubImage1D
;
4334 table
->TexSubImage2D
= save_TexSubImage2D
;
4335 table
->VertexPointer
= _mesa_VertexPointer
;
4338 #ifdef _GLAPI_VERSION_1_2
4339 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
4340 table
->DrawRangeElements
= _mesa_DrawRangeElements
;
4341 table
->TexImage3D
= save_TexImage3D
;
4342 table
->TexSubImage3D
= save_TexSubImage3D
;
4345 #ifdef _GLAPI_ARB_imaging
4346 /* NOT supported, just call stub functions */
4347 table
->BlendColor
= _mesa_BlendColor
;
4348 table
->BlendEquation
= _mesa_BlendEquation
;
4349 table
->ColorSubTable
= _mesa_ColorSubTable
;
4350 table
->ColorTable
= _mesa_ColorTable
;
4351 table
->ColorTableParameterfv
= _mesa_ColorTableParameterfv
;
4352 table
->ColorTableParameteriv
= _mesa_ColorTableParameteriv
;
4353 table
->ConvolutionFilter1D
= _mesa_ConvolutionFilter1D
;
4354 table
->ConvolutionFilter2D
= _mesa_ConvolutionFilter2D
;
4355 table
->ConvolutionParameterf
= _mesa_ConvolutionParameterf
;
4356 table
->ConvolutionParameterfv
= _mesa_ConvolutionParameterfv
;
4357 table
->ConvolutionParameteri
= _mesa_ConvolutionParameteri
;
4358 table
->ConvolutionParameteriv
= _mesa_ConvolutionParameteriv
;
4359 table
->CopyColorSubTable
= _mesa_CopyColorSubTable
;
4360 table
->CopyColorTable
= _mesa_CopyColorTable
;
4361 table
->CopyConvolutionFilter1D
= _mesa_CopyConvolutionFilter1D
;
4362 table
->CopyConvolutionFilter2D
= _mesa_CopyConvolutionFilter2D
;
4363 table
->GetColorTable
= _mesa_GetColorTable
;
4364 table
->GetColorTableParameterfv
= _mesa_GetColorTableParameterfv
;
4365 table
->GetColorTableParameteriv
= _mesa_GetColorTableParameteriv
;
4366 table
->GetConvolutionFilter
= _mesa_GetConvolutionFilter
;
4367 table
->GetConvolutionParameterfv
= _mesa_GetConvolutionParameterfv
;
4368 table
->GetConvolutionParameteriv
= _mesa_GetConvolutionParameteriv
;
4369 table
->GetHistogram
= _mesa_GetHistogram
;
4370 table
->GetHistogramParameterfv
= _mesa_GetHistogramParameterfv
;
4371 table
->GetHistogramParameteriv
= _mesa_GetHistogramParameteriv
;
4372 table
->GetMinmax
= _mesa_GetMinmax
;
4373 table
->GetMinmaxParameterfv
= _mesa_GetMinmaxParameterfv
;
4374 table
->GetMinmaxParameteriv
= _mesa_GetMinmaxParameteriv
;
4375 table
->GetSeparableFilter
= _mesa_GetSeparableFilter
;
4376 table
->Histogram
= _mesa_Histogram
;
4377 table
->Minmax
= _mesa_Minmax
;
4378 table
->ResetHistogram
= _mesa_ResetHistogram
;
4379 table
->ResetMinmax
= _mesa_ResetMinmax
;
4380 table
->SeparableFilter2D
= _mesa_SeparableFilter2D
;
4383 #ifdef _GLAPI_EXT_paletted_texture
4384 table
->ColorTableEXT
= save_ColorTableEXT
;
4385 table
->ColorSubTableEXT
= save_ColorSubTableEXT
;
4386 table
->GetColorTableEXT
= _mesa_GetColorTableEXT
;
4387 table
->GetColorTableParameterfvEXT
= _mesa_GetColorTableParameterfvEXT
;
4388 table
->GetColorTableParameterivEXT
= _mesa_GetColorTableParameterivEXT
;
4391 #ifdef _GLAPI_EXT_compiled_vertex_array
4392 table
->LockArraysEXT
= _mesa_LockArraysEXT
;
4393 table
->UnlockArraysEXT
= _mesa_UnlockArraysEXT
;
4396 #ifdef _GLAPI_EXT_point_parameters
4397 table
->PointParameterfEXT
= save_PointParameterfEXT
;
4398 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
4401 #ifdef _GLAPI_EXT_polygon_offset
4402 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
4405 #ifdef _GLAPI_EXT_blend_minmax
4406 table
->BlendEquationEXT
= save_BlendEquation
;
4409 #ifdef _GLAPI_EXT_blend_color
4410 table
->BlendColorEXT
= save_BlendColor
;
4413 #ifdef _GLAPI_ARB_multitexture
4414 table
->ActiveTextureARB
= save_ActiveTextureARB
;
4415 table
->ClientActiveTextureARB
= save_ClientActiveTextureARB
;
4416 table
->MultiTexCoord1dARB
= _mesa_MultiTexCoord1dARB
;
4417 table
->MultiTexCoord1dvARB
= _mesa_MultiTexCoord1dvARB
;
4418 table
->MultiTexCoord1fARB
= _mesa_MultiTexCoord1fARB
;
4419 table
->MultiTexCoord1fvARB
= _mesa_MultiTexCoord1fvARB
;
4420 table
->MultiTexCoord1iARB
= _mesa_MultiTexCoord1iARB
;
4421 table
->MultiTexCoord1ivARB
= _mesa_MultiTexCoord1ivARB
;
4422 table
->MultiTexCoord1sARB
= _mesa_MultiTexCoord1sARB
;
4423 table
->MultiTexCoord1svARB
= _mesa_MultiTexCoord1svARB
;
4424 table
->MultiTexCoord2dARB
= _mesa_MultiTexCoord2dARB
;
4425 table
->MultiTexCoord2dvARB
= _mesa_MultiTexCoord2dvARB
;
4426 table
->MultiTexCoord2fARB
= _mesa_MultiTexCoord2fARB
;
4427 table
->MultiTexCoord2fvARB
= _mesa_MultiTexCoord2fvARB
;
4428 table
->MultiTexCoord2iARB
= _mesa_MultiTexCoord2iARB
;
4429 table
->MultiTexCoord2ivARB
= _mesa_MultiTexCoord2ivARB
;
4430 table
->MultiTexCoord2sARB
= _mesa_MultiTexCoord2sARB
;
4431 table
->MultiTexCoord2svARB
= _mesa_MultiTexCoord2svARB
;
4432 table
->MultiTexCoord3dARB
= _mesa_MultiTexCoord3dARB
;
4433 table
->MultiTexCoord3dvARB
= _mesa_MultiTexCoord3dvARB
;
4434 table
->MultiTexCoord3fARB
= _mesa_MultiTexCoord3fARB
;
4435 table
->MultiTexCoord3fvARB
= _mesa_MultiTexCoord3fvARB
;
4436 table
->MultiTexCoord3iARB
= _mesa_MultiTexCoord3iARB
;
4437 table
->MultiTexCoord3ivARB
= _mesa_MultiTexCoord3ivARB
;
4438 table
->MultiTexCoord3sARB
= _mesa_MultiTexCoord3sARB
;
4439 table
->MultiTexCoord3svARB
= _mesa_MultiTexCoord3svARB
;
4440 table
->MultiTexCoord4dARB
= _mesa_MultiTexCoord4dARB
;
4441 table
->MultiTexCoord4dvARB
= _mesa_MultiTexCoord4dvARB
;
4442 table
->MultiTexCoord4fARB
= _mesa_MultiTexCoord4fARB
;
4443 table
->MultiTexCoord4fvARB
= _mesa_MultiTexCoord4fvARB
;
4444 table
->MultiTexCoord4iARB
= _mesa_MultiTexCoord4iARB
;
4445 table
->MultiTexCoord4ivARB
= _mesa_MultiTexCoord4ivARB
;
4446 table
->MultiTexCoord4sARB
= _mesa_MultiTexCoord4sARB
;
4447 table
->MultiTexCoord4svARB
= _mesa_MultiTexCoord4svARB
;
4450 #ifdef _GLAPI_INGR_blend_func_separate
4451 table
->BlendFuncSeparateINGR
= save_BlendFuncSeparateINGR
;
4454 #ifdef _GLAPI_MESA_window_pos
4455 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
4458 #ifdef _GLAPI_MESA_resize_buffers
4459 table
->ResizeBuffersMESA
= _mesa_ResizeBuffersMESA
;
4468 static const char *enum_string( GLenum k
)
4470 return gl_lookup_enum_by_nr( k
);
4475 * Print the commands in a display list. For debugging only.
4476 * TODO: many commands aren't handled yet.
4478 static void print_list( GLcontext
*ctx
, FILE *f
, GLuint list
)
4484 if (!glIsList(list
)) {
4485 fprintf(f
,"%u is not a display list ID\n",list
);
4489 n
= (Node
*) HashLookup(ctx
->Shared
->DisplayList
, list
);
4491 fprintf( f
, "START-LIST %u, address %p\n", list
, (void*)n
);
4493 done
= n
? GL_FALSE
: GL_TRUE
;
4495 opcode
= n
[0].opcode
;
4499 fprintf(f
,"accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
4502 fprintf(f
,"Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
4503 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
4505 case OPCODE_CALL_LIST
:
4506 fprintf(f
,"CallList %d\n", (int) n
[1].ui
);
4508 case OPCODE_CALL_LIST_OFFSET
:
4509 fprintf(f
,"CallList %d + offset %u = %u\n", (int) n
[1].ui
,
4510 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
4512 case OPCODE_DISABLE
:
4513 fprintf(f
,"Disable %s\n", enum_string(n
[1].e
));
4516 fprintf(f
,"Enable %s\n", enum_string(n
[1].e
));
4518 case OPCODE_FRUSTUM
:
4519 fprintf(f
,"Frustum %g %g %g %g %g %g\n",
4520 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4522 case OPCODE_LINE_STIPPLE
:
4523 fprintf(f
,"LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
4525 case OPCODE_LOAD_IDENTITY
:
4526 fprintf(f
,"LoadIdentity\n");
4528 case OPCODE_LOAD_MATRIX
:
4529 fprintf(f
,"LoadMatrix\n");
4530 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
4531 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
4532 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
4533 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
4535 case OPCODE_MULT_MATRIX
:
4536 fprintf(f
,"MultMatrix (or Rotate)\n");
4537 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
4538 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
4539 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
4540 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
4543 fprintf(f
,"Ortho %g %g %g %g %g %g\n",
4544 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4546 case OPCODE_POP_ATTRIB
:
4547 fprintf(f
,"PopAttrib\n");
4549 case OPCODE_POP_MATRIX
:
4550 fprintf(f
,"PopMatrix\n");
4552 case OPCODE_POP_NAME
:
4553 fprintf(f
,"PopName\n");
4555 case OPCODE_PUSH_ATTRIB
:
4556 fprintf(f
,"PushAttrib %x\n", n
[1].bf
);
4558 case OPCODE_PUSH_MATRIX
:
4559 fprintf(f
,"PushMatrix\n");
4561 case OPCODE_PUSH_NAME
:
4562 fprintf(f
,"PushName %d\n", (int) n
[1].ui
);
4564 case OPCODE_RASTER_POS
:
4565 fprintf(f
,"RasterPos %g %g %g %g\n", n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
4568 fprintf( f
, "Rectf %g %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4571 fprintf(f
,"Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
4573 case OPCODE_TRANSLATE
:
4574 fprintf(f
,"Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
4576 case OPCODE_BIND_TEXTURE
:
4577 fprintf(f
,"BindTexture %s %d\n", gl_lookup_enum_by_nr(n
[1].ui
),
4580 case OPCODE_SHADE_MODEL
:
4581 fprintf(f
,"ShadeModel %s\n", gl_lookup_enum_by_nr(n
[1].ui
));
4585 * meta opcodes/commands
4588 fprintf(f
,"Error: %s %s\n", enum_string(n
[1].e
), (const char *)n
[2].data
);
4590 case OPCODE_VERTEX_CASSETTE
:
4591 fprintf(f
,"VERTEX-CASSETTE, id %u, rows %u..%u\n",
4592 ((struct immediate
*) n
[1].data
)->id
,
4596 case OPCODE_CONTINUE
:
4597 fprintf(f
,"DISPLAY-LIST-CONTINUE\n");
4598 n
= (Node
*) n
[1].next
;
4600 case OPCODE_END_OF_LIST
:
4601 fprintf(f
,"END-LIST %u\n", list
);
4605 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
4606 fprintf(f
,"ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
4611 fprintf(f
,"command %d, %u operands\n",opcode
,InstSize
[opcode
]);
4615 /* increment n to point to next compiled command */
4616 if (opcode
!=OPCODE_CONTINUE
) {
4617 n
+= InstSize
[opcode
];
4625 * Clients may call this function to help debug display list problems.
4626 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
4627 * changed, or break in the future without notice.
4629 void mesa_print_display_list( GLuint list
)
4631 GET_CURRENT_CONTEXT(ctx
);
4632 print_list( ctx
, stderr
, list
);