1 /* $Id: dlist.c,v 1.37 2000/04/07 16:45:26 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
47 #include "extensions.h"
82 Functions which aren't compiled but executed immediately:
97 Functions which cause errors if called while compiling a display list:
104 * Display list instructions are stored as sequences of "nodes". Nodes
105 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
106 * are linked together with a pointer.
110 /* How many nodes to allocate at a time:
111 * - reduced now that we hold vertices etc. elsewhere.
113 #define BLOCK_SIZE 64
117 * Display list opcodes.
119 * The fact that these identifiers are assigned consecutive
120 * integer values starting at 0 is very important, see InstSize array usage)
122 * KW: Commented out opcodes now handled by vertex-cassettes.
130 OPCODE_BLEND_EQUATION
,
132 OPCODE_BLEND_FUNC_SEPARATE
,
134 OPCODE_CALL_LIST_OFFSET
,
140 OPCODE_CLEAR_STENCIL
,
143 OPCODE_COLOR_MATERIAL
,
145 OPCODE_COLOR_SUB_TABLE
,
147 OPCODE_COPY_TEX_IMAGE1D
,
148 OPCODE_COPY_TEX_IMAGE2D
,
149 OPCODE_COPY_TEX_SUB_IMAGE1D
,
150 OPCODE_COPY_TEX_SUB_IMAGE2D
,
151 OPCODE_COPY_TEX_SUB_IMAGE3D
,
178 OPCODE_LOAD_IDENTITY
,
191 OPCODE_PIXEL_TRANSFER
,
194 OPCODE_POINT_PARAMETERS
,
196 OPCODE_POLYGON_STIPPLE
,
197 OPCODE_POLYGON_OFFSET
,
201 OPCODE_PRIORITIZE_TEXTURE
,
210 OPCODE_SELECT_TEXTURE_SGIS
,
211 OPCODE_SELECT_TEXTURE_COORD_SET
,
222 OPCODE_TEX_SUB_IMAGE1D
,
223 OPCODE_TEX_SUB_IMAGE2D
,
224 OPCODE_TEX_SUB_IMAGE3D
,
228 /* GL_ARB_multitexture */
229 OPCODE_ACTIVE_TEXTURE
,
230 OPCODE_CLIENT_ACTIVE_TEXTURE
,
231 /* GL_SGIX/SGIS_pixel_texture */
232 OPCODE_PIXEL_TEXGEN_SGIX
,
233 OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
,
234 /* The following three are meta instructions */
235 OPCODE_ERROR
, /* raise compiled-in error */
236 OPCODE_VERTEX_CASSETTE
, /* render prebuilt vertex buffer */
243 * Each instruction in the display list is stored as a sequence of
244 * contiguous nodes in memory.
245 * Each node is the union of a variety of datatypes.
259 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
264 /* Number of nodes of storage needed for each instruction: */
265 static GLuint InstSize
[ OPCODE_END_OF_LIST
+1 ];
267 void mesa_print_display_list( GLuint list
);
270 /**********************************************************************/
271 /***** Private *****/
272 /**********************************************************************/
276 * Allocate space for a display list instruction.
277 * Input: opcode - type of instruction
278 * argcount - number of arguments following the instruction
279 * Return: pointer to first node in the instruction
281 static Node
*alloc_instruction( GLcontext
*ctx
, OpCode opcode
, GLint argcount
)
284 GLuint count
= InstSize
[opcode
];
286 assert( (GLint
) count
== argcount
+1 );
288 if (ctx
->CurrentPos
+ count
+ 2 > BLOCK_SIZE
) {
289 /* This block is full. Allocate a new block and chain to it */
290 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
291 n
[0].opcode
= OPCODE_CONTINUE
;
292 newblock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
294 gl_error( ctx
, GL_OUT_OF_MEMORY
, "Building display list" );
297 n
[1].next
= (Node
*) newblock
;
298 ctx
->CurrentBlock
= newblock
;
302 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
303 ctx
->CurrentPos
+= count
;
305 n
[0].opcode
= opcode
;
313 * Make an empty display list. This is used by glGenLists() to
314 * reserver display list IDs.
316 static Node
*make_empty_list( void )
318 Node
*n
= (Node
*) MALLOC( sizeof(Node
) );
319 n
[0].opcode
= OPCODE_END_OF_LIST
;
326 * Destroy all nodes in a display list.
327 * Input: list - display list number
329 void gl_destroy_list( GLcontext
*ctx
, GLuint list
)
337 block
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
340 done
= block
? GL_FALSE
: GL_TRUE
;
342 switch (n
[0].opcode
) {
343 /* special cases first */
344 case OPCODE_VERTEX_CASSETTE
:
345 if ( ! -- ((struct immediate
*) n
[1].data
)->ref_count
)
346 gl_immediate_free( (struct immediate
*) n
[1].data
);
347 n
+= InstSize
[n
[0].opcode
];
351 n
+= InstSize
[n
[0].opcode
];
355 n
+= InstSize
[n
[0].opcode
];
357 case OPCODE_DRAW_PIXELS
:
359 n
+= InstSize
[n
[0].opcode
];
363 n
+= InstSize
[n
[0].opcode
];
365 case OPCODE_COLOR_TABLE
:
367 n
+= InstSize
[n
[0].opcode
];
369 case OPCODE_COLOR_SUB_TABLE
:
371 n
+= InstSize
[n
[0].opcode
];
373 case OPCODE_POLYGON_STIPPLE
:
375 n
+= InstSize
[n
[0].opcode
];
377 case OPCODE_TEX_IMAGE1D
:
379 n
+= InstSize
[n
[0].opcode
];
381 case OPCODE_TEX_IMAGE2D
:
383 n
+= InstSize
[n
[0].opcode
];
385 case OPCODE_TEX_IMAGE3D
:
387 n
+= InstSize
[n
[0].opcode
];
389 case OPCODE_TEX_SUB_IMAGE1D
:
391 n
+= InstSize
[n
[0].opcode
];
393 case OPCODE_TEX_SUB_IMAGE2D
:
395 n
+= InstSize
[n
[0].opcode
];
397 case OPCODE_TEX_SUB_IMAGE3D
:
399 n
+= InstSize
[n
[0].opcode
];
401 case OPCODE_CONTINUE
:
402 n
= (Node
*) n
[1].next
;
406 case OPCODE_END_OF_LIST
:
411 /* Most frequent case */
412 n
+= InstSize
[n
[0].opcode
];
417 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
423 * Translate the nth element of list from type to GLuint.
425 static GLuint
translate_id( GLsizei n
, GLenum type
, const GLvoid
*list
)
437 bptr
= (GLbyte
*) list
;
438 return (GLuint
) *(bptr
+n
);
439 case GL_UNSIGNED_BYTE
:
440 ubptr
= (GLubyte
*) list
;
441 return (GLuint
) *(ubptr
+n
);
443 sptr
= (GLshort
*) list
;
444 return (GLuint
) *(sptr
+n
);
445 case GL_UNSIGNED_SHORT
:
446 usptr
= (GLushort
*) list
;
447 return (GLuint
) *(usptr
+n
);
449 iptr
= (GLint
*) list
;
450 return (GLuint
) *(iptr
+n
);
451 case GL_UNSIGNED_INT
:
452 uiptr
= (GLuint
*) list
;
453 return (GLuint
) *(uiptr
+n
);
455 fptr
= (GLfloat
*) list
;
456 return (GLuint
) *(fptr
+n
);
458 ubptr
= ((GLubyte
*) list
) + 2*n
;
459 return (GLuint
) *ubptr
* 256 + (GLuint
) *(ubptr
+1);
461 ubptr
= ((GLubyte
*) list
) + 3*n
;
462 return (GLuint
) *ubptr
* 65536
463 + (GLuint
) *(ubptr
+1) * 256
464 + (GLuint
) *(ubptr
+2);
466 ubptr
= ((GLubyte
*) list
) + 4*n
;
467 return (GLuint
) *ubptr
* 16777216
468 + (GLuint
) *(ubptr
+1) * 65536
469 + (GLuint
) *(ubptr
+2) * 256
470 + (GLuint
) *(ubptr
+3);
479 /**********************************************************************/
481 /**********************************************************************/
483 void gl_init_lists( void )
485 static int init_flag
= 0;
488 InstSize
[OPCODE_ACCUM
] = 3;
489 InstSize
[OPCODE_ALPHA_FUNC
] = 3;
490 InstSize
[OPCODE_BIND_TEXTURE
] = 3;
491 InstSize
[OPCODE_BITMAP
] = 8;
492 InstSize
[OPCODE_BLEND_COLOR
] = 5;
493 InstSize
[OPCODE_BLEND_EQUATION
] = 2;
494 InstSize
[OPCODE_BLEND_FUNC
] = 3;
495 InstSize
[OPCODE_BLEND_FUNC_SEPARATE
] = 5;
496 InstSize
[OPCODE_CALL_LIST
] = 2;
497 InstSize
[OPCODE_CALL_LIST_OFFSET
] = 2;
498 InstSize
[OPCODE_CLEAR
] = 2;
499 InstSize
[OPCODE_CLEAR_ACCUM
] = 5;
500 InstSize
[OPCODE_CLEAR_COLOR
] = 5;
501 InstSize
[OPCODE_CLEAR_DEPTH
] = 2;
502 InstSize
[OPCODE_CLEAR_INDEX
] = 2;
503 InstSize
[OPCODE_CLEAR_STENCIL
] = 2;
504 InstSize
[OPCODE_CLIP_PLANE
] = 6;
505 InstSize
[OPCODE_COLOR_MASK
] = 5;
506 InstSize
[OPCODE_COLOR_MATERIAL
] = 3;
507 InstSize
[OPCODE_COLOR_TABLE
] = 7;
508 InstSize
[OPCODE_COLOR_SUB_TABLE
] = 7;
509 InstSize
[OPCODE_COPY_PIXELS
] = 6;
510 InstSize
[OPCODE_COPY_TEX_IMAGE1D
] = 8;
511 InstSize
[OPCODE_COPY_TEX_IMAGE2D
] = 9;
512 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE1D
] = 7;
513 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE2D
] = 9;
514 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE3D
] = 10;
515 InstSize
[OPCODE_CULL_FACE
] = 2;
516 InstSize
[OPCODE_DEPTH_FUNC
] = 2;
517 InstSize
[OPCODE_DEPTH_MASK
] = 2;
518 InstSize
[OPCODE_DEPTH_RANGE
] = 3;
519 InstSize
[OPCODE_DISABLE
] = 2;
520 InstSize
[OPCODE_DRAW_BUFFER
] = 2;
521 InstSize
[OPCODE_DRAW_PIXELS
] = 6;
522 InstSize
[OPCODE_ENABLE
] = 2;
523 InstSize
[OPCODE_EVALCOORD1
] = 2;
524 InstSize
[OPCODE_EVALCOORD2
] = 3;
525 InstSize
[OPCODE_EVALMESH1
] = 4;
526 InstSize
[OPCODE_EVALMESH2
] = 6;
527 InstSize
[OPCODE_EVALPOINT1
] = 2;
528 InstSize
[OPCODE_EVALPOINT2
] = 3;
529 InstSize
[OPCODE_FOG
] = 6;
530 InstSize
[OPCODE_FRONT_FACE
] = 2;
531 InstSize
[OPCODE_FRUSTUM
] = 7;
532 InstSize
[OPCODE_HINT
] = 3;
533 InstSize
[OPCODE_HINT_PGI
] = 3;
534 InstSize
[OPCODE_INDEX_MASK
] = 2;
535 InstSize
[OPCODE_INIT_NAMES
] = 1;
536 InstSize
[OPCODE_LIGHT
] = 7;
537 InstSize
[OPCODE_LIGHT_MODEL
] = 6;
538 InstSize
[OPCODE_LINE_STIPPLE
] = 3;
539 InstSize
[OPCODE_LINE_WIDTH
] = 2;
540 InstSize
[OPCODE_LIST_BASE
] = 2;
541 InstSize
[OPCODE_LOAD_IDENTITY
] = 1;
542 InstSize
[OPCODE_LOAD_MATRIX
] = 17;
543 InstSize
[OPCODE_LOAD_NAME
] = 2;
544 InstSize
[OPCODE_LOGIC_OP
] = 2;
545 InstSize
[OPCODE_MAP1
] = 7;
546 InstSize
[OPCODE_MAP2
] = 11;
547 InstSize
[OPCODE_MAPGRID1
] = 4;
548 InstSize
[OPCODE_MAPGRID2
] = 7;
549 InstSize
[OPCODE_MATRIX_MODE
] = 2;
550 InstSize
[OPCODE_MULT_MATRIX
] = 17;
551 InstSize
[OPCODE_ORTHO
] = 7;
552 InstSize
[OPCODE_PASSTHROUGH
] = 2;
553 InstSize
[OPCODE_PIXEL_MAP
] = 4;
554 InstSize
[OPCODE_PIXEL_TRANSFER
] = 3;
555 InstSize
[OPCODE_PIXEL_ZOOM
] = 3;
556 InstSize
[OPCODE_POINT_SIZE
] = 2;
557 InstSize
[OPCODE_POINT_PARAMETERS
] = 5;
558 InstSize
[OPCODE_POLYGON_MODE
] = 3;
559 InstSize
[OPCODE_POLYGON_STIPPLE
] = 2;
560 InstSize
[OPCODE_POLYGON_OFFSET
] = 3;
561 InstSize
[OPCODE_POP_ATTRIB
] = 1;
562 InstSize
[OPCODE_POP_MATRIX
] = 1;
563 InstSize
[OPCODE_POP_NAME
] = 1;
564 InstSize
[OPCODE_PRIORITIZE_TEXTURE
] = 3;
565 InstSize
[OPCODE_PUSH_ATTRIB
] = 2;
566 InstSize
[OPCODE_PUSH_MATRIX
] = 1;
567 InstSize
[OPCODE_PUSH_NAME
] = 2;
568 InstSize
[OPCODE_RASTER_POS
] = 5;
569 InstSize
[OPCODE_RECTF
] = 5;
570 InstSize
[OPCODE_READ_BUFFER
] = 2;
571 InstSize
[OPCODE_SCALE
] = 4;
572 InstSize
[OPCODE_SCISSOR
] = 5;
573 InstSize
[OPCODE_STENCIL_FUNC
] = 4;
574 InstSize
[OPCODE_STENCIL_MASK
] = 2;
575 InstSize
[OPCODE_STENCIL_OP
] = 4;
576 InstSize
[OPCODE_SHADE_MODEL
] = 2;
577 InstSize
[OPCODE_TEXENV
] = 7;
578 InstSize
[OPCODE_TEXGEN
] = 7;
579 InstSize
[OPCODE_TEXPARAMETER
] = 7;
580 InstSize
[OPCODE_TEX_IMAGE1D
] = 9;
581 InstSize
[OPCODE_TEX_IMAGE2D
] = 10;
582 InstSize
[OPCODE_TEX_IMAGE3D
] = 11;
583 InstSize
[OPCODE_TEX_SUB_IMAGE1D
] = 8;
584 InstSize
[OPCODE_TEX_SUB_IMAGE2D
] = 10;
585 InstSize
[OPCODE_TEX_SUB_IMAGE3D
] = 12;
586 InstSize
[OPCODE_TRANSLATE
] = 4;
587 InstSize
[OPCODE_VIEWPORT
] = 5;
588 InstSize
[OPCODE_WINDOW_POS
] = 5;
589 InstSize
[OPCODE_CONTINUE
] = 2;
590 InstSize
[OPCODE_ERROR
] = 3;
591 InstSize
[OPCODE_VERTEX_CASSETTE
] = 9;
592 InstSize
[OPCODE_END_OF_LIST
] = 1;
593 /* GL_SGIX/SGIS_pixel_texture */
594 InstSize
[OPCODE_PIXEL_TEXGEN_SGIX
] = 2;
595 InstSize
[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
] = 3,
596 /* GL_ARB_multitexture */
597 InstSize
[OPCODE_ACTIVE_TEXTURE
] = 2;
598 InstSize
[OPCODE_CLIENT_ACTIVE_TEXTURE
] = 2;
605 * Display List compilation functions
610 static void save_Accum( GLenum op
, GLfloat value
)
612 GET_CURRENT_CONTEXT(ctx
);
614 FLUSH_VB(ctx
, "dlist");
615 n
= alloc_instruction( ctx
, OPCODE_ACCUM
, 2 );
620 if (ctx
->ExecuteFlag
) {
621 (*ctx
->Exec
->Accum
)( op
, value
);
626 static void save_AlphaFunc( GLenum func
, GLclampf ref
)
628 GET_CURRENT_CONTEXT(ctx
);
630 FLUSH_VB(ctx
, "dlist");
631 n
= alloc_instruction( ctx
, OPCODE_ALPHA_FUNC
, 2 );
634 n
[2].f
= (GLfloat
) ref
;
636 if (ctx
->ExecuteFlag
) {
637 (*ctx
->Exec
->AlphaFunc
)( func
, ref
);
642 static void save_Begin( GLenum mode
)
644 _mesa_Begin(mode
); /* special case */
648 static void save_BindTexture( GLenum target
, GLuint texture
)
650 GET_CURRENT_CONTEXT(ctx
);
652 FLUSH_VB(ctx
, "dlist");
653 n
= alloc_instruction( ctx
, OPCODE_BIND_TEXTURE
, 2 );
658 if (ctx
->ExecuteFlag
) {
659 (*ctx
->Exec
->BindTexture
)( target
, texture
);
664 static void save_Bitmap( GLsizei width
, GLsizei height
,
665 GLfloat xorig
, GLfloat yorig
,
666 GLfloat xmove
, GLfloat ymove
,
667 const GLubyte
*pixels
)
669 GET_CURRENT_CONTEXT(ctx
);
670 GLvoid
*image
= _mesa_unpack_bitmap( width
, height
, pixels
, &ctx
->Unpack
);
672 FLUSH_VB(ctx
, "dlist");
673 n
= alloc_instruction( ctx
, OPCODE_BITMAP
, 7 );
675 n
[1].i
= (GLint
) width
;
676 n
[2].i
= (GLint
) height
;
686 if (ctx
->ExecuteFlag
) {
687 (*ctx
->Exec
->Bitmap
)( width
, height
,
688 xorig
, yorig
, xmove
, ymove
, pixels
);
693 static void save_BlendEquation( GLenum mode
)
695 GET_CURRENT_CONTEXT(ctx
);
697 FLUSH_VB(ctx
, "dlist");
698 n
= alloc_instruction( ctx
, OPCODE_BLEND_EQUATION
, 1 );
702 if (ctx
->ExecuteFlag
) {
703 (*ctx
->Exec
->BlendEquation
)( mode
);
708 static void save_BlendFunc( GLenum sfactor
, GLenum dfactor
)
710 GET_CURRENT_CONTEXT(ctx
);
712 FLUSH_VB(ctx
, "dlist");
713 n
= alloc_instruction( ctx
, OPCODE_BLEND_FUNC
, 2 );
718 if (ctx
->ExecuteFlag
) {
719 (*ctx
->Exec
->BlendFunc
)( sfactor
, dfactor
);
724 static void save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
725 GLenum sfactorA
, GLenum dfactorA
)
727 GET_CURRENT_CONTEXT(ctx
);
729 FLUSH_VB(ctx
, "dlist");
730 n
= alloc_instruction( ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4 );
737 if (ctx
->ExecuteFlag
) {
738 (*ctx
->Exec
->BlendFuncSeparateEXT
)( sfactorRGB
, dfactorRGB
,
744 static void save_BlendColor( GLfloat red
, GLfloat green
,
745 GLfloat blue
, GLfloat alpha
)
747 GET_CURRENT_CONTEXT(ctx
);
749 FLUSH_VB(ctx
, "dlist");
750 n
= alloc_instruction( ctx
, OPCODE_BLEND_COLOR
, 4 );
757 if (ctx
->ExecuteFlag
) {
758 (*ctx
->Exec
->BlendColor
)( red
, green
, blue
, alpha
);
763 static void save_CallList( GLuint list
)
765 GET_CURRENT_CONTEXT(ctx
);
767 FLUSH_VB(ctx
, "dlist");
768 n
= alloc_instruction( ctx
, OPCODE_CALL_LIST
, 1 );
772 if (ctx
->ExecuteFlag
) {
773 (*ctx
->Exec
->CallList
)( list
);
778 static void save_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
780 GET_CURRENT_CONTEXT(ctx
);
782 FLUSH_VB(ctx
, "dlist");
785 GLuint list
= translate_id( i
, type
, lists
);
786 Node
*n
= alloc_instruction( ctx
, OPCODE_CALL_LIST_OFFSET
, 1 );
791 if (ctx
->ExecuteFlag
) {
792 (*ctx
->Exec
->CallLists
)( n
, type
, lists
);
797 static void save_Clear( GLbitfield mask
)
799 GET_CURRENT_CONTEXT(ctx
);
801 FLUSH_VB(ctx
, "dlist");
802 n
= alloc_instruction( ctx
, OPCODE_CLEAR
, 1 );
806 if (ctx
->ExecuteFlag
) {
807 (*ctx
->Exec
->Clear
)( mask
);
812 static void save_ClearAccum( GLfloat red
, GLfloat green
,
813 GLfloat blue
, GLfloat alpha
)
815 GET_CURRENT_CONTEXT(ctx
);
817 FLUSH_VB(ctx
, "dlist");
818 n
= alloc_instruction( ctx
, OPCODE_CLEAR_ACCUM
, 4 );
825 if (ctx
->ExecuteFlag
) {
826 (*ctx
->Exec
->ClearAccum
)( red
, green
, blue
, alpha
);
831 static void save_ClearColor( GLclampf red
, GLclampf green
,
832 GLclampf blue
, GLclampf alpha
)
834 GET_CURRENT_CONTEXT(ctx
);
836 FLUSH_VB(ctx
, "dlist");
837 n
= alloc_instruction( ctx
, OPCODE_CLEAR_COLOR
, 4 );
844 if (ctx
->ExecuteFlag
) {
845 (*ctx
->Exec
->ClearColor
)( red
, green
, blue
, alpha
);
850 static void save_ClearDepth( GLclampd depth
)
852 GET_CURRENT_CONTEXT(ctx
);
854 FLUSH_VB(ctx
, "dlist");
855 n
= alloc_instruction( ctx
, OPCODE_CLEAR_DEPTH
, 1 );
857 n
[1].f
= (GLfloat
) depth
;
859 if (ctx
->ExecuteFlag
) {
860 (*ctx
->Exec
->ClearDepth
)( depth
);
865 static void save_ClearIndex( GLfloat c
)
867 GET_CURRENT_CONTEXT(ctx
);
869 FLUSH_VB(ctx
, "dlist");
870 n
= alloc_instruction( ctx
, OPCODE_CLEAR_INDEX
, 1 );
874 if (ctx
->ExecuteFlag
) {
875 (*ctx
->Exec
->ClearIndex
)( c
);
880 static void save_ClearStencil( GLint s
)
882 GET_CURRENT_CONTEXT(ctx
);
884 FLUSH_VB(ctx
, "dlist");
885 n
= alloc_instruction( ctx
, OPCODE_CLEAR_STENCIL
, 1 );
889 if (ctx
->ExecuteFlag
) {
890 (*ctx
->Exec
->ClearStencil
)( s
);
895 static void save_ClipPlane( GLenum plane
, const GLdouble
*equ
)
897 GET_CURRENT_CONTEXT(ctx
);
899 FLUSH_VB(ctx
, "dlist");
900 n
= alloc_instruction( ctx
, OPCODE_CLIP_PLANE
, 5 );
908 if (ctx
->ExecuteFlag
) {
909 (*ctx
->Exec
->ClipPlane
)( plane
, equ
);
915 static void save_ColorMask( GLboolean red
, GLboolean green
,
916 GLboolean blue
, GLboolean alpha
)
918 GET_CURRENT_CONTEXT(ctx
);
920 FLUSH_VB(ctx
, "dlist");
921 n
= alloc_instruction( ctx
, OPCODE_COLOR_MASK
, 4 );
928 if (ctx
->ExecuteFlag
) {
929 (*ctx
->Exec
->ColorMask
)( red
, green
, blue
, alpha
);
934 static void save_ColorMaterial( GLenum face
, GLenum mode
)
936 GET_CURRENT_CONTEXT(ctx
);
938 FLUSH_VB(ctx
, "dlist");
939 n
= alloc_instruction( ctx
, OPCODE_COLOR_MATERIAL
, 2 );
944 if (ctx
->ExecuteFlag
) {
945 (*ctx
->Exec
->ColorMaterial
)( face
, mode
);
950 static void save_ColorTable( GLenum target
, GLenum internalFormat
,
951 GLsizei width
, GLenum format
, GLenum type
,
952 const GLvoid
*table
)
954 GET_CURRENT_CONTEXT(ctx
);
955 if (target
== GL_PROXY_TEXTURE_1D
||
956 target
== GL_PROXY_TEXTURE_2D
||
957 target
== GL_PROXY_TEXTURE_3D
) {
958 /* execute immediately */
959 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
960 format
, type
, table
);
963 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, table
,
966 FLUSH_VB(ctx
, "dlist");
967 n
= alloc_instruction( ctx
, OPCODE_COLOR_TABLE
, 6 );
970 n
[2].e
= internalFormat
;
979 if (ctx
->ExecuteFlag
) {
980 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
981 format
, type
, table
);
987 static void save_ColorSubTable( GLenum target
, GLsizei start
, GLsizei count
,
988 GLenum format
, GLenum type
,
991 GET_CURRENT_CONTEXT(ctx
);
992 GLvoid
*image
= _mesa_unpack_image(count
, 1, 1, format
, type
, table
,
995 FLUSH_VB(ctx
, "dlist");
996 n
= alloc_instruction( ctx
, OPCODE_COLOR_SUB_TABLE
, 6 );
1008 if (ctx
->ExecuteFlag
) {
1009 (*ctx
->Exec
->ColorSubTable
)(target
, start
, count
, format
, type
, table
);
1015 static void save_CopyPixels( GLint x
, GLint y
,
1016 GLsizei width
, GLsizei height
, GLenum type
)
1018 GET_CURRENT_CONTEXT(ctx
);
1020 FLUSH_VB(ctx
, "dlist");
1021 n
= alloc_instruction( ctx
, OPCODE_COPY_PIXELS
, 5 );
1025 n
[3].i
= (GLint
) width
;
1026 n
[4].i
= (GLint
) height
;
1029 if (ctx
->ExecuteFlag
) {
1030 (*ctx
->Exec
->CopyPixels
)( x
, y
, width
, height
, type
);
1037 save_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
1038 GLint x
, GLint y
, GLsizei width
, GLint border
)
1040 GET_CURRENT_CONTEXT(ctx
);
1042 FLUSH_VB(ctx
, "dlist");
1043 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7 );
1047 n
[3].e
= internalformat
;
1053 if (ctx
->ExecuteFlag
) {
1054 (*ctx
->Exec
->CopyTexImage1D
)( target
, level
, internalformat
,
1055 x
, y
, width
, border
);
1061 save_CopyTexImage2D( GLenum target
, GLint level
,
1062 GLenum internalformat
,
1063 GLint x
, GLint y
, GLsizei width
,
1064 GLsizei height
, GLint border
)
1066 GET_CURRENT_CONTEXT(ctx
);
1068 FLUSH_VB(ctx
, "dlist");
1069 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8 );
1073 n
[3].e
= internalformat
;
1080 if (ctx
->ExecuteFlag
) {
1081 (*ctx
->Exec
->CopyTexImage2D
)( target
, level
, internalformat
,
1082 x
, y
, width
, height
, border
);
1089 save_CopyTexSubImage1D( GLenum target
, GLint level
,
1090 GLint xoffset
, GLint x
, GLint y
,
1093 GET_CURRENT_CONTEXT(ctx
);
1095 FLUSH_VB(ctx
, "dlist");
1096 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6 );
1105 if (ctx
->ExecuteFlag
) {
1106 (*ctx
->Exec
->CopyTexSubImage1D
)( target
, level
, xoffset
, x
, y
, width
);
1112 save_CopyTexSubImage2D( GLenum target
, GLint level
,
1113 GLint xoffset
, GLint yoffset
,
1115 GLsizei width
, GLint height
)
1117 GET_CURRENT_CONTEXT(ctx
);
1119 FLUSH_VB(ctx
, "dlist");
1120 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8 );
1131 if (ctx
->ExecuteFlag
) {
1132 (*ctx
->Exec
->CopyTexSubImage2D
)( target
, level
, xoffset
, yoffset
,
1133 x
, y
, width
, height
);
1139 save_CopyTexSubImage3D( GLenum target
, GLint level
,
1140 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1142 GLsizei width
, GLint height
)
1144 GET_CURRENT_CONTEXT(ctx
);
1146 FLUSH_VB(ctx
, "dlist");
1147 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9 );
1159 if (ctx
->ExecuteFlag
) {
1160 (*ctx
->Exec
->CopyTexSubImage3D
)( target
, level
,
1161 xoffset
, yoffset
, zoffset
,
1162 x
, y
, width
, height
);
1167 static void save_CullFace( GLenum mode
)
1169 GET_CURRENT_CONTEXT(ctx
);
1171 FLUSH_VB(ctx
, "dlist");
1172 n
= alloc_instruction( ctx
, OPCODE_CULL_FACE
, 1 );
1176 if (ctx
->ExecuteFlag
) {
1177 (*ctx
->Exec
->CullFace
)( mode
);
1182 static void save_DepthFunc( GLenum func
)
1184 GET_CURRENT_CONTEXT(ctx
);
1186 FLUSH_VB(ctx
, "dlist");
1187 n
= alloc_instruction( ctx
, OPCODE_DEPTH_FUNC
, 1 );
1191 if (ctx
->ExecuteFlag
) {
1192 (*ctx
->Exec
->DepthFunc
)( func
);
1197 static void save_DepthMask( GLboolean mask
)
1199 GET_CURRENT_CONTEXT(ctx
);
1201 FLUSH_VB(ctx
, "dlist");
1202 n
= alloc_instruction( ctx
, OPCODE_DEPTH_MASK
, 1 );
1206 if (ctx
->ExecuteFlag
) {
1207 (*ctx
->Exec
->DepthMask
)( mask
);
1212 static void save_DepthRange( GLclampd nearval
, GLclampd farval
)
1214 GET_CURRENT_CONTEXT(ctx
);
1216 FLUSH_VB(ctx
, "dlist");
1217 n
= alloc_instruction( ctx
, OPCODE_DEPTH_RANGE
, 2 );
1219 n
[1].f
= (GLfloat
) nearval
;
1220 n
[2].f
= (GLfloat
) farval
;
1222 if (ctx
->ExecuteFlag
) {
1223 (*ctx
->Exec
->DepthRange
)( nearval
, farval
);
1228 static void save_Disable( GLenum cap
)
1230 GET_CURRENT_CONTEXT(ctx
);
1232 FLUSH_VB(ctx
, "dlist");
1233 n
= alloc_instruction( ctx
, OPCODE_DISABLE
, 1 );
1237 if (ctx
->ExecuteFlag
) {
1238 (*ctx
->Exec
->Disable
)( cap
);
1243 static void save_DrawBuffer( GLenum mode
)
1245 GET_CURRENT_CONTEXT(ctx
);
1247 FLUSH_VB(ctx
, "dlist");
1248 n
= alloc_instruction( ctx
, OPCODE_DRAW_BUFFER
, 1 );
1252 if (ctx
->ExecuteFlag
) {
1253 (*ctx
->Exec
->DrawBuffer
)( mode
);
1258 static void save_DrawPixels( GLsizei width
, GLsizei height
,
1259 GLenum format
, GLenum type
,
1260 const GLvoid
*pixels
)
1262 GET_CURRENT_CONTEXT(ctx
);
1263 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
1264 pixels
, &ctx
->Unpack
);
1266 FLUSH_VB(ctx
, "dlist");
1267 n
= alloc_instruction( ctx
, OPCODE_DRAW_PIXELS
, 5 );
1278 if (ctx
->ExecuteFlag
) {
1279 (*ctx
->Exec
->DrawPixels
)( width
, height
, format
, type
, pixels
);
1285 static void save_Enable( GLenum cap
)
1287 GET_CURRENT_CONTEXT(ctx
);
1289 FLUSH_VB(ctx
, "dlist");
1290 n
= alloc_instruction( ctx
, OPCODE_ENABLE
, 1 );
1294 if (ctx
->ExecuteFlag
) {
1295 (*ctx
->Exec
->Enable
)( cap
);
1301 static void save_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
1303 GET_CURRENT_CONTEXT(ctx
);
1305 FLUSH_VB(ctx
, "dlist");
1306 n
= alloc_instruction( ctx
, OPCODE_EVALMESH1
, 3 );
1312 if (ctx
->ExecuteFlag
) {
1313 (*ctx
->Exec
->EvalMesh1
)( mode
, i1
, i2
);
1318 static void save_EvalMesh2(
1319 GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1321 GET_CURRENT_CONTEXT(ctx
);
1323 FLUSH_VB(ctx
, "dlist");
1324 n
= alloc_instruction( ctx
, OPCODE_EVALMESH2
, 5 );
1332 if (ctx
->ExecuteFlag
) {
1333 (*ctx
->Exec
->EvalMesh2
)( mode
, i1
, i2
, j1
, j2
);
1340 static void save_Fogfv( GLenum pname
, const GLfloat
*params
)
1342 GET_CURRENT_CONTEXT(ctx
);
1344 FLUSH_VB(ctx
, "dlist");
1345 n
= alloc_instruction( ctx
, OPCODE_FOG
, 5 );
1353 if (ctx
->ExecuteFlag
) {
1354 (*ctx
->Exec
->Fogfv
)( pname
, params
);
1359 static void save_Fogf( GLenum pname
, GLfloat param
)
1361 save_Fogfv(pname
, ¶m
);
1365 static void save_Fogiv(GLenum pname
, const GLint
*params
)
1370 case GL_FOG_DENSITY
:
1374 p
[0] = (GLfloat
) *params
;
1377 p
[0] = INT_TO_FLOAT( params
[0] );
1378 p
[1] = INT_TO_FLOAT( params
[1] );
1379 p
[2] = INT_TO_FLOAT( params
[2] );
1380 p
[3] = INT_TO_FLOAT( params
[3] );
1383 /* Error will be caught later in gl_Fogfv */
1386 save_Fogfv(pname
, p
);
1390 static void save_Fogi(GLenum pname
, GLint param
)
1392 save_Fogiv(pname
, ¶m
);
1396 static void save_FrontFace( GLenum mode
)
1398 GET_CURRENT_CONTEXT(ctx
);
1400 FLUSH_VB(ctx
, "dlist");
1401 n
= alloc_instruction( ctx
, OPCODE_FRONT_FACE
, 1 );
1405 if (ctx
->ExecuteFlag
) {
1406 (*ctx
->Exec
->FrontFace
)( mode
);
1411 static void save_Frustum( GLdouble left
, GLdouble right
,
1412 GLdouble bottom
, GLdouble top
,
1413 GLdouble nearval
, GLdouble farval
)
1415 GET_CURRENT_CONTEXT(ctx
);
1417 FLUSH_VB(ctx
, "dlist");
1418 n
= alloc_instruction( ctx
, OPCODE_FRUSTUM
, 6 );
1427 if (ctx
->ExecuteFlag
) {
1428 (*ctx
->Exec
->Frustum
)( left
, right
, bottom
, top
, nearval
, farval
);
1433 static void save_Hint( GLenum target
, GLenum mode
)
1435 GET_CURRENT_CONTEXT(ctx
);
1437 FLUSH_VB(ctx
, "dlist");
1438 n
= alloc_instruction( ctx
, OPCODE_HINT
, 2 );
1443 if (ctx
->ExecuteFlag
) {
1444 (*ctx
->Exec
->Hint
)( target
, mode
);
1449 /* GL_PGI_misc_hints*/
1450 static void save_HintPGI( GLenum target
, GLint mode
)
1452 GET_CURRENT_CONTEXT(ctx
);
1454 FLUSH_VB(ctx
, "dlist");
1455 n
= alloc_instruction( ctx
, OPCODE_HINT_PGI
, 2 );
1460 if (ctx
->ExecuteFlag
) {
1461 (*ctx
->Exec
->HintPGI
)( target
, mode
);
1466 static void save_IndexMask( GLuint mask
)
1468 GET_CURRENT_CONTEXT(ctx
);
1470 FLUSH_VB(ctx
, "dlist");
1471 n
= alloc_instruction( ctx
, OPCODE_INDEX_MASK
, 1 );
1475 if (ctx
->ExecuteFlag
) {
1476 (*ctx
->Exec
->IndexMask
)( mask
);
1481 static void save_InitNames( void )
1483 GET_CURRENT_CONTEXT(ctx
);
1484 FLUSH_VB(ctx
, "dlist");
1485 (void) alloc_instruction( ctx
, OPCODE_INIT_NAMES
, 0 );
1486 if (ctx
->ExecuteFlag
) {
1487 (*ctx
->Exec
->InitNames
)();
1492 static void save_Lightfv( GLenum light
, GLenum pname
, const GLfloat
*params
)
1494 GET_CURRENT_CONTEXT(ctx
);
1496 FLUSH_VB(ctx
, "dlist");
1497 n
= alloc_instruction( ctx
, OPCODE_LIGHT
, 6 );
1515 case GL_SPOT_DIRECTION
:
1518 case GL_SPOT_EXPONENT
:
1521 case GL_SPOT_CUTOFF
:
1524 case GL_CONSTANT_ATTENUATION
:
1527 case GL_LINEAR_ATTENUATION
:
1530 case GL_QUADRATIC_ATTENUATION
:
1536 for (i
= 0; i
< nParams
; i
++) {
1537 n
[3+i
].f
= params
[i
];
1540 if (ctx
->ExecuteFlag
) {
1541 (*ctx
->Exec
->Lightfv
)( light
, pname
, params
);
1546 static void save_Lightf( GLenum light
, GLenum pname
, GLfloat params
)
1548 save_Lightfv(light
, pname
, ¶ms
);
1552 static void save_Lightiv( GLenum light
, GLenum pname
, const GLint
*params
)
1559 fparam
[0] = INT_TO_FLOAT( params
[0] );
1560 fparam
[1] = INT_TO_FLOAT( params
[1] );
1561 fparam
[2] = INT_TO_FLOAT( params
[2] );
1562 fparam
[3] = INT_TO_FLOAT( params
[3] );
1565 fparam
[0] = (GLfloat
) params
[0];
1566 fparam
[1] = (GLfloat
) params
[1];
1567 fparam
[2] = (GLfloat
) params
[2];
1568 fparam
[3] = (GLfloat
) params
[3];
1570 case GL_SPOT_DIRECTION
:
1571 fparam
[0] = (GLfloat
) params
[0];
1572 fparam
[1] = (GLfloat
) params
[1];
1573 fparam
[2] = (GLfloat
) params
[2];
1575 case GL_SPOT_EXPONENT
:
1576 case GL_SPOT_CUTOFF
:
1577 case GL_CONSTANT_ATTENUATION
:
1578 case GL_LINEAR_ATTENUATION
:
1579 case GL_QUADRATIC_ATTENUATION
:
1580 fparam
[0] = (GLfloat
) params
[0];
1583 /* error will be caught later in gl_Lightfv */
1586 save_Lightfv( light
, pname
, fparam
);
1590 static void save_Lighti( GLenum light
, GLenum pname
, GLint param
)
1592 save_Lightiv( light
, pname
, ¶m
);
1596 static void save_LightModelfv( GLenum pname
, const GLfloat
*params
)
1598 GET_CURRENT_CONTEXT(ctx
);
1600 FLUSH_VB(ctx
, "dlist");
1601 n
= alloc_instruction( ctx
, OPCODE_LIGHT_MODEL
, 5 );
1609 if (ctx
->ExecuteFlag
) {
1610 (*ctx
->Exec
->LightModelfv
)( pname
, params
);
1615 static void save_LightModelf( GLenum pname
, GLfloat param
)
1617 save_LightModelfv(pname
, ¶m
);
1621 static void save_LightModeliv( GLenum pname
, const GLint
*params
)
1625 case GL_LIGHT_MODEL_AMBIENT
:
1626 fparam
[0] = INT_TO_FLOAT( params
[0] );
1627 fparam
[1] = INT_TO_FLOAT( params
[1] );
1628 fparam
[2] = INT_TO_FLOAT( params
[2] );
1629 fparam
[3] = INT_TO_FLOAT( params
[3] );
1631 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
1632 case GL_LIGHT_MODEL_TWO_SIDE
:
1633 case GL_LIGHT_MODEL_COLOR_CONTROL
:
1634 fparam
[0] = (GLfloat
) params
[0];
1637 /* Error will be caught later in gl_LightModelfv */
1640 save_LightModelfv(pname
, fparam
);
1644 static void save_LightModeli( GLenum pname
, GLint param
)
1646 save_LightModeliv(pname
, ¶m
);
1650 static void save_LineStipple( GLint factor
, GLushort pattern
)
1652 GET_CURRENT_CONTEXT(ctx
);
1654 FLUSH_VB(ctx
, "dlist");
1655 n
= alloc_instruction( ctx
, OPCODE_LINE_STIPPLE
, 2 );
1660 if (ctx
->ExecuteFlag
) {
1661 (*ctx
->Exec
->LineStipple
)( factor
, pattern
);
1666 static void save_LineWidth( GLfloat width
)
1668 GET_CURRENT_CONTEXT(ctx
);
1670 FLUSH_VB(ctx
, "dlist");
1671 n
= alloc_instruction( ctx
, OPCODE_LINE_WIDTH
, 1 );
1675 if (ctx
->ExecuteFlag
) {
1676 (*ctx
->Exec
->LineWidth
)( width
);
1681 static void save_ListBase( GLuint base
)
1683 GET_CURRENT_CONTEXT(ctx
);
1685 FLUSH_VB(ctx
, "dlist");
1686 n
= alloc_instruction( ctx
, OPCODE_LIST_BASE
, 1 );
1690 if (ctx
->ExecuteFlag
) {
1691 (*ctx
->Exec
->ListBase
)( base
);
1696 static void save_LoadIdentity( void )
1698 GET_CURRENT_CONTEXT(ctx
);
1699 FLUSH_VB(ctx
, "dlist");
1700 (void) alloc_instruction( ctx
, OPCODE_LOAD_IDENTITY
, 0 );
1701 if (ctx
->ExecuteFlag
) {
1702 (*ctx
->Exec
->LoadIdentity
)();
1707 static void save_LoadMatrixf( const GLfloat
*m
)
1709 GET_CURRENT_CONTEXT(ctx
);
1711 FLUSH_VB(ctx
, "dlist");
1712 n
= alloc_instruction( ctx
, OPCODE_LOAD_MATRIX
, 16 );
1715 for (i
=0;i
<16;i
++) {
1719 if (ctx
->ExecuteFlag
) {
1720 (*ctx
->Exec
->LoadMatrixf
)( m
);
1725 static void save_LoadMatrixd( const GLdouble
*m
)
1729 for (i
= 0; i
< 16; i
++) {
1732 save_LoadMatrixf(f
);
1736 static void save_LoadName( GLuint name
)
1738 GET_CURRENT_CONTEXT(ctx
);
1740 FLUSH_VB(ctx
, "dlist");
1741 n
= alloc_instruction( ctx
, OPCODE_LOAD_NAME
, 1 );
1745 if (ctx
->ExecuteFlag
) {
1746 (*ctx
->Exec
->LoadName
)( name
);
1751 static void save_LogicOp( GLenum opcode
)
1753 GET_CURRENT_CONTEXT(ctx
);
1755 FLUSH_VB(ctx
, "dlist");
1756 n
= alloc_instruction( ctx
, OPCODE_LOGIC_OP
, 1 );
1760 if (ctx
->ExecuteFlag
) {
1761 (*ctx
->Exec
->LogicOp
)( opcode
);
1766 static void save_Map1d( GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
1767 GLint order
, const GLdouble
*points
)
1769 GET_CURRENT_CONTEXT(ctx
);
1771 FLUSH_VB(ctx
, "dlist");
1772 n
= alloc_instruction( ctx
, OPCODE_MAP1
, 6 );
1774 GLfloat
*pnts
= gl_copy_map_points1d( target
, stride
, order
, points
);
1778 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
1780 n
[6].data
= (void *) pnts
;
1782 if (ctx
->ExecuteFlag
) {
1783 (*ctx
->Exec
->Map1d
)( target
, u1
, u2
, stride
, order
, points
);
1787 static void save_Map1f( GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
1788 GLint order
, const GLfloat
*points
)
1790 GET_CURRENT_CONTEXT(ctx
);
1792 FLUSH_VB(ctx
, "dlist");
1793 n
= alloc_instruction( ctx
, OPCODE_MAP1
, 6 );
1795 GLfloat
*pnts
= gl_copy_map_points1f( target
, stride
, order
, points
);
1799 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
1801 n
[6].data
= (void *) pnts
;
1803 if (ctx
->ExecuteFlag
) {
1804 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, stride
, order
, points
);
1809 static void save_Map2d( GLenum target
,
1810 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
1811 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
1812 const GLdouble
*points
)
1814 GET_CURRENT_CONTEXT(ctx
);
1816 FLUSH_VB(ctx
, "dlist");
1817 n
= alloc_instruction( ctx
, OPCODE_MAP2
, 10 );
1819 GLfloat
*pnts
= gl_copy_map_points2d( target
, ustride
, uorder
,
1820 vstride
, vorder
, points
);
1826 /* XXX verify these strides are correct */
1827 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
1828 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
1831 n
[10].data
= (void *) pnts
;
1833 if (ctx
->ExecuteFlag
) {
1834 (*ctx
->Exec
->Map2d
)( target
,
1835 u1
, u2
, ustride
, uorder
,
1836 v1
, v2
, vstride
, vorder
, points
);
1841 static void save_Map2f( GLenum target
,
1842 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
1843 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
1844 const GLfloat
*points
)
1846 GET_CURRENT_CONTEXT(ctx
);
1848 FLUSH_VB(ctx
, "dlist");
1849 n
= alloc_instruction( ctx
, OPCODE_MAP2
, 10 );
1851 GLfloat
*pnts
= gl_copy_map_points2f( target
, ustride
, uorder
,
1852 vstride
, vorder
, points
);
1858 /* XXX verify these strides are correct */
1859 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
1860 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
1863 n
[10].data
= (void *) pnts
;
1865 if (ctx
->ExecuteFlag
) {
1866 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
1867 v1
, v2
, vstride
, vorder
, points
);
1872 static void save_MapGrid1f( GLint un
, GLfloat u1
, GLfloat u2
)
1874 GET_CURRENT_CONTEXT(ctx
);
1876 FLUSH_VB(ctx
, "dlist");
1877 n
= alloc_instruction( ctx
, OPCODE_MAPGRID1
, 3 );
1883 if (ctx
->ExecuteFlag
) {
1884 (*ctx
->Exec
->MapGrid1f
)( un
, u1
, u2
);
1889 static void save_MapGrid1d( GLint un
, GLdouble u1
, GLdouble u2
)
1891 save_MapGrid1f(un
, u1
, u2
);
1895 static void save_MapGrid2f( GLint un
, GLfloat u1
, GLfloat u2
,
1896 GLint vn
, GLfloat v1
, GLfloat v2
)
1898 GET_CURRENT_CONTEXT(ctx
);
1900 FLUSH_VB(ctx
, "dlist");
1901 n
= alloc_instruction( ctx
, OPCODE_MAPGRID2
, 6 );
1910 if (ctx
->ExecuteFlag
) {
1911 (*ctx
->Exec
->MapGrid2f
)( un
, u1
, u2
, vn
, v1
, v2
);
1917 static void save_MapGrid2d( GLint un
, GLdouble u1
, GLdouble u2
,
1918 GLint vn
, GLdouble v1
, GLdouble v2
)
1920 save_MapGrid2f(un
, u1
, u2
, vn
, v1
, v2
);
1924 static void save_MatrixMode( GLenum mode
)
1926 GET_CURRENT_CONTEXT(ctx
);
1928 FLUSH_VB(ctx
, "dlist");
1929 n
= alloc_instruction( ctx
, OPCODE_MATRIX_MODE
, 1 );
1933 if (ctx
->ExecuteFlag
) {
1934 (*ctx
->Exec
->MatrixMode
)( mode
);
1939 static void save_MultMatrixf( const GLfloat
*m
)
1941 GET_CURRENT_CONTEXT(ctx
);
1943 FLUSH_VB(ctx
, "dlist");
1944 n
= alloc_instruction( ctx
, OPCODE_MULT_MATRIX
, 16 );
1947 for (i
=0;i
<16;i
++) {
1951 if (ctx
->ExecuteFlag
) {
1952 (*ctx
->Exec
->MultMatrixf
)( m
);
1957 static void save_MultMatrixd( const GLdouble
*m
)
1961 for (i
= 0; i
< 16; i
++) {
1964 save_MultMatrixf(f
);
1968 static void save_NewList( GLuint list
, GLenum mode
)
1970 GET_CURRENT_CONTEXT(ctx
);
1971 /* It's an error to call this function while building a display list */
1972 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
1979 static void save_Ortho( GLdouble left
, GLdouble right
,
1980 GLdouble bottom
, GLdouble top
,
1981 GLdouble nearval
, GLdouble farval
)
1983 GET_CURRENT_CONTEXT(ctx
);
1985 FLUSH_VB(ctx
, "dlist");
1986 n
= alloc_instruction( ctx
, OPCODE_ORTHO
, 6 );
1995 if (ctx
->ExecuteFlag
) {
1996 (*ctx
->Exec
->Ortho
)( left
, right
, bottom
, top
, nearval
, farval
);
2001 static void save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
2003 GET_CURRENT_CONTEXT(ctx
);
2005 FLUSH_VB(ctx
, "dlist");
2006 n
= alloc_instruction( ctx
, OPCODE_PIXEL_MAP
, 3 );
2010 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
2011 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
2013 if (ctx
->ExecuteFlag
) {
2014 (*ctx
->Exec
->PixelMapfv
)( map
, mapsize
, values
);
2019 static void save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*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
] = UINT_TO_FLOAT( values
[i
] );
2033 save_PixelMapfv(map
, mapsize
, fvalues
);
2037 static void save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2039 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2041 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2042 for (i
=0;i
<mapsize
;i
++) {
2043 fvalues
[i
] = (GLfloat
) values
[i
];
2047 for (i
=0;i
<mapsize
;i
++) {
2048 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2051 save_PixelMapfv(map
, mapsize
, fvalues
);
2055 static void save_PixelTransferf( GLenum pname
, GLfloat param
)
2057 GET_CURRENT_CONTEXT(ctx
);
2059 FLUSH_VB(ctx
, "dlist");
2060 n
= alloc_instruction( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2065 if (ctx
->ExecuteFlag
) {
2066 (*ctx
->Exec
->PixelTransferf
)( pname
, param
);
2071 static void save_PixelTransferi( GLenum pname
, GLint param
)
2073 save_PixelTransferf( pname
, (GLfloat
) param
);
2077 static void save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2079 GET_CURRENT_CONTEXT(ctx
);
2081 FLUSH_VB(ctx
, "dlist");
2082 n
= alloc_instruction( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2087 if (ctx
->ExecuteFlag
) {
2088 (*ctx
->Exec
->PixelZoom
)( xfactor
, yfactor
);
2093 static void save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2095 GET_CURRENT_CONTEXT(ctx
);
2097 FLUSH_VB(ctx
, "dlist");
2098 n
= alloc_instruction( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2105 if (ctx
->ExecuteFlag
) {
2106 (*ctx
->Exec
->PointParameterfvEXT
)( pname
, params
);
2111 static void save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2113 save_PointParameterfvEXT(pname
, ¶m
);
2117 static void save_PointSize( GLfloat size
)
2119 GET_CURRENT_CONTEXT(ctx
);
2121 FLUSH_VB(ctx
, "dlist");
2122 n
= alloc_instruction( ctx
, OPCODE_POINT_SIZE
, 1 );
2126 if (ctx
->ExecuteFlag
) {
2127 (*ctx
->Exec
->PointSize
)( size
);
2132 static void save_PolygonMode( GLenum face
, GLenum mode
)
2134 GET_CURRENT_CONTEXT(ctx
);
2136 FLUSH_VB(ctx
, "dlist");
2137 n
= alloc_instruction( ctx
, OPCODE_POLYGON_MODE
, 2 );
2142 if (ctx
->ExecuteFlag
) {
2143 (*ctx
->Exec
->PolygonMode
)( face
, mode
);
2149 * Polygon stipple must have been upacked already!
2151 static void save_PolygonStipple( const GLubyte
*pattern
)
2153 GET_CURRENT_CONTEXT(ctx
);
2155 FLUSH_VB(ctx
, "dlist");
2156 n
= alloc_instruction( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2159 n
[1].data
= MALLOC( 32 * 4 );
2160 data
= n
[1].data
; /* This needed for Acorn compiler */
2161 MEMCPY( data
, pattern
, 32 * 4 );
2163 if (ctx
->ExecuteFlag
) {
2164 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) pattern
);
2169 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2171 GET_CURRENT_CONTEXT(ctx
);
2173 FLUSH_VB(ctx
, "dlist");
2174 n
= alloc_instruction( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2179 if (ctx
->ExecuteFlag
) {
2180 (*ctx
->Exec
->PolygonOffset
)( factor
, units
);
2185 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2187 GET_CURRENT_CONTEXT(ctx
);
2188 save_PolygonOffset(factor
, ctx
->Visual
->DepthMaxF
* bias
);
2192 static void save_PopAttrib( void )
2194 GET_CURRENT_CONTEXT(ctx
);
2195 FLUSH_VB(ctx
, "dlist");
2196 (void) alloc_instruction( ctx
, OPCODE_POP_ATTRIB
, 0 );
2197 if (ctx
->ExecuteFlag
) {
2198 (*ctx
->Exec
->PopAttrib
)();
2203 static void save_PopMatrix( void )
2205 GET_CURRENT_CONTEXT(ctx
);
2206 FLUSH_VB(ctx
, "dlist");
2207 (void) alloc_instruction( ctx
, OPCODE_POP_MATRIX
, 0 );
2208 if (ctx
->ExecuteFlag
) {
2209 (*ctx
->Exec
->PopMatrix
)();
2214 static void save_PopName( void )
2216 GET_CURRENT_CONTEXT(ctx
);
2217 FLUSH_VB(ctx
, "dlist");
2218 (void) alloc_instruction( ctx
, OPCODE_POP_NAME
, 0 );
2219 if (ctx
->ExecuteFlag
) {
2220 (*ctx
->Exec
->PopName
)();
2225 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2226 const GLclampf
*priorities
)
2228 GET_CURRENT_CONTEXT(ctx
);
2230 FLUSH_VB(ctx
, "dlist");
2232 for (i
=0;i
<num
;i
++) {
2234 n
= alloc_instruction( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2236 n
[1].ui
= textures
[i
];
2237 n
[2].f
= priorities
[i
];
2240 if (ctx
->ExecuteFlag
) {
2241 (*ctx
->Exec
->PrioritizeTextures
)( num
, textures
, priorities
);
2246 static void save_PushAttrib( GLbitfield mask
)
2248 GET_CURRENT_CONTEXT(ctx
);
2250 FLUSH_VB(ctx
, "dlist");
2251 n
= alloc_instruction( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2255 if (ctx
->ExecuteFlag
) {
2256 (*ctx
->Exec
->PushAttrib
)( mask
);
2261 static void save_PushMatrix( void )
2263 GET_CURRENT_CONTEXT(ctx
);
2264 FLUSH_VB(ctx
, "dlist");
2265 (void) alloc_instruction( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2266 if (ctx
->ExecuteFlag
) {
2267 (*ctx
->Exec
->PushMatrix
)();
2272 static void save_PushName( GLuint name
)
2274 GET_CURRENT_CONTEXT(ctx
);
2276 FLUSH_VB(ctx
, "dlist");
2277 n
= alloc_instruction( ctx
, OPCODE_PUSH_NAME
, 1 );
2281 if (ctx
->ExecuteFlag
) {
2282 (*ctx
->Exec
->PushName
)( name
);
2287 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2289 GET_CURRENT_CONTEXT(ctx
);
2291 FLUSH_VB(ctx
, "dlist");
2292 n
= alloc_instruction( ctx
, OPCODE_RASTER_POS
, 4 );
2299 if (ctx
->ExecuteFlag
) {
2300 (*ctx
->Exec
->RasterPos4f
)( x
, y
, z
, w
);
2304 static void save_RasterPos2d(GLdouble x
, GLdouble y
)
2306 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2309 static void save_RasterPos2f(GLfloat x
, GLfloat y
)
2311 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2314 static void save_RasterPos2i(GLint x
, GLint y
)
2316 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2319 static void save_RasterPos2s(GLshort x
, GLshort y
)
2321 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2324 static void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2326 save_RasterPos4f(x
, y
, z
, 1.0F
);
2329 static void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2331 save_RasterPos4f(x
, y
, z
, 1.0F
);
2334 static void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2336 save_RasterPos4f(x
, y
, z
, 1.0F
);
2339 static void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2341 save_RasterPos4f(x
, y
, z
, 1.0F
);
2344 static void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2346 save_RasterPos4f(x
, y
, z
, w
);
2349 static void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2351 save_RasterPos4f(x
, y
, z
, w
);
2354 static void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2356 save_RasterPos4f(x
, y
, z
, w
);
2359 static void save_RasterPos2dv(const GLdouble
*v
)
2361 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2364 static void save_RasterPos2fv(const GLfloat
*v
)
2366 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2369 static void save_RasterPos2iv(const GLint
*v
)
2371 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2374 static void save_RasterPos2sv(const GLshort
*v
)
2376 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2379 static void save_RasterPos3dv(const GLdouble
*v
)
2381 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2384 static void save_RasterPos3fv(const GLfloat
*v
)
2386 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2389 static void save_RasterPos3iv(const GLint
*v
)
2391 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2394 static void save_RasterPos3sv(const GLshort
*v
)
2396 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2399 static void save_RasterPos4dv(const GLdouble
*v
)
2401 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2404 static void save_RasterPos4fv(const GLfloat
*v
)
2406 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2409 static void save_RasterPos4iv(const GLint
*v
)
2411 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2414 static void save_RasterPos4sv(const GLshort
*v
)
2416 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2420 static void save_PassThrough( GLfloat token
)
2422 GET_CURRENT_CONTEXT(ctx
);
2424 FLUSH_VB(ctx
, "dlist");
2425 n
= alloc_instruction( ctx
, OPCODE_PASSTHROUGH
, 1 );
2429 if (ctx
->ExecuteFlag
) {
2430 (*ctx
->Exec
->PassThrough
)( token
);
2435 static void save_ReadBuffer( GLenum mode
)
2437 GET_CURRENT_CONTEXT(ctx
);
2439 FLUSH_VB(ctx
, "dlist");
2440 n
= alloc_instruction( ctx
, OPCODE_READ_BUFFER
, 1 );
2444 if (ctx
->ExecuteFlag
) {
2445 (*ctx
->Exec
->ReadBuffer
)( mode
);
2450 static void save_Rectf( GLfloat x1
, GLfloat y1
, GLfloat x2
, GLfloat y2
)
2452 GET_CURRENT_CONTEXT(ctx
);
2454 FLUSH_VB(ctx
, "dlist");
2455 n
= alloc_instruction( ctx
, OPCODE_RECTF
, 4 );
2462 if (ctx
->ExecuteFlag
) {
2463 (*ctx
->Exec
->Rectf
)( x1
, y1
, x2
, y2
);
2467 static void save_Rectd(GLdouble x1
, GLdouble y1
, GLdouble x2
, GLdouble y2
)
2469 save_Rectf(x1
, y1
, x2
, y2
);
2472 static void save_Rectdv(const GLdouble
*v1
, const GLdouble
*v2
)
2474 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2477 static void save_Rectfv( const GLfloat
*v1
, const GLfloat
*v2
)
2479 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2482 static void save_Recti(GLint x1
, GLint y1
, GLint x2
, GLint y2
)
2484 save_Rectf(x1
, y1
, x2
, y2
);
2487 static void save_Rectiv(const GLint
*v1
, const GLint
*v2
)
2489 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2492 static void save_Rects(GLshort x1
, GLshort y1
, GLshort x2
, GLshort y2
)
2494 save_Rectf(x1
, y1
, x2
, y2
);
2497 static void save_Rectsv(const GLshort
*v1
, const GLshort
*v2
)
2499 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2503 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2506 gl_rotation_matrix( angle
, x
, y
, z
, m
);
2507 save_MultMatrixf( m
); /* save and maybe execute */
2511 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2513 save_Rotatef(angle
, x
, y
, z
);
2517 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2519 GET_CURRENT_CONTEXT(ctx
);
2521 FLUSH_VB(ctx
, "dlist");
2522 n
= alloc_instruction( ctx
, OPCODE_SCALE
, 3 );
2528 if (ctx
->ExecuteFlag
) {
2529 (*ctx
->Exec
->Scalef
)( x
, y
, z
);
2534 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
2536 save_Scalef(x
, y
, z
);
2540 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
2542 GET_CURRENT_CONTEXT(ctx
);
2544 FLUSH_VB(ctx
, "dlist");
2545 n
= alloc_instruction( ctx
, OPCODE_SCISSOR
, 4 );
2552 if (ctx
->ExecuteFlag
) {
2553 (*ctx
->Exec
->Scissor
)( x
, y
, width
, height
);
2558 static void save_ShadeModel( GLenum mode
)
2560 GET_CURRENT_CONTEXT(ctx
);
2562 FLUSH_VB(ctx
, "dlist");
2563 n
= alloc_instruction( ctx
, OPCODE_SHADE_MODEL
, 1 );
2567 if (ctx
->ExecuteFlag
) {
2568 (*ctx
->Exec
->ShadeModel
)( mode
);
2573 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
2575 GET_CURRENT_CONTEXT(ctx
);
2577 FLUSH_VB(ctx
, "dlist");
2578 n
= alloc_instruction( ctx
, OPCODE_STENCIL_FUNC
, 3 );
2584 if (ctx
->ExecuteFlag
) {
2585 (*ctx
->Exec
->StencilFunc
)( func
, ref
, mask
);
2590 static void save_StencilMask( GLuint mask
)
2592 GET_CURRENT_CONTEXT(ctx
);
2594 FLUSH_VB(ctx
, "dlist");
2595 n
= alloc_instruction( ctx
, OPCODE_STENCIL_MASK
, 1 );
2599 if (ctx
->ExecuteFlag
) {
2600 (*ctx
->Exec
->StencilMask
)( mask
);
2605 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
2607 GET_CURRENT_CONTEXT(ctx
);
2609 FLUSH_VB(ctx
, "dlist");
2610 n
= alloc_instruction( ctx
, OPCODE_STENCIL_OP
, 3 );
2616 if (ctx
->ExecuteFlag
) {
2617 (*ctx
->Exec
->StencilOp
)( fail
, zfail
, zpass
);
2622 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
2624 GET_CURRENT_CONTEXT(ctx
);
2626 FLUSH_VB(ctx
, "dlist");
2627 n
= alloc_instruction( ctx
, OPCODE_TEXENV
, 6 );
2636 if (ctx
->ExecuteFlag
) {
2637 (*ctx
->Exec
->TexEnvfv
)( target
, pname
, params
);
2642 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
2644 save_TexEnvfv( target
, pname
, ¶m
);
2648 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
2651 p
[0] = (GLfloat
) param
;
2652 p
[1] = p
[2] = p
[3] = 0.0;
2653 save_TexEnvfv( target
, pname
, p
);
2657 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
2660 p
[0] = INT_TO_FLOAT( param
[0] );
2661 p
[1] = INT_TO_FLOAT( param
[1] );
2662 p
[2] = INT_TO_FLOAT( param
[2] );
2663 p
[3] = INT_TO_FLOAT( param
[3] );
2664 save_TexEnvfv( target
, pname
, p
);
2668 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
2670 GET_CURRENT_CONTEXT(ctx
);
2672 FLUSH_VB(ctx
, "dlist");
2673 n
= alloc_instruction( ctx
, OPCODE_TEXGEN
, 6 );
2682 if (ctx
->ExecuteFlag
) {
2683 (*ctx
->Exec
->TexGenfv
)( coord
, pname
, params
);
2688 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
2695 save_TexGenfv(coord
, pname
, p
);
2699 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
2701 GLfloat p
= (GLfloat
) param
;
2702 save_TexGenfv( coord
, pname
, &p
);
2706 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
2713 save_TexGenfv( coord
, pname
, p
);
2717 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
2719 save_TexGenfv(coord
, pname
, ¶m
);
2723 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
2725 save_TexGeniv( coord
, pname
, ¶m
);
2729 static void save_TexParameterfv( GLenum target
,
2730 GLenum pname
, const GLfloat
*params
)
2732 GET_CURRENT_CONTEXT(ctx
);
2734 FLUSH_VB(ctx
, "dlist");
2735 n
= alloc_instruction( ctx
, OPCODE_TEXPARAMETER
, 6 );
2744 if (ctx
->ExecuteFlag
) {
2745 (*ctx
->Exec
->TexParameterfv
)( target
, pname
, params
);
2750 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
2752 save_TexParameterfv(target
, pname
, ¶m
);
2756 static void save_TexParameteri( GLenum target
, GLenum pname
, const GLint param
)
2759 fparam
[0] = (GLfloat
) param
;
2760 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
2761 save_TexParameterfv(target
, pname
, fparam
);
2765 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
2768 fparam
[0] = (GLfloat
) params
[0];
2769 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
2770 save_TexParameterfv(target
, pname
, fparam
);
2774 static void save_TexImage1D( GLenum target
,
2775 GLint level
, GLint components
,
2776 GLsizei width
, GLint border
,
2777 GLenum format
, GLenum type
,
2778 const GLvoid
*pixels
)
2780 GET_CURRENT_CONTEXT(ctx
);
2781 if (target
== GL_PROXY_TEXTURE_1D
) {
2782 /* don't compile, execute immediately */
2783 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
2784 border
, format
, type
, pixels
);
2787 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
2788 pixels
, &ctx
->Unpack
);
2790 FLUSH_VB(ctx
, "dlist");
2791 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
2795 n
[3].i
= components
;
2796 n
[4].i
= (GLint
) width
;
2805 if (ctx
->ExecuteFlag
) {
2806 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
2807 border
, format
, type
, pixels
);
2813 static void save_TexImage2D( GLenum target
,
2814 GLint level
, GLint components
,
2815 GLsizei width
, GLsizei height
, GLint border
,
2816 GLenum format
, GLenum type
,
2817 const GLvoid
*pixels
)
2819 GET_CURRENT_CONTEXT(ctx
);
2820 if (target
== GL_PROXY_TEXTURE_2D
) {
2821 /* don't compile, execute immediately */
2822 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
2823 height
, border
, format
, type
, pixels
);
2826 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
2827 pixels
, &ctx
->Unpack
);
2829 FLUSH_VB(ctx
, "dlist");
2830 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
2834 n
[3].i
= components
;
2835 n
[4].i
= (GLint
) width
;
2836 n
[5].i
= (GLint
) height
;
2845 if (ctx
->ExecuteFlag
) {
2846 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
2847 height
, border
, format
, type
, pixels
);
2853 static void save_TexImage3D( GLenum target
,
2854 GLint level
, GLint components
,
2855 GLsizei width
, GLsizei height
, GLsizei depth
,
2857 GLenum format
, GLenum type
,
2858 const GLvoid
*pixels
)
2860 GET_CURRENT_CONTEXT(ctx
);
2861 if (target
== GL_PROXY_TEXTURE_3D
) {
2862 /* don't compile, execute immediately */
2863 (*ctx
->Exec
->TexImage3D
)( target
, level
, components
, width
,
2864 height
, depth
, border
, format
, type
, pixels
);
2868 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
2869 pixels
, &ctx
->Unpack
);
2870 FLUSH_VB(ctx
, "dlist");
2871 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
2875 n
[3].i
= components
;
2876 n
[4].i
= (GLint
) width
;
2877 n
[5].i
= (GLint
) height
;
2878 n
[6].i
= (GLint
) depth
;
2887 if (ctx
->ExecuteFlag
) {
2888 (*ctx
->Exec
->TexImage3D
)( target
, level
, components
, width
,
2889 height
, depth
, border
, format
, type
, pixels
);
2895 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
2896 GLsizei width
, GLenum format
, GLenum type
,
2897 const GLvoid
*pixels
)
2899 GET_CURRENT_CONTEXT(ctx
);
2901 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
2902 pixels
, &ctx
->Unpack
);
2903 FLUSH_VB(ctx
, "dlist");
2904 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
2909 n
[4].i
= (GLint
) width
;
2917 if (ctx
->ExecuteFlag
) {
2918 (*ctx
->Exec
->TexSubImage1D
)( target
, level
, xoffset
, width
,
2919 format
, type
, pixels
);
2924 static void save_TexSubImage2D( GLenum target
, GLint level
,
2925 GLint xoffset
, GLint yoffset
,
2926 GLsizei width
, GLsizei height
,
2927 GLenum format
, GLenum type
,
2928 const GLvoid
*pixels
)
2930 GET_CURRENT_CONTEXT(ctx
);
2932 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
2933 pixels
, &ctx
->Unpack
);
2934 FLUSH_VB(ctx
, "dlist");
2935 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
2941 n
[5].i
= (GLint
) width
;
2942 n
[6].i
= (GLint
) height
;
2950 if (ctx
->ExecuteFlag
) {
2951 (*ctx
->Exec
->TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
2952 width
, height
, format
, type
, pixels
);
2957 static void save_TexSubImage3D( GLenum target
, GLint level
,
2958 GLint xoffset
, GLint yoffset
,GLint zoffset
,
2959 GLsizei width
, GLsizei height
, GLsizei depth
,
2960 GLenum format
, GLenum type
,
2961 const GLvoid
*pixels
)
2963 GET_CURRENT_CONTEXT(ctx
);
2965 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
2966 pixels
, &ctx
->Unpack
);
2967 FLUSH_VB(ctx
, "dlist");
2968 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
2975 n
[6].i
= (GLint
) width
;
2976 n
[7].i
= (GLint
) height
;
2977 n
[8].i
= (GLint
) depth
;
2985 if (ctx
->ExecuteFlag
) {
2986 (*ctx
->Exec
->TexSubImage3D
)( target
, level
,
2987 xoffset
, yoffset
, zoffset
,
2988 width
, height
, depth
, format
, type
, pixels
);
2993 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
2995 GET_CURRENT_CONTEXT(ctx
);
2997 FLUSH_VB(ctx
, "dlist");
2998 n
= alloc_instruction( ctx
, OPCODE_TRANSLATE
, 3 );
3004 if (ctx
->ExecuteFlag
) {
3005 (*ctx
->Exec
->Translatef
)( x
, y
, z
);
3010 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3012 save_Translatef(x
, y
, z
);
3017 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3019 GET_CURRENT_CONTEXT(ctx
);
3021 FLUSH_VB(ctx
, "dlist");
3022 n
= alloc_instruction( ctx
, OPCODE_VIEWPORT
, 4 );
3026 n
[3].i
= (GLint
) width
;
3027 n
[4].i
= (GLint
) height
;
3029 if (ctx
->ExecuteFlag
) {
3030 (*ctx
->Exec
->Viewport
)( x
, y
, width
, height
);
3035 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3037 GET_CURRENT_CONTEXT(ctx
);
3039 FLUSH_VB(ctx
, "dlist");
3040 n
= alloc_instruction( ctx
, OPCODE_WINDOW_POS
, 4 );
3047 if (ctx
->ExecuteFlag
) {
3048 (*ctx
->Exec
->WindowPos4fMESA
)( x
, y
, z
, w
);
3052 static void save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3054 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3057 static void save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3059 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3062 static void save_WindowPos2iMESA(GLint x
, GLint y
)
3064 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3067 static void save_WindowPos2sMESA(GLshort x
, GLshort y
)
3069 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3072 static void save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3074 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3077 static void save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3079 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3082 static void save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3084 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3087 static void save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3089 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3092 static void save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3094 save_WindowPos4fMESA(x
, y
, z
, w
);
3097 static void save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3099 save_WindowPos4fMESA(x
, y
, z
, w
);
3102 static void save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3104 save_WindowPos4fMESA(x
, y
, z
, w
);
3107 static void save_WindowPos2dvMESA(const GLdouble
*v
)
3109 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3112 static void save_WindowPos2fvMESA(const GLfloat
*v
)
3114 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3117 static void save_WindowPos2ivMESA(const GLint
*v
)
3119 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3122 static void save_WindowPos2svMESA(const GLshort
*v
)
3124 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3127 static void save_WindowPos3dvMESA(const GLdouble
*v
)
3129 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3132 static void save_WindowPos3fvMESA(const GLfloat
*v
)
3134 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3137 static void save_WindowPos3ivMESA(const GLint
*v
)
3139 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3142 static void save_WindowPos3svMESA(const GLshort
*v
)
3144 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3147 static void save_WindowPos4dvMESA(const GLdouble
*v
)
3149 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3152 static void save_WindowPos4fvMESA(const GLfloat
*v
)
3154 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3157 static void save_WindowPos4ivMESA(const GLint
*v
)
3159 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3162 static void save_WindowPos4svMESA(const GLshort
*v
)
3164 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3169 /* GL_ARB_multitexture */
3170 static void save_ActiveTextureARB( GLenum target
)
3172 GET_CURRENT_CONTEXT(ctx
);
3174 FLUSH_VB(ctx
, "dlist");
3175 n
= alloc_instruction( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3179 if (ctx
->ExecuteFlag
) {
3180 (*ctx
->Exec
->ActiveTextureARB
)( target
);
3185 /* GL_ARB_multitexture */
3186 static void save_ClientActiveTextureARB( GLenum target
)
3188 GET_CURRENT_CONTEXT(ctx
);
3190 FLUSH_VB(ctx
, "dlist");
3191 n
= alloc_instruction( ctx
, OPCODE_CLIENT_ACTIVE_TEXTURE
, 1 );
3195 if (ctx
->ExecuteFlag
) {
3196 (*ctx
->Exec
->ClientActiveTextureARB
)( target
);
3202 static void save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3205 gl_matrix_transposed(tm
, m
);
3206 save_LoadMatrixd(tm
);
3210 static void save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3213 gl_matrix_transposef(tm
, m
);
3214 save_LoadMatrixf(tm
);
3218 static void save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3221 gl_matrix_transposed(tm
, m
);
3222 save_MultMatrixd(tm
);
3226 static void save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3229 gl_matrix_transposef(tm
, m
);
3230 save_MultMatrixf(tm
);
3234 static void save_PixelTexGenSGIX(GLenum mode
)
3236 GET_CURRENT_CONTEXT(ctx
);
3238 FLUSH_VB(ctx
, "dlist");
3239 n
= alloc_instruction( ctx
, OPCODE_PIXEL_TEXGEN_SGIX
, 1 );
3243 if (ctx
->ExecuteFlag
) {
3244 (*ctx
->Exec
->PixelTexGenSGIX
)( mode
);
3249 static void save_PixelTexGenParameteriSGIS(GLenum target
, GLint value
)
3251 GET_CURRENT_CONTEXT(ctx
);
3253 FLUSH_VB(ctx
, "dlist");
3254 n
= alloc_instruction( ctx
, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
, 2 );
3259 if (ctx
->ExecuteFlag
) {
3260 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( target
, value
);
3265 static void save_PixelTexGenParameterfSGIS(GLenum target
, GLfloat value
)
3267 save_PixelTexGenParameteriSGIS(target
, (GLint
) value
);
3271 static void save_PixelTexGenParameterivSGIS(GLenum target
, const GLint
*value
)
3273 save_PixelTexGenParameteriSGIS(target
, *value
);
3277 static void save_PixelTexGenParameterfvSGIS(GLenum target
, const GLfloat
*value
)
3279 save_PixelTexGenParameteriSGIS(target
, (GLint
) *value
);
3282 void gl_compile_cassette( GLcontext
*ctx
)
3284 Node
*n
= alloc_instruction( ctx
, OPCODE_VERTEX_CASSETTE
, 8 );
3285 struct immediate
*im
= ctx
->input
;
3291 /* Do some easy optimizations of the cassette.
3294 if (0 && im
->v
.Obj
.size
< 4 && im
->Count
> 15) {
3295 im
->Bounds
= (GLfloat (*)[3]) MALLOC(6 * sizeof(GLfloat
));
3296 (gl_calc_bound_tab
[im
->v
.Obj
.size
])( im
->Bounds
, &im
->v
.Obj
);
3300 n
[1].data
= (void *)im
;
3301 n
[2].ui
= im
->Start
;
3302 n
[3].ui
= im
->Count
;
3303 n
[4].ui
= im
->BeginState
;
3304 n
[5].ui
= im
->OrFlag
;
3305 n
[6].ui
= im
->AndFlag
;
3306 n
[7].ui
= im
->LastData
;
3307 n
[8].ui
= im
->LastPrimitive
;
3309 if (im
->Count
> VB_MAX
- 4) {
3311 struct immediate
*new_im
= gl_immediate_alloc(ctx
);
3312 if (!new_im
) return;
3313 SET_IMMEDIATE( ctx
, new_im
);
3314 gl_reset_input( ctx
);
3318 im
->Start
= im
->Count
; /* don't clear anything in reset_input */
3321 im
->Primitive
[im
->Start
] = ctx
->Current
.Primitive
;
3322 im
->LastPrimitive
= im
->Start
;
3323 im
->BeginState
= VERT_BEGIN_0
;
3328 fprintf(stderr
, "in compile_cassette, BeginState is %x\n",
3333 /* KW: Compile commands
3335 * Will appear in the list before the vertex buffer containing the
3336 * command that provoked the error. I don't see this as a problem.
3338 void gl_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
3341 n
= alloc_instruction( ctx
, OPCODE_ERROR
, 2 );
3344 n
[2].data
= (void *) s
;
3346 /* execute already done */
3351 islist(GLcontext
*ctx
, GLuint list
)
3353 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
3363 /**********************************************************************/
3364 /* Display list execution */
3365 /**********************************************************************/
3369 * Execute a display list. Note that the ListBase offset must have already
3370 * been added before calling this function. I.e. the list argument is
3371 * the absolute list number, not relative to ListBase.
3372 * Input: list - display list number
3374 static void execute_list( GLcontext
*ctx
, GLuint list
)
3380 if (!islist(ctx
,list
))
3383 /* mesa_print_display_list( list ); */
3387 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
3391 opcode
= n
[0].opcode
;
3395 gl_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
3397 case OPCODE_VERTEX_CASSETTE
: {
3398 struct immediate
*IM
;
3401 gl_update_state(ctx
);
3402 if (ctx
->CompileCVAFlag
) {
3403 ctx
->CompileCVAFlag
= 0;
3404 ctx
->CVA
.elt
.pipeline_valid
= 0;
3406 if (!ctx
->CVA
.elt
.pipeline_valid
)
3407 gl_build_immediate_pipeline( ctx
);
3410 IM
= (struct immediate
*) n
[1].data
;
3411 IM
->Start
= n
[2].ui
;
3412 IM
->Count
= n
[3].ui
;
3413 IM
->BeginState
= n
[4].ui
;
3414 IM
->OrFlag
= n
[5].ui
;
3415 IM
->AndFlag
= n
[6].ui
;
3416 IM
->LastData
= n
[7].ui
;
3417 IM
->LastPrimitive
= n
[8].ui
;
3419 if ((MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
) &&
3420 (MESA_VERBOSE
& VERBOSE_IMMEDIATE
))
3421 gl_print_cassette( (struct immediate
*) n
[1].data
);
3423 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
) {
3424 fprintf(stderr
, "Run cassette %d, rows %d..%d, beginstate %x ",
3426 IM
->Start
, IM
->Count
, IM
->BeginState
);
3427 gl_print_vert_flags("orflag", IM
->OrFlag
);
3430 gl_fixup_cassette( ctx
, (struct immediate
*) n
[1].data
);
3431 gl_execute_cassette( ctx
, (struct immediate
*) n
[1].data
);
3435 (*ctx
->Exec
->Accum
)( n
[1].e
, n
[2].f
);
3437 case OPCODE_ALPHA_FUNC
:
3438 (*ctx
->Exec
->AlphaFunc
)( n
[1].e
, n
[2].f
);
3440 case OPCODE_BIND_TEXTURE
:
3441 (*ctx
->Exec
->BindTexture
)( n
[1].e
, n
[2].ui
);
3445 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3446 ctx
->Unpack
= _mesa_native_packing
;
3447 (*ctx
->Exec
->Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
3448 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (const GLubyte
*) n
[7].data
);
3449 ctx
->Unpack
= save
; /* restore */
3452 case OPCODE_BLEND_COLOR
:
3453 (*ctx
->Exec
->BlendColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3455 case OPCODE_BLEND_EQUATION
:
3456 (*ctx
->Exec
->BlendEquation
)( n
[1].e
);
3458 case OPCODE_BLEND_FUNC
:
3459 (*ctx
->Exec
->BlendFunc
)( n
[1].e
, n
[2].e
);
3461 case OPCODE_BLEND_FUNC_SEPARATE
:
3462 (*ctx
->Exec
->BlendFuncSeparateEXT
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
3464 case OPCODE_CALL_LIST
:
3465 /* Generated by glCallList(), don't add ListBase */
3466 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
3467 execute_list( ctx
, n
[1].ui
);
3470 case OPCODE_CALL_LIST_OFFSET
:
3471 /* Generated by glCallLists() so we must add ListBase */
3472 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
3473 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
3477 (*ctx
->Exec
->Clear
)( n
[1].bf
);
3479 case OPCODE_CLEAR_COLOR
:
3480 (*ctx
->Exec
->ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3482 case OPCODE_CLEAR_ACCUM
:
3483 (*ctx
->Exec
->ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3485 case OPCODE_CLEAR_DEPTH
:
3486 (*ctx
->Exec
->ClearDepth
)( (GLclampd
) n
[1].f
);
3488 case OPCODE_CLEAR_INDEX
:
3489 (*ctx
->Exec
->ClearIndex
)( n
[1].ui
);
3491 case OPCODE_CLEAR_STENCIL
:
3492 (*ctx
->Exec
->ClearStencil
)( n
[1].i
);
3494 case OPCODE_CLIP_PLANE
:
3501 (*ctx
->Exec
->ClipPlane
)( n
[1].e
, eq
);
3504 case OPCODE_COLOR_MASK
:
3505 (*ctx
->Exec
->ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
3507 case OPCODE_COLOR_MATERIAL
:
3508 (*ctx
->Exec
->ColorMaterial
)( n
[1].e
, n
[2].e
);
3510 case OPCODE_COLOR_TABLE
:
3512 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3513 ctx
->Unpack
= _mesa_native_packing
;
3514 (*ctx
->Exec
->ColorTable
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
3515 n
[5].e
, n
[6].data
);
3516 ctx
->Unpack
= save
; /* restore */
3519 case OPCODE_COLOR_SUB_TABLE
:
3521 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3522 ctx
->Unpack
= _mesa_native_packing
;
3523 (*ctx
->Exec
->ColorSubTable
)( n
[1].e
, n
[2].i
, n
[3].i
,
3524 n
[4].e
, n
[5].e
, n
[6].data
);
3525 ctx
->Unpack
= save
; /* restore */
3528 case OPCODE_COPY_PIXELS
:
3529 (*ctx
->Exec
->CopyPixels
)( n
[1].i
, n
[2].i
,
3530 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
3532 case OPCODE_COPY_TEX_IMAGE1D
:
3533 (*ctx
->Exec
->CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
3534 n
[5].i
, n
[6].i
, n
[7].i
);
3536 case OPCODE_COPY_TEX_IMAGE2D
:
3537 (*ctx
->Exec
->CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
3538 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
3540 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
3541 (*ctx
->Exec
->CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3542 n
[4].i
, n
[5].i
, n
[6].i
);
3544 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
3545 (*ctx
->Exec
->CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3546 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
3548 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
3549 (*ctx
->Exec
->CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3550 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
3552 case OPCODE_CULL_FACE
:
3553 (*ctx
->Exec
->CullFace
)( n
[1].e
);
3555 case OPCODE_DEPTH_FUNC
:
3556 (*ctx
->Exec
->DepthFunc
)( n
[1].e
);
3558 case OPCODE_DEPTH_MASK
:
3559 (*ctx
->Exec
->DepthMask
)( n
[1].b
);
3561 case OPCODE_DEPTH_RANGE
:
3562 (*ctx
->Exec
->DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
3564 case OPCODE_DISABLE
:
3565 (*ctx
->Exec
->Disable
)( n
[1].e
);
3567 case OPCODE_DRAW_BUFFER
:
3568 (*ctx
->Exec
->DrawBuffer
)( n
[1].e
);
3570 case OPCODE_DRAW_PIXELS
:
3572 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3573 ctx
->Unpack
= _mesa_native_packing
;
3574 (*ctx
->Exec
->DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
3576 ctx
->Unpack
= save
; /* restore */
3580 (*ctx
->Exec
->Enable
)( n
[1].e
);
3582 case OPCODE_EVALMESH1
:
3583 (*ctx
->Exec
->EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
3585 case OPCODE_EVALMESH2
:
3586 (*ctx
->Exec
->EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
3595 (*ctx
->Exec
->Fogfv
)( n
[1].e
, p
);
3598 case OPCODE_FRONT_FACE
:
3599 (*ctx
->Exec
->FrontFace
)( n
[1].e
);
3601 case OPCODE_FRUSTUM
:
3602 (*ctx
->Exec
->Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
3605 (*ctx
->Exec
->Hint
)( n
[1].e
, n
[2].e
);
3607 case OPCODE_HINT_PGI
:
3608 (*ctx
->Exec
->HintPGI
)( n
[1].e
, n
[2].i
);
3610 case OPCODE_INDEX_MASK
:
3611 (*ctx
->Exec
->IndexMask
)( n
[1].ui
);
3613 case OPCODE_INIT_NAMES
:
3614 (*ctx
->Exec
->InitNames
)();
3623 (*ctx
->Exec
->Lightfv
)( n
[1].e
, n
[2].e
, p
);
3626 case OPCODE_LIGHT_MODEL
:
3633 (*ctx
->Exec
->LightModelfv
)( n
[1].e
, p
);
3636 case OPCODE_LINE_STIPPLE
:
3637 (*ctx
->Exec
->LineStipple
)( n
[1].i
, n
[2].us
);
3639 case OPCODE_LINE_WIDTH
:
3640 (*ctx
->Exec
->LineWidth
)( n
[1].f
);
3642 case OPCODE_LIST_BASE
:
3643 (*ctx
->Exec
->ListBase
)( n
[1].ui
);
3645 case OPCODE_LOAD_IDENTITY
:
3646 (*ctx
->Exec
->LoadIdentity
)();
3648 case OPCODE_LOAD_MATRIX
:
3649 if (sizeof(Node
)==sizeof(GLfloat
)) {
3650 (*ctx
->Exec
->LoadMatrixf
)( &n
[1].f
);
3655 for (i
=0;i
<16;i
++) {
3658 (*ctx
->Exec
->LoadMatrixf
)( m
);
3661 case OPCODE_LOAD_NAME
:
3662 (*ctx
->Exec
->LoadName
)( n
[1].ui
);
3664 case OPCODE_LOGIC_OP
:
3665 (*ctx
->Exec
->LogicOp
)( n
[1].e
);
3669 GLenum target
= n
[1].e
;
3670 GLint ustride
= _mesa_evaluator_components(target
);
3671 GLint uorder
= n
[5].i
;
3672 GLfloat u1
= n
[2].f
;
3673 GLfloat u2
= n
[3].f
;
3674 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, ustride
, uorder
,
3675 (GLfloat
*) n
[6].data
);
3680 GLenum target
= n
[1].e
;
3681 GLfloat u1
= n
[2].f
;
3682 GLfloat u2
= n
[3].f
;
3683 GLfloat v1
= n
[4].f
;
3684 GLfloat v2
= n
[5].f
;
3685 GLint ustride
= n
[6].i
;
3686 GLint vstride
= n
[7].i
;
3687 GLint uorder
= n
[8].i
;
3688 GLint vorder
= n
[9].i
;
3689 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
3690 v1
, v2
, vstride
, vorder
,
3691 (GLfloat
*) n
[10].data
);
3694 case OPCODE_MAPGRID1
:
3695 (*ctx
->Exec
->MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
3697 case OPCODE_MAPGRID2
:
3698 (*ctx
->Exec
->MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
3700 case OPCODE_MATRIX_MODE
:
3701 (*ctx
->Exec
->MatrixMode
)( n
[1].e
);
3703 case OPCODE_MULT_MATRIX
:
3704 if (sizeof(Node
)==sizeof(GLfloat
)) {
3705 (*ctx
->Exec
->MultMatrixf
)( &n
[1].f
);
3710 for (i
=0;i
<16;i
++) {
3713 (*ctx
->Exec
->MultMatrixf
)( m
);
3717 (*ctx
->Exec
->Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
3719 case OPCODE_PASSTHROUGH
:
3720 (*ctx
->Exec
->PassThrough
)( n
[1].f
);
3722 case OPCODE_PIXEL_MAP
:
3723 (*ctx
->Exec
->PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
3725 case OPCODE_PIXEL_TRANSFER
:
3726 (*ctx
->Exec
->PixelTransferf
)( n
[1].e
, n
[2].f
);
3728 case OPCODE_PIXEL_ZOOM
:
3729 (*ctx
->Exec
->PixelZoom
)( n
[1].f
, n
[2].f
);
3731 case OPCODE_POINT_SIZE
:
3732 (*ctx
->Exec
->PointSize
)( n
[1].f
);
3734 case OPCODE_POINT_PARAMETERS
:
3740 (*ctx
->Exec
->PointParameterfvEXT
)( n
[1].e
, params
);
3743 case OPCODE_POLYGON_MODE
:
3744 (*ctx
->Exec
->PolygonMode
)( n
[1].e
, n
[2].e
);
3746 case OPCODE_POLYGON_STIPPLE
:
3747 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) n
[1].data
);
3749 case OPCODE_POLYGON_OFFSET
:
3750 (*ctx
->Exec
->PolygonOffset
)( n
[1].f
, n
[2].f
);
3752 case OPCODE_POP_ATTRIB
:
3753 (*ctx
->Exec
->PopAttrib
)();
3755 case OPCODE_POP_MATRIX
:
3756 (*ctx
->Exec
->PopMatrix
)();
3758 case OPCODE_POP_NAME
:
3759 (*ctx
->Exec
->PopName
)();
3761 case OPCODE_PRIORITIZE_TEXTURE
:
3762 (*ctx
->Exec
->PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
3764 case OPCODE_PUSH_ATTRIB
:
3765 (*ctx
->Exec
->PushAttrib
)( n
[1].bf
);
3767 case OPCODE_PUSH_MATRIX
:
3768 (*ctx
->Exec
->PushMatrix
)();
3770 case OPCODE_PUSH_NAME
:
3771 (*ctx
->Exec
->PushName
)( n
[1].ui
);
3773 case OPCODE_RASTER_POS
:
3774 (*ctx
->Exec
->RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3776 case OPCODE_READ_BUFFER
:
3777 (*ctx
->Exec
->ReadBuffer
)( n
[1].e
);
3780 (*ctx
->Exec
->Rectf
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3783 (*ctx
->Exec
->Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
3785 case OPCODE_SCISSOR
:
3786 (*ctx
->Exec
->Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
3788 case OPCODE_SHADE_MODEL
:
3789 (*ctx
->Exec
->ShadeModel
)( n
[1].e
);
3791 case OPCODE_STENCIL_FUNC
:
3792 (*ctx
->Exec
->StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
3794 case OPCODE_STENCIL_MASK
:
3795 (*ctx
->Exec
->StencilMask
)( n
[1].ui
);
3797 case OPCODE_STENCIL_OP
:
3798 (*ctx
->Exec
->StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
3807 (*ctx
->Exec
->TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
3817 (*ctx
->Exec
->TexGenfv
)( n
[1].e
, n
[2].e
, params
);
3820 case OPCODE_TEXPARAMETER
:
3827 (*ctx
->Exec
->TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
3830 case OPCODE_TEX_IMAGE1D
:
3832 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3833 ctx
->Unpack
= _mesa_native_packing
;
3834 (*ctx
->Exec
->TexImage1D
)(
3835 n
[1].e
, /* target */
3837 n
[3].i
, /* components */
3839 n
[5].e
, /* border */
3840 n
[6].e
, /* format */
3843 ctx
->Unpack
= save
; /* restore */
3846 case OPCODE_TEX_IMAGE2D
:
3848 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3849 ctx
->Unpack
= _mesa_native_packing
;
3850 (*ctx
->Exec
->TexImage2D
)(
3851 n
[1].e
, /* target */
3853 n
[3].i
, /* components */
3855 n
[5].i
, /* height */
3856 n
[6].e
, /* border */
3857 n
[7].e
, /* format */
3860 ctx
->Unpack
= save
; /* restore */
3863 case OPCODE_TEX_IMAGE3D
:
3865 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3866 ctx
->Unpack
= _mesa_native_packing
;
3867 (*ctx
->Exec
->TexImage3D
)(
3868 n
[1].e
, /* target */
3870 n
[3].i
, /* components */
3872 n
[5].i
, /* height */
3874 n
[7].e
, /* border */
3875 n
[8].e
, /* format */
3878 ctx
->Unpack
= save
; /* restore */
3881 case OPCODE_TEX_SUB_IMAGE1D
:
3883 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3884 ctx
->Unpack
= _mesa_native_packing
;
3885 (*ctx
->Exec
->TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3887 n
[6].e
, n
[7].data
);
3888 ctx
->Unpack
= save
; /* restore */
3891 case OPCODE_TEX_SUB_IMAGE2D
:
3893 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3894 ctx
->Unpack
= _mesa_native_packing
;
3895 (*ctx
->Exec
->TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3897 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
3898 ctx
->Unpack
= save
; /* restore */
3901 case OPCODE_TEX_SUB_IMAGE3D
:
3903 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3904 ctx
->Unpack
= _mesa_native_packing
;
3905 (*ctx
->Exec
->TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3906 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
3907 n
[8].i
, n
[9].e
, n
[10].e
,
3909 ctx
->Unpack
= save
; /* restore */
3912 case OPCODE_TRANSLATE
:
3913 (*ctx
->Exec
->Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
3915 case OPCODE_VIEWPORT
:
3916 (*ctx
->Exec
->Viewport
)(n
[1].i
, n
[2].i
,
3917 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
3919 case OPCODE_WINDOW_POS
:
3920 (*ctx
->Exec
->WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3922 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
3923 (*ctx
->Exec
->ActiveTextureARB
)( n
[1].e
);
3925 case OPCODE_CLIENT_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
3926 (*ctx
->Exec
->ClientActiveTextureARB
)( n
[1].e
);
3928 case OPCODE_PIXEL_TEXGEN_SGIX
: /* GL_SGIX_pixel_texture */
3929 (*ctx
->Exec
->PixelTexGenSGIX
)( n
[1].e
);
3931 case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
: /* GL_SGIS_pixel_texture */
3932 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( n
[1].e
, n
[2].i
);
3934 case OPCODE_CONTINUE
:
3935 n
= (Node
*) n
[1].next
;
3937 case OPCODE_END_OF_LIST
:
3943 sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
3944 gl_problem( ctx
, msg
);
3949 /* increment n to point to next compiled command */
3950 if (opcode
!=OPCODE_CONTINUE
) {
3951 n
+= InstSize
[opcode
];
3962 /**********************************************************************/
3964 /**********************************************************************/
3970 * Test if a display list number is valid.
3973 _mesa_IsList( GLuint list
)
3975 GET_CURRENT_CONTEXT(ctx
);
3976 return islist(ctx
, list
);
3981 * Delete a sequence of consecutive display lists.
3984 _mesa_DeleteLists( GLuint list
, GLsizei range
)
3986 GET_CURRENT_CONTEXT(ctx
);
3989 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glDeleteLists");
3991 gl_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
3994 for (i
=list
;i
<list
+range
;i
++) {
3995 gl_destroy_list( ctx
, i
);
4002 * Return a display list number, n, such that lists n through n+range-1
4006 _mesa_GenLists(GLsizei range
)
4008 GET_CURRENT_CONTEXT(ctx
);
4011 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx
, "glGenLists", 0);
4013 gl_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
4021 * Make this an atomic operation
4023 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
4025 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
4027 /* reserve the list IDs by with empty/dummy lists */
4029 for (i
=0; i
<range
; i
++) {
4030 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
4034 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
4042 * Begin a new display list.
4045 _mesa_NewList( GLuint list
, GLenum mode
)
4047 GET_CURRENT_CONTEXT(ctx
);
4048 struct immediate
*IM
;
4049 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glNewList");
4051 if (MESA_VERBOSE
&VERBOSE_API
)
4052 fprintf(stderr
, "glNewList %u %s\n", list
, gl_lookup_enum_by_nr(mode
));
4055 gl_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
4059 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
4060 gl_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
4064 if (ctx
->CurrentListPtr
) {
4065 /* already compiling a display list */
4066 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
4070 /* Allocate new display list */
4071 ctx
->CurrentListNum
= list
;
4072 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
4073 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
4074 ctx
->CurrentPos
= 0;
4076 IM
= gl_immediate_alloc( ctx
);
4077 SET_IMMEDIATE( ctx
, IM
);
4078 gl_reset_input( ctx
);
4080 ctx
->CompileFlag
= GL_TRUE
;
4081 ctx
->CompileCVAFlag
= GL_FALSE
;
4082 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
4084 ctx
->CurrentDispatch
= ctx
->Save
;
4085 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4091 * End definition of current display list.
4094 _mesa_EndList( void )
4096 GET_CURRENT_CONTEXT(ctx
);
4097 if (MESA_VERBOSE
&VERBOSE_API
)
4098 fprintf(stderr
, "glEndList\n");
4100 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
, "glEndList" );
4102 /* Check that a list is under construction */
4103 if (!ctx
->CurrentListPtr
) {
4104 gl_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
4108 (void) alloc_instruction( ctx
, OPCODE_END_OF_LIST
, 0 );
4110 /* Destroy old list, if any */
4111 gl_destroy_list(ctx
, ctx
->CurrentListNum
);
4112 /* Install the list */
4113 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
4116 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
4117 mesa_print_display_list(ctx
->CurrentListNum
);
4119 ctx
->CurrentListNum
= 0;
4120 ctx
->CurrentListPtr
= NULL
;
4121 ctx
->ExecuteFlag
= GL_TRUE
;
4122 ctx
->CompileFlag
= GL_FALSE
;
4123 /* ctx->CompileCVAFlag = ...; */
4125 /* KW: Put back the old input pointer.
4127 if (--ctx
->input
->ref_count
== 0)
4128 gl_immediate_free( ctx
->input
);
4130 SET_IMMEDIATE( ctx
, ctx
->VB
->IM
);
4131 gl_reset_input( ctx
);
4133 /* Haven't tracked down why this is needed.
4137 ctx
->CurrentDispatch
= ctx
->Exec
;
4138 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4144 _mesa_CallList( GLuint list
)
4146 GET_CURRENT_CONTEXT(ctx
);
4147 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
4148 /* execute the display list, and restore the CompileFlag. */
4149 GLboolean save_compile_flag
;
4151 if (MESA_VERBOSE
&VERBOSE_API
) {
4152 fprintf(stderr
, "glCallList %u\n", list
);
4153 mesa_print_display_list( list
);
4156 save_compile_flag
= ctx
->CompileFlag
;
4157 ctx
->CompileFlag
= GL_FALSE
;
4159 FLUSH_VB( ctx
, "call list" );
4160 execute_list( ctx
, list
);
4161 ctx
->CompileFlag
= save_compile_flag
;
4163 /* also restore API function pointers to point to "save" versions */
4164 if (save_compile_flag
) {
4165 ctx
->CurrentDispatch
= ctx
->Save
;
4166 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4173 * Execute glCallLists: call multiple display lists.
4176 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
4178 GET_CURRENT_CONTEXT(ctx
);
4181 GLboolean save_compile_flag
;
4183 /* Save the CompileFlag status, turn it off, execute display list,
4184 * and restore the CompileFlag.
4186 save_compile_flag
= ctx
->CompileFlag
;
4187 ctx
->CompileFlag
= GL_FALSE
;
4189 FLUSH_VB( ctx
, "call lists" );
4192 list
= translate_id( i
, type
, lists
);
4193 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
4196 ctx
->CompileFlag
= save_compile_flag
;
4198 /* also restore API function pointers to point to "save" versions */
4199 if (save_compile_flag
) {
4200 ctx
->CurrentDispatch
= ctx
->Save
;
4201 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4204 /* RESET_IMMEDIATE( ctx ); */
4210 * Set the offset added to list numbers in glCallLists.
4213 _mesa_ListBase( GLuint base
)
4215 GET_CURRENT_CONTEXT(ctx
);
4216 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glListBase");
4217 ctx
->List
.ListBase
= base
;
4224 * Assign all the pointers in 'table' to point to Mesa's display list
4225 * building functions.
4228 _mesa_init_dlist_table( struct _glapi_table
*table
)
4230 _mesa_init_no_op_table(table
);
4233 table
->Accum
= save_Accum
;
4234 table
->AlphaFunc
= save_AlphaFunc
;
4235 table
->Begin
= save_Begin
;
4236 table
->Bitmap
= save_Bitmap
;
4237 table
->BlendFunc
= save_BlendFunc
;
4238 table
->CallList
= save_CallList
;
4239 table
->CallLists
= save_CallLists
;
4240 table
->Clear
= save_Clear
;
4241 table
->ClearAccum
= save_ClearAccum
;
4242 table
->ClearColor
= save_ClearColor
;
4243 table
->ClearDepth
= save_ClearDepth
;
4244 table
->ClearIndex
= save_ClearIndex
;
4245 table
->ClearStencil
= save_ClearStencil
;
4246 table
->ClipPlane
= save_ClipPlane
;
4247 table
->Color3b
= _mesa_Color3b
;
4248 table
->Color3bv
= _mesa_Color3bv
;
4249 table
->Color3d
= _mesa_Color3d
;
4250 table
->Color3dv
= _mesa_Color3dv
;
4251 table
->Color3f
= _mesa_Color3f
;
4252 table
->Color3fv
= _mesa_Color3fv
;
4253 table
->Color3i
= _mesa_Color3i
;
4254 table
->Color3iv
= _mesa_Color3iv
;
4255 table
->Color3s
= _mesa_Color3s
;
4256 table
->Color3sv
= _mesa_Color3sv
;
4257 table
->Color3ub
= _mesa_Color3ub
;
4258 table
->Color3ubv
= _mesa_Color3ubv
;
4259 table
->Color3ui
= _mesa_Color3ui
;
4260 table
->Color3uiv
= _mesa_Color3uiv
;
4261 table
->Color3us
= _mesa_Color3us
;
4262 table
->Color3usv
= _mesa_Color3usv
;
4263 table
->Color4b
= _mesa_Color4b
;
4264 table
->Color4bv
= _mesa_Color4bv
;
4265 table
->Color4d
= _mesa_Color4d
;
4266 table
->Color4dv
= _mesa_Color4dv
;
4267 table
->Color4f
= _mesa_Color4f
;
4268 table
->Color4fv
= _mesa_Color4fv
;
4269 table
->Color4i
= _mesa_Color4i
;
4270 table
->Color4iv
= _mesa_Color4iv
;
4271 table
->Color4s
= _mesa_Color4s
;
4272 table
->Color4sv
= _mesa_Color4sv
;
4273 table
->Color4ub
= _mesa_Color4ub
;
4274 table
->Color4ubv
= _mesa_Color4ubv
;
4275 table
->Color4ui
= _mesa_Color4ui
;
4276 table
->Color4uiv
= _mesa_Color4uiv
;
4277 table
->Color4us
= _mesa_Color4us
;
4278 table
->Color4usv
= _mesa_Color4usv
;
4279 table
->ColorMask
= save_ColorMask
;
4280 table
->ColorMaterial
= save_ColorMaterial
;
4281 table
->CopyPixels
= save_CopyPixels
;
4282 table
->CullFace
= save_CullFace
;
4283 table
->DeleteLists
= _mesa_DeleteLists
;
4284 table
->DepthFunc
= save_DepthFunc
;
4285 table
->DepthMask
= save_DepthMask
;
4286 table
->DepthRange
= save_DepthRange
;
4287 table
->Disable
= save_Disable
;
4288 table
->DrawBuffer
= save_DrawBuffer
;
4289 table
->DrawPixels
= save_DrawPixels
;
4290 table
->EdgeFlag
= _mesa_EdgeFlag
;
4291 table
->EdgeFlagv
= _mesa_EdgeFlagv
;
4292 table
->Enable
= save_Enable
;
4293 table
->End
= _mesa_End
;
4294 table
->EndList
= _mesa_EndList
;
4295 table
->EvalCoord1d
= _mesa_EvalCoord1d
;
4296 table
->EvalCoord1dv
= _mesa_EvalCoord1dv
;
4297 table
->EvalCoord1f
= _mesa_EvalCoord1f
;
4298 table
->EvalCoord1fv
= _mesa_EvalCoord1fv
;
4299 table
->EvalCoord2d
= _mesa_EvalCoord2d
;
4300 table
->EvalCoord2dv
= _mesa_EvalCoord2dv
;
4301 table
->EvalCoord2f
= _mesa_EvalCoord2f
;
4302 table
->EvalCoord2fv
= _mesa_EvalCoord2fv
;
4303 table
->EvalMesh1
= save_EvalMesh1
;
4304 table
->EvalMesh2
= save_EvalMesh2
;
4305 table
->EvalPoint1
= _mesa_EvalPoint1
;
4306 table
->EvalPoint2
= _mesa_EvalPoint2
;
4307 table
->FeedbackBuffer
= _mesa_FeedbackBuffer
;
4308 table
->Finish
= _mesa_Finish
;
4309 table
->Flush
= _mesa_Flush
;
4310 table
->Fogf
= save_Fogf
;
4311 table
->Fogfv
= save_Fogfv
;
4312 table
->Fogi
= save_Fogi
;
4313 table
->Fogiv
= save_Fogiv
;
4314 table
->FrontFace
= save_FrontFace
;
4315 table
->Frustum
= save_Frustum
;
4316 table
->GenLists
= _mesa_GenLists
;
4317 table
->GetBooleanv
= _mesa_GetBooleanv
;
4318 table
->GetClipPlane
= _mesa_GetClipPlane
;
4319 table
->GetDoublev
= _mesa_GetDoublev
;
4320 table
->GetError
= _mesa_GetError
;
4321 table
->GetFloatv
= _mesa_GetFloatv
;
4322 table
->GetIntegerv
= _mesa_GetIntegerv
;
4323 table
->GetLightfv
= _mesa_GetLightfv
;
4324 table
->GetLightiv
= _mesa_GetLightiv
;
4325 table
->GetMapdv
= _mesa_GetMapdv
;
4326 table
->GetMapfv
= _mesa_GetMapfv
;
4327 table
->GetMapiv
= _mesa_GetMapiv
;
4328 table
->GetMaterialfv
= _mesa_GetMaterialfv
;
4329 table
->GetMaterialiv
= _mesa_GetMaterialiv
;
4330 table
->GetPixelMapfv
= _mesa_GetPixelMapfv
;
4331 table
->GetPixelMapuiv
= _mesa_GetPixelMapuiv
;
4332 table
->GetPixelMapusv
= _mesa_GetPixelMapusv
;
4333 table
->GetPolygonStipple
= _mesa_GetPolygonStipple
;
4334 table
->GetString
= _mesa_GetString
;
4335 table
->GetTexEnvfv
= _mesa_GetTexEnvfv
;
4336 table
->GetTexEnviv
= _mesa_GetTexEnviv
;
4337 table
->GetTexGendv
= _mesa_GetTexGendv
;
4338 table
->GetTexGenfv
= _mesa_GetTexGenfv
;
4339 table
->GetTexGeniv
= _mesa_GetTexGeniv
;
4340 table
->GetTexImage
= _mesa_GetTexImage
;
4341 table
->GetTexLevelParameterfv
= _mesa_GetTexLevelParameterfv
;
4342 table
->GetTexLevelParameteriv
= _mesa_GetTexLevelParameteriv
;
4343 table
->GetTexParameterfv
= _mesa_GetTexParameterfv
;
4344 table
->GetTexParameteriv
= _mesa_GetTexParameteriv
;
4345 table
->Hint
= save_Hint
;
4346 table
->IndexMask
= save_IndexMask
;
4347 table
->Indexd
= _mesa_Indexd
;
4348 table
->Indexdv
= _mesa_Indexdv
;
4349 table
->Indexf
= _mesa_Indexf
;
4350 table
->Indexfv
= _mesa_Indexfv
;
4351 table
->Indexi
= _mesa_Indexi
;
4352 table
->Indexiv
= _mesa_Indexiv
;
4353 table
->Indexs
= _mesa_Indexs
;
4354 table
->Indexsv
= _mesa_Indexsv
;
4355 table
->InitNames
= save_InitNames
;
4356 table
->IsEnabled
= _mesa_IsEnabled
;
4357 table
->IsList
= _mesa_IsList
;
4358 table
->LightModelf
= save_LightModelf
;
4359 table
->LightModelfv
= save_LightModelfv
;
4360 table
->LightModeli
= save_LightModeli
;
4361 table
->LightModeliv
= save_LightModeliv
;
4362 table
->Lightf
= save_Lightf
;
4363 table
->Lightfv
= save_Lightfv
;
4364 table
->Lighti
= save_Lighti
;
4365 table
->Lightiv
= save_Lightiv
;
4366 table
->LineStipple
= save_LineStipple
;
4367 table
->LineWidth
= save_LineWidth
;
4368 table
->ListBase
= save_ListBase
;
4369 table
->LoadIdentity
= save_LoadIdentity
;
4370 table
->LoadMatrixd
= save_LoadMatrixd
;
4371 table
->LoadMatrixf
= save_LoadMatrixf
;
4372 table
->LoadName
= save_LoadName
;
4373 table
->LogicOp
= save_LogicOp
;
4374 table
->Map1d
= save_Map1d
;
4375 table
->Map1f
= save_Map1f
;
4376 table
->Map2d
= save_Map2d
;
4377 table
->Map2f
= save_Map2f
;
4378 table
->MapGrid1d
= save_MapGrid1d
;
4379 table
->MapGrid1f
= save_MapGrid1f
;
4380 table
->MapGrid2d
= save_MapGrid2d
;
4381 table
->MapGrid2f
= save_MapGrid2f
;
4382 table
->Materialf
= _mesa_Materialf
;
4383 table
->Materialfv
= _mesa_Materialfv
;
4384 table
->Materiali
= _mesa_Materiali
;
4385 table
->Materialiv
= _mesa_Materialiv
;
4386 table
->MatrixMode
= save_MatrixMode
;
4387 table
->MultMatrixd
= save_MultMatrixd
;
4388 table
->MultMatrixf
= save_MultMatrixf
;
4389 table
->NewList
= save_NewList
;
4390 table
->Normal3b
= _mesa_Normal3b
;
4391 table
->Normal3bv
= _mesa_Normal3bv
;
4392 table
->Normal3d
= _mesa_Normal3d
;
4393 table
->Normal3dv
= _mesa_Normal3dv
;
4394 table
->Normal3f
= _mesa_Normal3f
;
4395 table
->Normal3fv
= _mesa_Normal3fv
;
4396 table
->Normal3i
= _mesa_Normal3i
;
4397 table
->Normal3iv
= _mesa_Normal3iv
;
4398 table
->Normal3s
= _mesa_Normal3s
;
4399 table
->Normal3sv
= _mesa_Normal3sv
;
4400 table
->Ortho
= save_Ortho
;
4401 table
->PassThrough
= save_PassThrough
;
4402 table
->PixelMapfv
= save_PixelMapfv
;
4403 table
->PixelMapuiv
= save_PixelMapuiv
;
4404 table
->PixelMapusv
= save_PixelMapusv
;
4405 table
->PixelStoref
= _mesa_PixelStoref
;
4406 table
->PixelStorei
= _mesa_PixelStorei
;
4407 table
->PixelTransferf
= save_PixelTransferf
;
4408 table
->PixelTransferi
= save_PixelTransferi
;
4409 table
->PixelZoom
= save_PixelZoom
;
4410 table
->PointSize
= save_PointSize
;
4411 table
->PolygonMode
= save_PolygonMode
;
4412 table
->PolygonOffset
= save_PolygonOffset
;
4413 table
->PolygonStipple
= save_PolygonStipple
;
4414 table
->PopAttrib
= save_PopAttrib
;
4415 table
->PopMatrix
= save_PopMatrix
;
4416 table
->PopName
= save_PopName
;
4417 table
->PushAttrib
= save_PushAttrib
;
4418 table
->PushMatrix
= save_PushMatrix
;
4419 table
->PushName
= save_PushName
;
4420 table
->RasterPos2d
= save_RasterPos2d
;
4421 table
->RasterPos2dv
= save_RasterPos2dv
;
4422 table
->RasterPos2f
= save_RasterPos2f
;
4423 table
->RasterPos2fv
= save_RasterPos2fv
;
4424 table
->RasterPos2i
= save_RasterPos2i
;
4425 table
->RasterPos2iv
= save_RasterPos2iv
;
4426 table
->RasterPos2s
= save_RasterPos2s
;
4427 table
->RasterPos2sv
= save_RasterPos2sv
;
4428 table
->RasterPos3d
= save_RasterPos3d
;
4429 table
->RasterPos3dv
= save_RasterPos3dv
;
4430 table
->RasterPos3f
= save_RasterPos3f
;
4431 table
->RasterPos3fv
= save_RasterPos3fv
;
4432 table
->RasterPos3i
= save_RasterPos3i
;
4433 table
->RasterPos3iv
= save_RasterPos3iv
;
4434 table
->RasterPos3s
= save_RasterPos3s
;
4435 table
->RasterPos3sv
= save_RasterPos3sv
;
4436 table
->RasterPos4d
= save_RasterPos4d
;
4437 table
->RasterPos4dv
= save_RasterPos4dv
;
4438 table
->RasterPos4f
= save_RasterPos4f
;
4439 table
->RasterPos4fv
= save_RasterPos4fv
;
4440 table
->RasterPos4i
= save_RasterPos4i
;
4441 table
->RasterPos4iv
= save_RasterPos4iv
;
4442 table
->RasterPos4s
= save_RasterPos4s
;
4443 table
->RasterPos4sv
= save_RasterPos4sv
;
4444 table
->ReadBuffer
= save_ReadBuffer
;
4445 table
->ReadPixels
= _mesa_ReadPixels
;
4446 table
->Rectd
= save_Rectd
;
4447 table
->Rectdv
= save_Rectdv
;
4448 table
->Rectf
= save_Rectf
;
4449 table
->Rectfv
= save_Rectfv
;
4450 table
->Recti
= save_Recti
;
4451 table
->Rectiv
= save_Rectiv
;
4452 table
->Rects
= save_Rects
;
4453 table
->Rectsv
= save_Rectsv
;
4454 table
->RenderMode
= _mesa_RenderMode
;
4455 table
->Rotated
= save_Rotated
;
4456 table
->Rotatef
= save_Rotatef
;
4457 table
->Scaled
= save_Scaled
;
4458 table
->Scalef
= save_Scalef
;
4459 table
->Scissor
= save_Scissor
;
4460 table
->SelectBuffer
= _mesa_SelectBuffer
;
4461 table
->ShadeModel
= save_ShadeModel
;
4462 table
->StencilFunc
= save_StencilFunc
;
4463 table
->StencilMask
= save_StencilMask
;
4464 table
->StencilOp
= save_StencilOp
;
4465 table
->TexCoord1d
= _mesa_TexCoord1d
;
4466 table
->TexCoord1dv
= _mesa_TexCoord1dv
;
4467 table
->TexCoord1f
= _mesa_TexCoord1f
;
4468 table
->TexCoord1fv
= _mesa_TexCoord1fv
;
4469 table
->TexCoord1i
= _mesa_TexCoord1i
;
4470 table
->TexCoord1iv
= _mesa_TexCoord1iv
;
4471 table
->TexCoord1s
= _mesa_TexCoord1s
;
4472 table
->TexCoord1sv
= _mesa_TexCoord1sv
;
4473 table
->TexCoord2d
= _mesa_TexCoord2d
;
4474 table
->TexCoord2dv
= _mesa_TexCoord2dv
;
4475 table
->TexCoord2f
= _mesa_TexCoord2f
;
4476 table
->TexCoord2fv
= _mesa_TexCoord2fv
;
4477 table
->TexCoord2i
= _mesa_TexCoord2i
;
4478 table
->TexCoord2iv
= _mesa_TexCoord2iv
;
4479 table
->TexCoord2s
= _mesa_TexCoord2s
;
4480 table
->TexCoord2sv
= _mesa_TexCoord2sv
;
4481 table
->TexCoord3d
= _mesa_TexCoord3d
;
4482 table
->TexCoord3dv
= _mesa_TexCoord3dv
;
4483 table
->TexCoord3f
= _mesa_TexCoord3f
;
4484 table
->TexCoord3fv
= _mesa_TexCoord3fv
;
4485 table
->TexCoord3i
= _mesa_TexCoord3i
;
4486 table
->TexCoord3iv
= _mesa_TexCoord3iv
;
4487 table
->TexCoord3s
= _mesa_TexCoord3s
;
4488 table
->TexCoord3sv
= _mesa_TexCoord3sv
;
4489 table
->TexCoord4d
= _mesa_TexCoord4d
;
4490 table
->TexCoord4dv
= _mesa_TexCoord4dv
;
4491 table
->TexCoord4f
= _mesa_TexCoord4f
;
4492 table
->TexCoord4fv
= _mesa_TexCoord4fv
;
4493 table
->TexCoord4i
= _mesa_TexCoord4i
;
4494 table
->TexCoord4iv
= _mesa_TexCoord4iv
;
4495 table
->TexCoord4s
= _mesa_TexCoord4s
;
4496 table
->TexCoord4sv
= _mesa_TexCoord4sv
;
4497 table
->TexEnvf
= save_TexEnvf
;
4498 table
->TexEnvfv
= save_TexEnvfv
;
4499 table
->TexEnvi
= save_TexEnvi
;
4500 table
->TexEnviv
= save_TexEnviv
;
4501 table
->TexGend
= save_TexGend
;
4502 table
->TexGendv
= save_TexGendv
;
4503 table
->TexGenf
= save_TexGenf
;
4504 table
->TexGenfv
= save_TexGenfv
;
4505 table
->TexGeni
= save_TexGeni
;
4506 table
->TexGeniv
= save_TexGeniv
;
4507 table
->TexImage1D
= save_TexImage1D
;
4508 table
->TexImage2D
= save_TexImage2D
;
4509 table
->TexParameterf
= save_TexParameterf
;
4510 table
->TexParameterfv
= save_TexParameterfv
;
4511 table
->TexParameteri
= save_TexParameteri
;
4512 table
->TexParameteriv
= save_TexParameteriv
;
4513 table
->Translated
= save_Translated
;
4514 table
->Translatef
= save_Translatef
;
4515 table
->Vertex2d
= _mesa_Vertex2d
;
4516 table
->Vertex2dv
= _mesa_Vertex2dv
;
4517 table
->Vertex2f
= _mesa_Vertex2f
;
4518 table
->Vertex2fv
= _mesa_Vertex2fv
;
4519 table
->Vertex2i
= _mesa_Vertex2i
;
4520 table
->Vertex2iv
= _mesa_Vertex2iv
;
4521 table
->Vertex2s
= _mesa_Vertex2s
;
4522 table
->Vertex2sv
= _mesa_Vertex2sv
;
4523 table
->Vertex3d
= _mesa_Vertex3d
;
4524 table
->Vertex3dv
= _mesa_Vertex3dv
;
4525 table
->Vertex3f
= _mesa_Vertex3f
;
4526 table
->Vertex3fv
= _mesa_Vertex3fv
;
4527 table
->Vertex3i
= _mesa_Vertex3i
;
4528 table
->Vertex3iv
= _mesa_Vertex3iv
;
4529 table
->Vertex3s
= _mesa_Vertex3s
;
4530 table
->Vertex3sv
= _mesa_Vertex3sv
;
4531 table
->Vertex4d
= _mesa_Vertex4d
;
4532 table
->Vertex4dv
= _mesa_Vertex4dv
;
4533 table
->Vertex4f
= _mesa_Vertex4f
;
4534 table
->Vertex4fv
= _mesa_Vertex4fv
;
4535 table
->Vertex4i
= _mesa_Vertex4i
;
4536 table
->Vertex4iv
= _mesa_Vertex4iv
;
4537 table
->Vertex4s
= _mesa_Vertex4s
;
4538 table
->Vertex4sv
= _mesa_Vertex4sv
;
4539 table
->Viewport
= save_Viewport
;
4542 table
->AreTexturesResident
= _mesa_AreTexturesResident
;
4543 table
->ArrayElement
= _mesa_ArrayElement
;
4544 table
->BindTexture
= save_BindTexture
;
4545 table
->ColorPointer
= _mesa_ColorPointer
;
4546 table
->CopyTexImage1D
= save_CopyTexImage1D
;
4547 table
->CopyTexImage2D
= save_CopyTexImage2D
;
4548 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
4549 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
4550 table
->DeleteTextures
= _mesa_DeleteTextures
;
4551 table
->DisableClientState
= _mesa_DisableClientState
;
4552 table
->DrawArrays
= _mesa_DrawArrays
;
4553 table
->DrawElements
= _mesa_DrawElements
;
4554 table
->EdgeFlagPointer
= _mesa_EdgeFlagPointer
;
4555 table
->EnableClientState
= _mesa_EnableClientState
;
4556 table
->GenTextures
= _mesa_GenTextures
;
4557 table
->GetPointerv
= _mesa_GetPointerv
;
4558 table
->IndexPointer
= _mesa_IndexPointer
;
4559 table
->Indexub
= _mesa_Indexub
;
4560 table
->Indexubv
= _mesa_Indexubv
;
4561 table
->InterleavedArrays
= _mesa_InterleavedArrays
;
4562 table
->IsTexture
= _mesa_IsTexture
;
4563 table
->NormalPointer
= _mesa_NormalPointer
;
4564 table
->PopClientAttrib
= _mesa_PopClientAttrib
;
4565 table
->PrioritizeTextures
= save_PrioritizeTextures
;
4566 table
->PushClientAttrib
= _mesa_PushClientAttrib
;
4567 table
->TexCoordPointer
= _mesa_TexCoordPointer
;
4568 table
->TexSubImage1D
= save_TexSubImage1D
;
4569 table
->TexSubImage2D
= save_TexSubImage2D
;
4570 table
->VertexPointer
= _mesa_VertexPointer
;
4573 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
4574 table
->DrawRangeElements
= _mesa_DrawRangeElements
;
4575 table
->TexImage3D
= save_TexImage3D
;
4576 table
->TexSubImage3D
= save_TexSubImage3D
;
4578 /* GL_ARB_imaging */
4579 /* Not all are supported */
4580 table
->BlendColor
= save_BlendColor
;
4581 table
->BlendEquation
= save_BlendEquation
;
4582 table
->ColorSubTable
= save_ColorSubTable
;
4583 table
->ColorTable
= save_ColorTable
;
4584 table
->ColorTableParameterfv
= _mesa_ColorTableParameterfv
;
4585 table
->ColorTableParameteriv
= _mesa_ColorTableParameteriv
;
4586 table
->ConvolutionFilter1D
= _mesa_ConvolutionFilter1D
;
4587 table
->ConvolutionFilter2D
= _mesa_ConvolutionFilter2D
;
4588 table
->ConvolutionParameterf
= _mesa_ConvolutionParameterf
;
4589 table
->ConvolutionParameterfv
= _mesa_ConvolutionParameterfv
;
4590 table
->ConvolutionParameteri
= _mesa_ConvolutionParameteri
;
4591 table
->ConvolutionParameteriv
= _mesa_ConvolutionParameteriv
;
4592 table
->CopyColorSubTable
= _mesa_CopyColorSubTable
;
4593 table
->CopyColorTable
= _mesa_CopyColorTable
;
4594 table
->CopyConvolutionFilter1D
= _mesa_CopyConvolutionFilter1D
;
4595 table
->CopyConvolutionFilter2D
= _mesa_CopyConvolutionFilter2D
;
4596 table
->GetColorTable
= _mesa_GetColorTable
;
4597 table
->GetColorTableParameterfv
= _mesa_GetColorTableParameterfv
;
4598 table
->GetColorTableParameteriv
= _mesa_GetColorTableParameteriv
;
4599 table
->GetConvolutionFilter
= _mesa_GetConvolutionFilter
;
4600 table
->GetConvolutionParameterfv
= _mesa_GetConvolutionParameterfv
;
4601 table
->GetConvolutionParameteriv
= _mesa_GetConvolutionParameteriv
;
4602 table
->GetHistogram
= _mesa_GetHistogram
;
4603 table
->GetHistogramParameterfv
= _mesa_GetHistogramParameterfv
;
4604 table
->GetHistogramParameteriv
= _mesa_GetHistogramParameteriv
;
4605 table
->GetMinmax
= _mesa_GetMinmax
;
4606 table
->GetMinmaxParameterfv
= _mesa_GetMinmaxParameterfv
;
4607 table
->GetMinmaxParameteriv
= _mesa_GetMinmaxParameteriv
;
4608 table
->GetSeparableFilter
= _mesa_GetSeparableFilter
;
4609 table
->Histogram
= _mesa_Histogram
;
4610 table
->Minmax
= _mesa_Minmax
;
4611 table
->ResetHistogram
= _mesa_ResetHistogram
;
4612 table
->ResetMinmax
= _mesa_ResetMinmax
;
4613 table
->SeparableFilter2D
= _mesa_SeparableFilter2D
;
4615 /* GL_EXT_texture3d */
4617 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
4618 table
->TexImage3DEXT
= save_TexImage3DEXT
;
4619 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
4622 /* GL_EXT_paletted_texture */
4624 table
->ColorTableEXT
= save_ColorTable
;
4625 table
->ColorSubTableEXT
= save_ColorSubTable
;
4627 table
->GetColorTableEXT
= _mesa_GetColorTable
;
4628 table
->GetColorTableParameterfvEXT
= _mesa_GetColorTableParameterfv
;
4629 table
->GetColorTableParameterivEXT
= _mesa_GetColorTableParameteriv
;
4631 /* 15. GL_SGIX_pixel_texture */
4632 table
->PixelTexGenSGIX
= save_PixelTexGenSGIX
;
4634 /* 15. GL_SGIS_pixel_texture */
4635 table
->PixelTexGenParameteriSGIS
= save_PixelTexGenParameteriSGIS
;
4636 table
->PixelTexGenParameterfSGIS
= save_PixelTexGenParameterfSGIS
;
4637 table
->PixelTexGenParameterivSGIS
= save_PixelTexGenParameterivSGIS
;
4638 table
->PixelTexGenParameterfvSGIS
= save_PixelTexGenParameterfvSGIS
;
4639 table
->GetPixelTexGenParameterivSGIS
= _mesa_GetPixelTexGenParameterivSGIS
;
4640 table
->GetPixelTexGenParameterfvSGIS
= _mesa_GetPixelTexGenParameterfvSGIS
;
4642 /* GL_EXT_compiled_vertex_array */
4643 table
->LockArraysEXT
= _mesa_LockArraysEXT
;
4644 table
->UnlockArraysEXT
= _mesa_UnlockArraysEXT
;
4646 /* GL_EXT_point_parameters */
4647 table
->PointParameterfEXT
= save_PointParameterfEXT
;
4648 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
4650 /* GL_PGI_misc_hints */
4651 table
->HintPGI
= save_HintPGI
;
4653 /* GL_EXT_polygon_offset */
4654 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
4656 /* GL_EXT_blend_minmax */
4658 table
->BlendEquationEXT
= save_BlendEquationEXT
;
4661 /* GL_EXT_blend_color */
4663 table
->BlendColorEXT
= save_BlendColorEXT
;
4666 /* GL_ARB_multitexture */
4667 table
->ActiveTextureARB
= save_ActiveTextureARB
;
4668 table
->ClientActiveTextureARB
= save_ClientActiveTextureARB
;
4669 table
->MultiTexCoord1dARB
= _mesa_MultiTexCoord1dARB
;
4670 table
->MultiTexCoord1dvARB
= _mesa_MultiTexCoord1dvARB
;
4671 table
->MultiTexCoord1fARB
= _mesa_MultiTexCoord1fARB
;
4672 table
->MultiTexCoord1fvARB
= _mesa_MultiTexCoord1fvARB
;
4673 table
->MultiTexCoord1iARB
= _mesa_MultiTexCoord1iARB
;
4674 table
->MultiTexCoord1ivARB
= _mesa_MultiTexCoord1ivARB
;
4675 table
->MultiTexCoord1sARB
= _mesa_MultiTexCoord1sARB
;
4676 table
->MultiTexCoord1svARB
= _mesa_MultiTexCoord1svARB
;
4677 table
->MultiTexCoord2dARB
= _mesa_MultiTexCoord2dARB
;
4678 table
->MultiTexCoord2dvARB
= _mesa_MultiTexCoord2dvARB
;
4679 table
->MultiTexCoord2fARB
= _mesa_MultiTexCoord2fARB
;
4680 table
->MultiTexCoord2fvARB
= _mesa_MultiTexCoord2fvARB
;
4681 table
->MultiTexCoord2iARB
= _mesa_MultiTexCoord2iARB
;
4682 table
->MultiTexCoord2ivARB
= _mesa_MultiTexCoord2ivARB
;
4683 table
->MultiTexCoord2sARB
= _mesa_MultiTexCoord2sARB
;
4684 table
->MultiTexCoord2svARB
= _mesa_MultiTexCoord2svARB
;
4685 table
->MultiTexCoord3dARB
= _mesa_MultiTexCoord3dARB
;
4686 table
->MultiTexCoord3dvARB
= _mesa_MultiTexCoord3dvARB
;
4687 table
->MultiTexCoord3fARB
= _mesa_MultiTexCoord3fARB
;
4688 table
->MultiTexCoord3fvARB
= _mesa_MultiTexCoord3fvARB
;
4689 table
->MultiTexCoord3iARB
= _mesa_MultiTexCoord3iARB
;
4690 table
->MultiTexCoord3ivARB
= _mesa_MultiTexCoord3ivARB
;
4691 table
->MultiTexCoord3sARB
= _mesa_MultiTexCoord3sARB
;
4692 table
->MultiTexCoord3svARB
= _mesa_MultiTexCoord3svARB
;
4693 table
->MultiTexCoord4dARB
= _mesa_MultiTexCoord4dARB
;
4694 table
->MultiTexCoord4dvARB
= _mesa_MultiTexCoord4dvARB
;
4695 table
->MultiTexCoord4fARB
= _mesa_MultiTexCoord4fARB
;
4696 table
->MultiTexCoord4fvARB
= _mesa_MultiTexCoord4fvARB
;
4697 table
->MultiTexCoord4iARB
= _mesa_MultiTexCoord4iARB
;
4698 table
->MultiTexCoord4ivARB
= _mesa_MultiTexCoord4ivARB
;
4699 table
->MultiTexCoord4sARB
= _mesa_MultiTexCoord4sARB
;
4700 table
->MultiTexCoord4svARB
= _mesa_MultiTexCoord4svARB
;
4702 /* GL_EXT_blend_func_separate */
4703 table
->BlendFuncSeparateEXT
= save_BlendFuncSeparateEXT
;
4705 /* GL_MESA_window_pos */
4706 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
4707 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
4708 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
4709 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
4710 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
4711 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
4712 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
4713 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
4714 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
4715 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
4716 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
4717 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
4718 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
4719 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
4720 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
4721 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
4722 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
4723 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
4724 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
4725 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
4726 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
4727 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
4728 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
4729 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
4731 /* GL_MESA_resize_buffers */
4732 table
->ResizeBuffersMESA
= _mesa_ResizeBuffersMESA
;
4734 /* GL_ARB_transpose_matrix */
4735 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
4736 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
4737 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
4738 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
4747 static const char *enum_string( GLenum k
)
4749 return gl_lookup_enum_by_nr( k
);
4754 * Print the commands in a display list. For debugging only.
4755 * TODO: many commands aren't handled yet.
4757 static void print_list( GLcontext
*ctx
, FILE *f
, GLuint list
)
4763 if (!glIsList(list
)) {
4764 fprintf(f
,"%u is not a display list ID\n",list
);
4768 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
4770 fprintf( f
, "START-LIST %u, address %p\n", list
, (void*)n
);
4772 done
= n
? GL_FALSE
: GL_TRUE
;
4774 opcode
= n
[0].opcode
;
4778 fprintf(f
,"accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
4781 fprintf(f
,"Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
4782 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
4784 case OPCODE_CALL_LIST
:
4785 fprintf(f
,"CallList %d\n", (int) n
[1].ui
);
4787 case OPCODE_CALL_LIST_OFFSET
:
4788 fprintf(f
,"CallList %d + offset %u = %u\n", (int) n
[1].ui
,
4789 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
4791 case OPCODE_DISABLE
:
4792 fprintf(f
,"Disable %s\n", enum_string(n
[1].e
));
4795 fprintf(f
,"Enable %s\n", enum_string(n
[1].e
));
4797 case OPCODE_FRUSTUM
:
4798 fprintf(f
,"Frustum %g %g %g %g %g %g\n",
4799 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4801 case OPCODE_LINE_STIPPLE
:
4802 fprintf(f
,"LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
4804 case OPCODE_LOAD_IDENTITY
:
4805 fprintf(f
,"LoadIdentity\n");
4807 case OPCODE_LOAD_MATRIX
:
4808 fprintf(f
,"LoadMatrix\n");
4809 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
4810 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
4811 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
4812 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
4814 case OPCODE_MULT_MATRIX
:
4815 fprintf(f
,"MultMatrix (or Rotate)\n");
4816 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
4817 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
4818 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
4819 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
4822 fprintf(f
,"Ortho %g %g %g %g %g %g\n",
4823 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4825 case OPCODE_POP_ATTRIB
:
4826 fprintf(f
,"PopAttrib\n");
4828 case OPCODE_POP_MATRIX
:
4829 fprintf(f
,"PopMatrix\n");
4831 case OPCODE_POP_NAME
:
4832 fprintf(f
,"PopName\n");
4834 case OPCODE_PUSH_ATTRIB
:
4835 fprintf(f
,"PushAttrib %x\n", n
[1].bf
);
4837 case OPCODE_PUSH_MATRIX
:
4838 fprintf(f
,"PushMatrix\n");
4840 case OPCODE_PUSH_NAME
:
4841 fprintf(f
,"PushName %d\n", (int) n
[1].ui
);
4843 case OPCODE_RASTER_POS
:
4844 fprintf(f
,"RasterPos %g %g %g %g\n", n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
4847 fprintf( f
, "Rectf %g %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4850 fprintf(f
,"Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
4852 case OPCODE_TRANSLATE
:
4853 fprintf(f
,"Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
4855 case OPCODE_BIND_TEXTURE
:
4856 fprintf(f
,"BindTexture %s %d\n", gl_lookup_enum_by_nr(n
[1].ui
),
4859 case OPCODE_SHADE_MODEL
:
4860 fprintf(f
,"ShadeModel %s\n", gl_lookup_enum_by_nr(n
[1].ui
));
4864 * meta opcodes/commands
4867 fprintf(f
,"Error: %s %s\n", enum_string(n
[1].e
), (const char *)n
[2].data
);
4869 case OPCODE_VERTEX_CASSETTE
:
4870 fprintf(f
,"VERTEX-CASSETTE, id %u, rows %u..%u\n",
4871 ((struct immediate
*) n
[1].data
)->id
,
4874 gl_print_cassette( (struct immediate
*) n
[1].data
);
4876 case OPCODE_CONTINUE
:
4877 fprintf(f
,"DISPLAY-LIST-CONTINUE\n");
4878 n
= (Node
*) n
[1].next
;
4880 case OPCODE_END_OF_LIST
:
4881 fprintf(f
,"END-LIST %u\n", list
);
4885 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
4886 fprintf(f
,"ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
4891 fprintf(f
,"command %d, %u operands\n",opcode
,InstSize
[opcode
]);
4895 /* increment n to point to next compiled command */
4896 if (opcode
!=OPCODE_CONTINUE
) {
4897 n
+= InstSize
[opcode
];
4905 * Clients may call this function to help debug display list problems.
4906 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
4907 * changed, or break in the future without notice.
4909 void mesa_print_display_list( GLuint list
)
4911 GET_CURRENT_CONTEXT(ctx
);
4912 print_list( ctx
, stderr
, list
);