1 /* $Id: dlist.c,v 1.28 2000/02/02 19:50: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.
46 #include "extensions.h"
80 Functions which aren't compiled but executed immediately:
95 Functions which cause errors if called while compiling a display list:
102 * Display list instructions are stored as sequences of "nodes". Nodes
103 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
104 * are linked together with a pointer.
108 /* How many nodes to allocate at a time:
109 * - reduced now that we hold vertices etc. elsewhere.
111 #define BLOCK_SIZE 64
115 * Display list opcodes.
117 * The fact that these identifiers are assigned consecutive
118 * integer values starting at 0 is very important, see InstSize array usage)
120 * KW: Commented out opcodes now handled by vertex-cassettes.
128 OPCODE_BLEND_EQUATION
,
130 OPCODE_BLEND_FUNC_SEPARATE
,
132 OPCODE_CALL_LIST_OFFSET
,
138 OPCODE_CLEAR_STENCIL
,
141 OPCODE_COLOR_MATERIAL
,
143 OPCODE_COLOR_SUB_TABLE
,
145 OPCODE_COPY_TEX_IMAGE1D
,
146 OPCODE_COPY_TEX_IMAGE2D
,
147 OPCODE_COPY_TEX_SUB_IMAGE1D
,
148 OPCODE_COPY_TEX_SUB_IMAGE2D
,
149 OPCODE_COPY_TEX_SUB_IMAGE3D
,
176 OPCODE_LOAD_IDENTITY
,
189 OPCODE_PIXEL_TRANSFER
,
192 OPCODE_POINT_PARAMETERS
,
194 OPCODE_POLYGON_STIPPLE
,
195 OPCODE_POLYGON_OFFSET
,
199 OPCODE_PRIORITIZE_TEXTURE
,
208 OPCODE_SELECT_TEXTURE_SGIS
,
209 OPCODE_SELECT_TEXTURE_COORD_SET
,
220 OPCODE_TEX_SUB_IMAGE1D
,
221 OPCODE_TEX_SUB_IMAGE2D
,
222 OPCODE_TEX_SUB_IMAGE3D
,
226 /* GL_ARB_multitexture */
227 OPCODE_ACTIVE_TEXTURE
,
228 OPCODE_CLIENT_ACTIVE_TEXTURE
,
229 /* The following three are meta instructions */
230 OPCODE_ERROR
, /* raise compiled-in error */
231 OPCODE_VERTEX_CASSETTE
, /* render prebuilt vertex buffer */
238 * Each instruction in the display list is stored as a sequence of
239 * contiguous nodes in memory.
240 * Each node is the union of a variety of datatypes.
254 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
259 /* Number of nodes of storage needed for each instruction: */
260 static GLuint InstSize
[ OPCODE_END_OF_LIST
+1 ];
262 void mesa_print_display_list( GLuint list
);
265 /**********************************************************************/
266 /***** Private *****/
267 /**********************************************************************/
271 * Allocate space for a display list instruction.
272 * Input: opcode - type of instruction
273 * argcount - number of arguments following the instruction
274 * Return: pointer to first node in the instruction
276 static Node
*alloc_instruction( GLcontext
*ctx
, OpCode opcode
, GLint argcount
)
279 GLuint count
= InstSize
[opcode
];
281 assert( (GLint
) count
== argcount
+1 );
283 if (ctx
->CurrentPos
+ count
+ 2 > BLOCK_SIZE
) {
284 /* This block is full. Allocate a new block and chain to it */
285 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
286 n
[0].opcode
= OPCODE_CONTINUE
;
287 newblock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
289 gl_error( ctx
, GL_OUT_OF_MEMORY
, "Building display list" );
292 n
[1].next
= (Node
*) newblock
;
293 ctx
->CurrentBlock
= newblock
;
297 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
298 ctx
->CurrentPos
+= count
;
300 n
[0].opcode
= opcode
;
308 * Make an empty display list. This is used by glGenLists() to
309 * reserver display list IDs.
311 static Node
*make_empty_list( void )
313 Node
*n
= (Node
*) MALLOC( sizeof(Node
) );
314 n
[0].opcode
= OPCODE_END_OF_LIST
;
321 * Destroy all nodes in a display list.
322 * Input: list - display list number
324 void gl_destroy_list( GLcontext
*ctx
, GLuint list
)
332 block
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
335 done
= block
? GL_FALSE
: GL_TRUE
;
337 switch (n
[0].opcode
) {
338 /* special cases first */
339 case OPCODE_VERTEX_CASSETTE
:
340 if ( ! -- ((struct immediate
*) n
[1].data
)->ref_count
)
341 gl_immediate_free( (struct immediate
*) n
[1].data
);
342 n
+= InstSize
[n
[0].opcode
];
346 n
+= InstSize
[n
[0].opcode
];
350 n
+= InstSize
[n
[0].opcode
];
352 case OPCODE_DRAW_PIXELS
:
354 n
+= InstSize
[n
[0].opcode
];
358 n
+= InstSize
[n
[0].opcode
];
360 case OPCODE_COLOR_TABLE
:
362 n
+= InstSize
[n
[0].opcode
];
364 case OPCODE_COLOR_SUB_TABLE
:
366 n
+= InstSize
[n
[0].opcode
];
368 case OPCODE_POLYGON_STIPPLE
:
370 n
+= InstSize
[n
[0].opcode
];
372 case OPCODE_TEX_IMAGE1D
:
374 n
+= InstSize
[n
[0].opcode
];
376 case OPCODE_TEX_IMAGE2D
:
378 n
+= InstSize
[n
[0].opcode
];
380 case OPCODE_TEX_IMAGE3D
:
382 n
+= InstSize
[n
[0].opcode
];
384 case OPCODE_TEX_SUB_IMAGE1D
:
386 n
+= InstSize
[n
[0].opcode
];
388 case OPCODE_TEX_SUB_IMAGE2D
:
390 n
+= InstSize
[n
[0].opcode
];
392 case OPCODE_TEX_SUB_IMAGE3D
:
394 n
+= InstSize
[n
[0].opcode
];
396 case OPCODE_CONTINUE
:
397 n
= (Node
*) n
[1].next
;
401 case OPCODE_END_OF_LIST
:
406 /* Most frequent case */
407 n
+= InstSize
[n
[0].opcode
];
412 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
418 * Translate the nth element of list from type to GLuint.
420 static GLuint
translate_id( GLsizei n
, GLenum type
, const GLvoid
*list
)
432 bptr
= (GLbyte
*) list
;
433 return (GLuint
) *(bptr
+n
);
434 case GL_UNSIGNED_BYTE
:
435 ubptr
= (GLubyte
*) list
;
436 return (GLuint
) *(ubptr
+n
);
438 sptr
= (GLshort
*) list
;
439 return (GLuint
) *(sptr
+n
);
440 case GL_UNSIGNED_SHORT
:
441 usptr
= (GLushort
*) list
;
442 return (GLuint
) *(usptr
+n
);
444 iptr
= (GLint
*) list
;
445 return (GLuint
) *(iptr
+n
);
446 case GL_UNSIGNED_INT
:
447 uiptr
= (GLuint
*) list
;
448 return (GLuint
) *(uiptr
+n
);
450 fptr
= (GLfloat
*) list
;
451 return (GLuint
) *(fptr
+n
);
453 ubptr
= ((GLubyte
*) list
) + 2*n
;
454 return (GLuint
) *ubptr
* 256 + (GLuint
) *(ubptr
+1);
456 ubptr
= ((GLubyte
*) list
) + 3*n
;
457 return (GLuint
) *ubptr
* 65536
458 + (GLuint
) *(ubptr
+1) * 256
459 + (GLuint
) *(ubptr
+2);
461 ubptr
= ((GLubyte
*) list
) + 4*n
;
462 return (GLuint
) *ubptr
* 16777216
463 + (GLuint
) *(ubptr
+1) * 65536
464 + (GLuint
) *(ubptr
+2) * 256
465 + (GLuint
) *(ubptr
+3);
474 /**********************************************************************/
476 /**********************************************************************/
478 void gl_init_lists( void )
480 static int init_flag
= 0;
483 InstSize
[OPCODE_ACCUM
] = 3;
484 InstSize
[OPCODE_ALPHA_FUNC
] = 3;
485 InstSize
[OPCODE_BIND_TEXTURE
] = 3;
486 InstSize
[OPCODE_BITMAP
] = 8;
487 InstSize
[OPCODE_BLEND_COLOR
] = 5;
488 InstSize
[OPCODE_BLEND_EQUATION
] = 2;
489 InstSize
[OPCODE_BLEND_FUNC
] = 3;
490 InstSize
[OPCODE_BLEND_FUNC_SEPARATE
] = 5;
491 InstSize
[OPCODE_CALL_LIST
] = 2;
492 InstSize
[OPCODE_CALL_LIST_OFFSET
] = 2;
493 InstSize
[OPCODE_CLEAR
] = 2;
494 InstSize
[OPCODE_CLEAR_ACCUM
] = 5;
495 InstSize
[OPCODE_CLEAR_COLOR
] = 5;
496 InstSize
[OPCODE_CLEAR_DEPTH
] = 2;
497 InstSize
[OPCODE_CLEAR_INDEX
] = 2;
498 InstSize
[OPCODE_CLEAR_STENCIL
] = 2;
499 InstSize
[OPCODE_CLIP_PLANE
] = 6;
500 InstSize
[OPCODE_COLOR_MASK
] = 5;
501 InstSize
[OPCODE_COLOR_MATERIAL
] = 3;
502 InstSize
[OPCODE_COLOR_TABLE
] = 7;
503 InstSize
[OPCODE_COLOR_SUB_TABLE
] = 7;
504 InstSize
[OPCODE_COPY_PIXELS
] = 6;
505 InstSize
[OPCODE_COPY_TEX_IMAGE1D
] = 8;
506 InstSize
[OPCODE_COPY_TEX_IMAGE2D
] = 9;
507 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE1D
] = 7;
508 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE2D
] = 9;
509 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE3D
] = 10;
510 InstSize
[OPCODE_CULL_FACE
] = 2;
511 InstSize
[OPCODE_DEPTH_FUNC
] = 2;
512 InstSize
[OPCODE_DEPTH_MASK
] = 2;
513 InstSize
[OPCODE_DEPTH_RANGE
] = 3;
514 InstSize
[OPCODE_DISABLE
] = 2;
515 InstSize
[OPCODE_DRAW_BUFFER
] = 2;
516 InstSize
[OPCODE_DRAW_PIXELS
] = 6;
517 InstSize
[OPCODE_ENABLE
] = 2;
518 InstSize
[OPCODE_EVALCOORD1
] = 2;
519 InstSize
[OPCODE_EVALCOORD2
] = 3;
520 InstSize
[OPCODE_EVALMESH1
] = 4;
521 InstSize
[OPCODE_EVALMESH2
] = 6;
522 InstSize
[OPCODE_EVALPOINT1
] = 2;
523 InstSize
[OPCODE_EVALPOINT2
] = 3;
524 InstSize
[OPCODE_FOG
] = 6;
525 InstSize
[OPCODE_FRONT_FACE
] = 2;
526 InstSize
[OPCODE_FRUSTUM
] = 7;
527 InstSize
[OPCODE_HINT
] = 3;
528 InstSize
[OPCODE_HINT_PGI
] = 3;
529 InstSize
[OPCODE_INDEX_MASK
] = 2;
530 InstSize
[OPCODE_INIT_NAMES
] = 1;
531 InstSize
[OPCODE_LIGHT
] = 7;
532 InstSize
[OPCODE_LIGHT_MODEL
] = 6;
533 InstSize
[OPCODE_LINE_STIPPLE
] = 3;
534 InstSize
[OPCODE_LINE_WIDTH
] = 2;
535 InstSize
[OPCODE_LIST_BASE
] = 2;
536 InstSize
[OPCODE_LOAD_IDENTITY
] = 1;
537 InstSize
[OPCODE_LOAD_MATRIX
] = 17;
538 InstSize
[OPCODE_LOAD_NAME
] = 2;
539 InstSize
[OPCODE_LOGIC_OP
] = 2;
540 InstSize
[OPCODE_MAP1
] = 7;
541 InstSize
[OPCODE_MAP2
] = 11;
542 InstSize
[OPCODE_MAPGRID1
] = 4;
543 InstSize
[OPCODE_MAPGRID2
] = 7;
544 InstSize
[OPCODE_MATRIX_MODE
] = 2;
545 InstSize
[OPCODE_MULT_MATRIX
] = 17;
546 InstSize
[OPCODE_ORTHO
] = 7;
547 InstSize
[OPCODE_PASSTHROUGH
] = 2;
548 InstSize
[OPCODE_PIXEL_MAP
] = 4;
549 InstSize
[OPCODE_PIXEL_TRANSFER
] = 3;
550 InstSize
[OPCODE_PIXEL_ZOOM
] = 3;
551 InstSize
[OPCODE_POINT_SIZE
] = 2;
552 InstSize
[OPCODE_POINT_PARAMETERS
] = 5;
553 InstSize
[OPCODE_POLYGON_MODE
] = 3;
554 InstSize
[OPCODE_POLYGON_STIPPLE
] = 2;
555 InstSize
[OPCODE_POLYGON_OFFSET
] = 3;
556 InstSize
[OPCODE_POP_ATTRIB
] = 1;
557 InstSize
[OPCODE_POP_MATRIX
] = 1;
558 InstSize
[OPCODE_POP_NAME
] = 1;
559 InstSize
[OPCODE_PRIORITIZE_TEXTURE
] = 3;
560 InstSize
[OPCODE_PUSH_ATTRIB
] = 2;
561 InstSize
[OPCODE_PUSH_MATRIX
] = 1;
562 InstSize
[OPCODE_PUSH_NAME
] = 2;
563 InstSize
[OPCODE_RASTER_POS
] = 5;
564 InstSize
[OPCODE_RECTF
] = 5;
565 InstSize
[OPCODE_READ_BUFFER
] = 2;
566 InstSize
[OPCODE_SCALE
] = 4;
567 InstSize
[OPCODE_SCISSOR
] = 5;
568 InstSize
[OPCODE_STENCIL_FUNC
] = 4;
569 InstSize
[OPCODE_STENCIL_MASK
] = 2;
570 InstSize
[OPCODE_STENCIL_OP
] = 4;
571 InstSize
[OPCODE_SHADE_MODEL
] = 2;
572 InstSize
[OPCODE_TEXENV
] = 7;
573 InstSize
[OPCODE_TEXGEN
] = 7;
574 InstSize
[OPCODE_TEXPARAMETER
] = 7;
575 InstSize
[OPCODE_TEX_IMAGE1D
] = 9;
576 InstSize
[OPCODE_TEX_IMAGE2D
] = 10;
577 InstSize
[OPCODE_TEX_IMAGE3D
] = 11;
578 InstSize
[OPCODE_TEX_SUB_IMAGE1D
] = 8;
579 InstSize
[OPCODE_TEX_SUB_IMAGE2D
] = 10;
580 InstSize
[OPCODE_TEX_SUB_IMAGE3D
] = 12;
581 InstSize
[OPCODE_TRANSLATE
] = 4;
582 InstSize
[OPCODE_VIEWPORT
] = 5;
583 InstSize
[OPCODE_WINDOW_POS
] = 5;
584 InstSize
[OPCODE_CONTINUE
] = 2;
585 InstSize
[OPCODE_ERROR
] = 3;
586 InstSize
[OPCODE_VERTEX_CASSETTE
] = 9;
587 InstSize
[OPCODE_END_OF_LIST
] = 1;
588 /* GL_ARB_multitexture */
589 InstSize
[OPCODE_ACTIVE_TEXTURE
] = 2;
590 InstSize
[OPCODE_CLIENT_ACTIVE_TEXTURE
] = 2;
597 * Display List compilation functions
602 static void save_Accum( GLenum op
, GLfloat value
)
604 GET_CURRENT_CONTEXT(ctx
);
606 FLUSH_VB(ctx
, "dlist");
607 n
= alloc_instruction( ctx
, OPCODE_ACCUM
, 2 );
612 if (ctx
->ExecuteFlag
) {
613 (*ctx
->Exec
.Accum
)( op
, value
);
618 static void save_AlphaFunc( GLenum func
, GLclampf ref
)
620 GET_CURRENT_CONTEXT(ctx
);
622 FLUSH_VB(ctx
, "dlist");
623 n
= alloc_instruction( ctx
, OPCODE_ALPHA_FUNC
, 2 );
626 n
[2].f
= (GLfloat
) ref
;
628 if (ctx
->ExecuteFlag
) {
629 (*ctx
->Exec
.AlphaFunc
)( func
, ref
);
634 static void save_Begin( GLenum mode
)
636 _mesa_Begin(mode
); /* special case */
640 static void save_BindTexture( GLenum target
, GLuint texture
)
642 GET_CURRENT_CONTEXT(ctx
);
644 FLUSH_VB(ctx
, "dlist");
645 n
= alloc_instruction( ctx
, OPCODE_BIND_TEXTURE
, 2 );
650 if (ctx
->ExecuteFlag
) {
651 (*ctx
->Exec
.BindTexture
)( target
, texture
);
656 static void save_Bitmap( GLsizei width
, GLsizei height
,
657 GLfloat xorig
, GLfloat yorig
,
658 GLfloat xmove
, GLfloat ymove
,
659 const GLubyte
*pixels
)
661 GET_CURRENT_CONTEXT(ctx
);
662 GLvoid
*image
= _mesa_unpack_bitmap( width
, height
, pixels
, &ctx
->Unpack
);
664 FLUSH_VB(ctx
, "dlist");
665 n
= alloc_instruction( ctx
, OPCODE_BITMAP
, 7 );
667 n
[1].i
= (GLint
) width
;
668 n
[2].i
= (GLint
) height
;
678 if (ctx
->ExecuteFlag
) {
679 (*ctx
->Exec
.Bitmap
)( width
, height
,
680 xorig
, yorig
, xmove
, ymove
, pixels
);
685 static void save_BlendEquation( GLenum mode
)
687 GET_CURRENT_CONTEXT(ctx
);
689 FLUSH_VB(ctx
, "dlist");
690 n
= alloc_instruction( ctx
, OPCODE_BLEND_EQUATION
, 1 );
694 if (ctx
->ExecuteFlag
) {
695 (*ctx
->Exec
.BlendEquationEXT
)( mode
);
700 static void save_BlendFunc( GLenum sfactor
, GLenum dfactor
)
702 GET_CURRENT_CONTEXT(ctx
);
704 FLUSH_VB(ctx
, "dlist");
705 n
= alloc_instruction( ctx
, OPCODE_BLEND_FUNC
, 2 );
710 if (ctx
->ExecuteFlag
) {
711 (*ctx
->Exec
.BlendFunc
)( sfactor
, dfactor
);
716 static void save_BlendFuncSeparateINGR(GLenum sfactorRGB
, GLenum dfactorRGB
,
717 GLenum sfactorA
, GLenum dfactorA
)
719 GET_CURRENT_CONTEXT(ctx
);
721 FLUSH_VB(ctx
, "dlist");
722 n
= alloc_instruction( ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4 );
729 if (ctx
->ExecuteFlag
) {
730 (*ctx
->Exec
.BlendFuncSeparateINGR
)( sfactorRGB
, dfactorRGB
,
736 static void save_BlendColor( GLfloat red
, GLfloat green
,
737 GLfloat blue
, GLfloat alpha
)
739 GET_CURRENT_CONTEXT(ctx
);
741 FLUSH_VB(ctx
, "dlist");
742 n
= alloc_instruction( ctx
, OPCODE_BLEND_COLOR
, 4 );
749 if (ctx
->ExecuteFlag
) {
750 (*ctx
->Exec
.BlendColorEXT
)( red
, green
, blue
, alpha
);
755 static void save_CallList( GLuint list
)
757 GET_CURRENT_CONTEXT(ctx
);
759 FLUSH_VB(ctx
, "dlist");
760 n
= alloc_instruction( ctx
, OPCODE_CALL_LIST
, 1 );
764 if (ctx
->ExecuteFlag
) {
765 (*ctx
->Exec
.CallList
)( list
);
770 static void save_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
772 GET_CURRENT_CONTEXT(ctx
);
774 FLUSH_VB(ctx
, "dlist");
777 GLuint list
= translate_id( i
, type
, lists
);
778 Node
*n
= alloc_instruction( ctx
, OPCODE_CALL_LIST_OFFSET
, 1 );
783 if (ctx
->ExecuteFlag
) {
784 (*ctx
->Exec
.CallLists
)( n
, type
, lists
);
789 static void save_Clear( GLbitfield mask
)
791 GET_CURRENT_CONTEXT(ctx
);
793 FLUSH_VB(ctx
, "dlist");
794 n
= alloc_instruction( ctx
, OPCODE_CLEAR
, 1 );
798 if (ctx
->ExecuteFlag
) {
799 (*ctx
->Exec
.Clear
)( mask
);
804 static void save_ClearAccum( GLfloat red
, GLfloat green
,
805 GLfloat blue
, GLfloat alpha
)
807 GET_CURRENT_CONTEXT(ctx
);
809 FLUSH_VB(ctx
, "dlist");
810 n
= alloc_instruction( ctx
, OPCODE_CLEAR_ACCUM
, 4 );
817 if (ctx
->ExecuteFlag
) {
818 (*ctx
->Exec
.ClearAccum
)( red
, green
, blue
, alpha
);
823 static void save_ClearColor( GLclampf red
, GLclampf green
,
824 GLclampf blue
, GLclampf alpha
)
826 GET_CURRENT_CONTEXT(ctx
);
828 FLUSH_VB(ctx
, "dlist");
829 n
= alloc_instruction( ctx
, OPCODE_CLEAR_COLOR
, 4 );
836 if (ctx
->ExecuteFlag
) {
837 (*ctx
->Exec
.ClearColor
)( red
, green
, blue
, alpha
);
842 static void save_ClearDepth( GLclampd depth
)
844 GET_CURRENT_CONTEXT(ctx
);
846 FLUSH_VB(ctx
, "dlist");
847 n
= alloc_instruction( ctx
, OPCODE_CLEAR_DEPTH
, 1 );
849 n
[1].f
= (GLfloat
) depth
;
851 if (ctx
->ExecuteFlag
) {
852 (*ctx
->Exec
.ClearDepth
)( depth
);
857 static void save_ClearIndex( GLfloat c
)
859 GET_CURRENT_CONTEXT(ctx
);
861 FLUSH_VB(ctx
, "dlist");
862 n
= alloc_instruction( ctx
, OPCODE_CLEAR_INDEX
, 1 );
866 if (ctx
->ExecuteFlag
) {
867 (*ctx
->Exec
.ClearIndex
)( c
);
872 static void save_ClearStencil( GLint s
)
874 GET_CURRENT_CONTEXT(ctx
);
876 FLUSH_VB(ctx
, "dlist");
877 n
= alloc_instruction( ctx
, OPCODE_CLEAR_STENCIL
, 1 );
881 if (ctx
->ExecuteFlag
) {
882 (*ctx
->Exec
.ClearStencil
)( s
);
887 static void save_ClipPlane( GLenum plane
, const GLdouble
*equ
)
889 GET_CURRENT_CONTEXT(ctx
);
891 FLUSH_VB(ctx
, "dlist");
892 n
= alloc_instruction( ctx
, OPCODE_CLIP_PLANE
, 5 );
900 if (ctx
->ExecuteFlag
) {
901 (*ctx
->Exec
.ClipPlane
)( plane
, equ
);
907 static void save_ColorMask( GLboolean red
, GLboolean green
,
908 GLboolean blue
, GLboolean alpha
)
910 GET_CURRENT_CONTEXT(ctx
);
912 FLUSH_VB(ctx
, "dlist");
913 n
= alloc_instruction( ctx
, OPCODE_COLOR_MASK
, 4 );
920 if (ctx
->ExecuteFlag
) {
921 (*ctx
->Exec
.ColorMask
)( red
, green
, blue
, alpha
);
926 static void save_ColorMaterial( GLenum face
, GLenum mode
)
928 GET_CURRENT_CONTEXT(ctx
);
930 FLUSH_VB(ctx
, "dlist");
931 n
= alloc_instruction( ctx
, OPCODE_COLOR_MATERIAL
, 2 );
936 if (ctx
->ExecuteFlag
) {
937 (*ctx
->Exec
.ColorMaterial
)( face
, mode
);
942 static void save_ColorTableEXT( GLenum target
, GLenum internalFormat
,
943 GLsizei width
, GLenum format
, GLenum type
,
944 const GLvoid
*table
)
946 GET_CURRENT_CONTEXT(ctx
);
947 if (target
== GL_PROXY_TEXTURE_1D
||
948 target
== GL_PROXY_TEXTURE_2D
||
949 target
== GL_PROXY_TEXTURE_3D
) {
950 /* execute immediately */
951 (*ctx
->Exec
.ColorTableEXT
)( target
, internalFormat
, width
,
952 format
, type
, table
);
955 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, table
,
958 FLUSH_VB(ctx
, "dlist");
959 n
= alloc_instruction( ctx
, OPCODE_COLOR_TABLE
, 6 );
962 n
[2].e
= internalFormat
;
971 if (ctx
->ExecuteFlag
) {
972 (*ctx
->Exec
.ColorTableEXT
)( target
, internalFormat
, width
,
973 format
, type
, table
);
979 static void save_ColorSubTableEXT( GLenum target
, GLsizei start
, GLsizei count
,
980 GLenum format
, GLenum type
,
983 GET_CURRENT_CONTEXT(ctx
);
984 GLvoid
*image
= _mesa_unpack_image(count
, 1, 1, format
, type
, table
,
987 FLUSH_VB(ctx
, "dlist");
988 n
= alloc_instruction( ctx
, OPCODE_COLOR_SUB_TABLE
, 6 );
1000 if (ctx
->ExecuteFlag
) {
1001 (*ctx
->Exec
.ColorSubTableEXT
)(target
, start
, count
, format
, type
, table
);
1007 static void save_CopyPixels( GLint x
, GLint y
,
1008 GLsizei width
, GLsizei height
, GLenum type
)
1010 GET_CURRENT_CONTEXT(ctx
);
1012 FLUSH_VB(ctx
, "dlist");
1013 n
= alloc_instruction( ctx
, OPCODE_COPY_PIXELS
, 5 );
1017 n
[3].i
= (GLint
) width
;
1018 n
[4].i
= (GLint
) height
;
1021 if (ctx
->ExecuteFlag
) {
1022 (*ctx
->Exec
.CopyPixels
)( x
, y
, width
, height
, type
);
1029 save_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
1030 GLint x
, GLint y
, GLsizei width
, GLint border
)
1032 GET_CURRENT_CONTEXT(ctx
);
1034 FLUSH_VB(ctx
, "dlist");
1035 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7 );
1039 n
[3].e
= internalformat
;
1045 if (ctx
->ExecuteFlag
) {
1046 (*ctx
->Exec
.CopyTexImage1D
)( target
, level
, internalformat
,
1047 x
, y
, width
, border
);
1053 save_CopyTexImage2D( GLenum target
, GLint level
,
1054 GLenum internalformat
,
1055 GLint x
, GLint y
, GLsizei width
,
1056 GLsizei height
, GLint border
)
1058 GET_CURRENT_CONTEXT(ctx
);
1060 FLUSH_VB(ctx
, "dlist");
1061 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8 );
1065 n
[3].e
= internalformat
;
1072 if (ctx
->ExecuteFlag
) {
1073 (*ctx
->Exec
.CopyTexImage2D
)( target
, level
, internalformat
,
1074 x
, y
, width
, height
, border
);
1081 save_CopyTexSubImage1D( GLenum target
, GLint level
,
1082 GLint xoffset
, GLint x
, GLint y
,
1085 GET_CURRENT_CONTEXT(ctx
);
1087 FLUSH_VB(ctx
, "dlist");
1088 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6 );
1097 if (ctx
->ExecuteFlag
) {
1098 (*ctx
->Exec
.CopyTexSubImage1D
)( target
, level
, xoffset
, x
, y
, width
);
1104 save_CopyTexSubImage2D( GLenum target
, GLint level
,
1105 GLint xoffset
, GLint yoffset
,
1107 GLsizei width
, GLint height
)
1109 GET_CURRENT_CONTEXT(ctx
);
1111 FLUSH_VB(ctx
, "dlist");
1112 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8 );
1123 if (ctx
->ExecuteFlag
) {
1124 (*ctx
->Exec
.CopyTexSubImage2D
)( target
, level
, xoffset
, yoffset
,
1125 x
, y
, width
, height
);
1131 save_CopyTexSubImage3D( GLenum target
, GLint level
,
1132 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1134 GLsizei width
, GLint height
)
1136 GET_CURRENT_CONTEXT(ctx
);
1138 FLUSH_VB(ctx
, "dlist");
1139 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9 );
1151 if (ctx
->ExecuteFlag
) {
1152 (*ctx
->Exec
.CopyTexSubImage3D
)( target
, level
,
1153 xoffset
, yoffset
, zoffset
,
1154 x
, y
, width
, height
);
1159 static void save_CullFace( GLenum mode
)
1161 GET_CURRENT_CONTEXT(ctx
);
1163 FLUSH_VB(ctx
, "dlist");
1164 n
= alloc_instruction( ctx
, OPCODE_CULL_FACE
, 1 );
1168 if (ctx
->ExecuteFlag
) {
1169 (*ctx
->Exec
.CullFace
)( mode
);
1174 static void save_DepthFunc( GLenum func
)
1176 GET_CURRENT_CONTEXT(ctx
);
1178 FLUSH_VB(ctx
, "dlist");
1179 n
= alloc_instruction( ctx
, OPCODE_DEPTH_FUNC
, 1 );
1183 if (ctx
->ExecuteFlag
) {
1184 (*ctx
->Exec
.DepthFunc
)( func
);
1189 static void save_DepthMask( GLboolean mask
)
1191 GET_CURRENT_CONTEXT(ctx
);
1193 FLUSH_VB(ctx
, "dlist");
1194 n
= alloc_instruction( ctx
, OPCODE_DEPTH_MASK
, 1 );
1198 if (ctx
->ExecuteFlag
) {
1199 (*ctx
->Exec
.DepthMask
)( mask
);
1204 static void save_DepthRange( GLclampd nearval
, GLclampd farval
)
1206 GET_CURRENT_CONTEXT(ctx
);
1208 FLUSH_VB(ctx
, "dlist");
1209 n
= alloc_instruction( ctx
, OPCODE_DEPTH_RANGE
, 2 );
1211 n
[1].f
= (GLfloat
) nearval
;
1212 n
[2].f
= (GLfloat
) farval
;
1214 if (ctx
->ExecuteFlag
) {
1215 (*ctx
->Exec
.DepthRange
)( nearval
, farval
);
1220 static void save_Disable( GLenum cap
)
1222 GET_CURRENT_CONTEXT(ctx
);
1224 FLUSH_VB(ctx
, "dlist");
1225 n
= alloc_instruction( ctx
, OPCODE_DISABLE
, 1 );
1229 if (ctx
->ExecuteFlag
) {
1230 (*ctx
->Exec
.Disable
)( cap
);
1235 static void save_DrawBuffer( GLenum mode
)
1237 GET_CURRENT_CONTEXT(ctx
);
1239 FLUSH_VB(ctx
, "dlist");
1240 n
= alloc_instruction( ctx
, OPCODE_DRAW_BUFFER
, 1 );
1244 if (ctx
->ExecuteFlag
) {
1245 (*ctx
->Exec
.DrawBuffer
)( mode
);
1250 static void save_DrawPixels( GLsizei width
, GLsizei height
,
1251 GLenum format
, GLenum type
,
1252 const GLvoid
*pixels
)
1254 GET_CURRENT_CONTEXT(ctx
);
1255 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
1256 pixels
, &ctx
->Unpack
);
1258 FLUSH_VB(ctx
, "dlist");
1259 n
= alloc_instruction( ctx
, OPCODE_DRAW_PIXELS
, 5 );
1270 if (ctx
->ExecuteFlag
) {
1271 (*ctx
->Exec
.DrawPixels
)( width
, height
, format
, type
, pixels
);
1277 static void save_Enable( GLenum cap
)
1279 GET_CURRENT_CONTEXT(ctx
);
1281 FLUSH_VB(ctx
, "dlist");
1282 n
= alloc_instruction( ctx
, OPCODE_ENABLE
, 1 );
1286 if (ctx
->ExecuteFlag
) {
1287 (*ctx
->Exec
.Enable
)( cap
);
1293 static void save_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
1295 GET_CURRENT_CONTEXT(ctx
);
1297 FLUSH_VB(ctx
, "dlist");
1298 n
= alloc_instruction( ctx
, OPCODE_EVALMESH1
, 3 );
1304 if (ctx
->ExecuteFlag
) {
1305 (*ctx
->Exec
.EvalMesh1
)( mode
, i1
, i2
);
1310 static void save_EvalMesh2(
1311 GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1313 GET_CURRENT_CONTEXT(ctx
);
1315 FLUSH_VB(ctx
, "dlist");
1316 n
= alloc_instruction( ctx
, OPCODE_EVALMESH2
, 5 );
1324 if (ctx
->ExecuteFlag
) {
1325 (*ctx
->Exec
.EvalMesh2
)( mode
, i1
, i2
, j1
, j2
);
1332 static void save_Fogfv( GLenum pname
, const GLfloat
*params
)
1334 GET_CURRENT_CONTEXT(ctx
);
1336 FLUSH_VB(ctx
, "dlist");
1337 n
= alloc_instruction( ctx
, OPCODE_FOG
, 5 );
1345 if (ctx
->ExecuteFlag
) {
1346 (*ctx
->Exec
.Fogfv
)( pname
, params
);
1351 static void save_Fogf( GLenum pname
, GLfloat param
)
1353 save_Fogfv(pname
, ¶m
);
1357 static void save_Fogiv(GLenum pname
, const GLint
*params
)
1362 case GL_FOG_DENSITY
:
1366 p
[0] = (GLfloat
) *params
;
1369 p
[0] = INT_TO_FLOAT( params
[0] );
1370 p
[1] = INT_TO_FLOAT( params
[1] );
1371 p
[2] = INT_TO_FLOAT( params
[2] );
1372 p
[3] = INT_TO_FLOAT( params
[3] );
1375 /* Error will be caught later in gl_Fogfv */
1378 save_Fogfv(pname
, p
);
1382 static void save_Fogi(GLenum pname
, GLint param
)
1384 save_Fogiv(pname
, ¶m
);
1388 static void save_FrontFace( GLenum mode
)
1390 GET_CURRENT_CONTEXT(ctx
);
1392 FLUSH_VB(ctx
, "dlist");
1393 n
= alloc_instruction( ctx
, OPCODE_FRONT_FACE
, 1 );
1397 if (ctx
->ExecuteFlag
) {
1398 (*ctx
->Exec
.FrontFace
)( mode
);
1403 static void save_Frustum( GLdouble left
, GLdouble right
,
1404 GLdouble bottom
, GLdouble top
,
1405 GLdouble nearval
, GLdouble farval
)
1407 GET_CURRENT_CONTEXT(ctx
);
1409 FLUSH_VB(ctx
, "dlist");
1410 n
= alloc_instruction( ctx
, OPCODE_FRUSTUM
, 6 );
1419 if (ctx
->ExecuteFlag
) {
1420 (*ctx
->Exec
.Frustum
)( left
, right
, bottom
, top
, nearval
, farval
);
1425 static void save_Hint( GLenum target
, GLenum mode
)
1427 GET_CURRENT_CONTEXT(ctx
);
1429 FLUSH_VB(ctx
, "dlist");
1430 n
= alloc_instruction( ctx
, OPCODE_HINT
, 2 );
1435 if (ctx
->ExecuteFlag
) {
1436 (*ctx
->Exec
.Hint
)( target
, mode
);
1441 /* GL_PGI_misc_hints*/
1442 static void save_HintPGI( GLenum target
, GLint mode
)
1444 GET_CURRENT_CONTEXT(ctx
);
1446 FLUSH_VB(ctx
, "dlist");
1447 n
= alloc_instruction( ctx
, OPCODE_HINT_PGI
, 2 );
1452 if (ctx
->ExecuteFlag
) {
1453 (*ctx
->Exec
.HintPGI
)( target
, mode
);
1458 static void save_IndexMask( GLuint mask
)
1460 GET_CURRENT_CONTEXT(ctx
);
1462 FLUSH_VB(ctx
, "dlist");
1463 n
= alloc_instruction( ctx
, OPCODE_INDEX_MASK
, 1 );
1467 if (ctx
->ExecuteFlag
) {
1468 (*ctx
->Exec
.IndexMask
)( mask
);
1473 static void save_InitNames( void )
1475 GET_CURRENT_CONTEXT(ctx
);
1476 FLUSH_VB(ctx
, "dlist");
1477 (void) alloc_instruction( ctx
, OPCODE_INIT_NAMES
, 0 );
1478 if (ctx
->ExecuteFlag
) {
1479 (*ctx
->Exec
.InitNames
)();
1484 static void save_Lightfv( GLenum light
, GLenum pname
, const GLfloat
*params
)
1486 GET_CURRENT_CONTEXT(ctx
);
1488 FLUSH_VB(ctx
, "dlist");
1489 n
= alloc_instruction( ctx
, OPCODE_LIGHT
, 6 );
1507 case GL_SPOT_DIRECTION
:
1510 case GL_SPOT_EXPONENT
:
1513 case GL_SPOT_CUTOFF
:
1516 case GL_CONSTANT_ATTENUATION
:
1519 case GL_LINEAR_ATTENUATION
:
1522 case GL_QUADRATIC_ATTENUATION
:
1528 for (i
= 0; i
< nParams
; i
++) {
1529 n
[3+i
].f
= params
[i
];
1532 if (ctx
->ExecuteFlag
) {
1533 (*ctx
->Exec
.Lightfv
)( light
, pname
, params
);
1538 static void save_Lightf( GLenum light
, GLenum pname
, GLfloat params
)
1540 save_Lightfv(light
, pname
, ¶ms
);
1544 static void save_Lightiv( GLenum light
, GLenum pname
, const GLint
*params
)
1551 fparam
[0] = INT_TO_FLOAT( params
[0] );
1552 fparam
[1] = INT_TO_FLOAT( params
[1] );
1553 fparam
[2] = INT_TO_FLOAT( params
[2] );
1554 fparam
[3] = INT_TO_FLOAT( params
[3] );
1557 fparam
[0] = (GLfloat
) params
[0];
1558 fparam
[1] = (GLfloat
) params
[1];
1559 fparam
[2] = (GLfloat
) params
[2];
1560 fparam
[3] = (GLfloat
) params
[3];
1562 case GL_SPOT_DIRECTION
:
1563 fparam
[0] = (GLfloat
) params
[0];
1564 fparam
[1] = (GLfloat
) params
[1];
1565 fparam
[2] = (GLfloat
) params
[2];
1567 case GL_SPOT_EXPONENT
:
1568 case GL_SPOT_CUTOFF
:
1569 case GL_CONSTANT_ATTENUATION
:
1570 case GL_LINEAR_ATTENUATION
:
1571 case GL_QUADRATIC_ATTENUATION
:
1572 fparam
[0] = (GLfloat
) params
[0];
1575 /* error will be caught later in gl_Lightfv */
1578 save_Lightfv( light
, pname
, fparam
);
1582 static void save_Lighti( GLenum light
, GLenum pname
, GLint param
)
1584 save_Lightiv( light
, pname
, ¶m
);
1588 static void save_LightModelfv( GLenum pname
, const GLfloat
*params
)
1590 GET_CURRENT_CONTEXT(ctx
);
1592 FLUSH_VB(ctx
, "dlist");
1593 n
= alloc_instruction( ctx
, OPCODE_LIGHT_MODEL
, 5 );
1601 if (ctx
->ExecuteFlag
) {
1602 (*ctx
->Exec
.LightModelfv
)( pname
, params
);
1607 static void save_LightModelf( GLenum pname
, GLfloat param
)
1609 save_LightModelfv(pname
, ¶m
);
1613 static void save_LightModeliv( GLenum pname
, const GLint
*params
)
1617 case GL_LIGHT_MODEL_AMBIENT
:
1618 fparam
[0] = INT_TO_FLOAT( params
[0] );
1619 fparam
[1] = INT_TO_FLOAT( params
[1] );
1620 fparam
[2] = INT_TO_FLOAT( params
[2] );
1621 fparam
[3] = INT_TO_FLOAT( params
[3] );
1623 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
1624 case GL_LIGHT_MODEL_TWO_SIDE
:
1625 case GL_LIGHT_MODEL_COLOR_CONTROL
:
1626 fparam
[0] = (GLfloat
) params
[0];
1629 /* Error will be caught later in gl_LightModelfv */
1632 save_LightModelfv(pname
, fparam
);
1636 static void save_LightModeli( GLenum pname
, GLint param
)
1638 save_LightModeliv(pname
, ¶m
);
1642 static void save_LineStipple( GLint factor
, GLushort pattern
)
1644 GET_CURRENT_CONTEXT(ctx
);
1646 FLUSH_VB(ctx
, "dlist");
1647 n
= alloc_instruction( ctx
, OPCODE_LINE_STIPPLE
, 2 );
1652 if (ctx
->ExecuteFlag
) {
1653 (*ctx
->Exec
.LineStipple
)( factor
, pattern
);
1658 static void save_LineWidth( GLfloat width
)
1660 GET_CURRENT_CONTEXT(ctx
);
1662 FLUSH_VB(ctx
, "dlist");
1663 n
= alloc_instruction( ctx
, OPCODE_LINE_WIDTH
, 1 );
1667 if (ctx
->ExecuteFlag
) {
1668 (*ctx
->Exec
.LineWidth
)( width
);
1673 static void save_ListBase( GLuint base
)
1675 GET_CURRENT_CONTEXT(ctx
);
1677 FLUSH_VB(ctx
, "dlist");
1678 n
= alloc_instruction( ctx
, OPCODE_LIST_BASE
, 1 );
1682 if (ctx
->ExecuteFlag
) {
1683 (*ctx
->Exec
.ListBase
)( base
);
1688 static void save_LoadIdentity( void )
1690 GET_CURRENT_CONTEXT(ctx
);
1691 FLUSH_VB(ctx
, "dlist");
1692 (void) alloc_instruction( ctx
, OPCODE_LOAD_IDENTITY
, 0 );
1693 if (ctx
->ExecuteFlag
) {
1694 (*ctx
->Exec
.LoadIdentity
)();
1699 static void save_LoadMatrixf( const GLfloat
*m
)
1701 GET_CURRENT_CONTEXT(ctx
);
1703 FLUSH_VB(ctx
, "dlist");
1704 n
= alloc_instruction( ctx
, OPCODE_LOAD_MATRIX
, 16 );
1707 for (i
=0;i
<16;i
++) {
1711 if (ctx
->ExecuteFlag
) {
1712 (*ctx
->Exec
.LoadMatrixf
)( m
);
1717 static void save_LoadMatrixd( const GLdouble
*m
)
1721 for (i
= 0; i
< 16; i
++) {
1724 save_LoadMatrixf(f
);
1728 static void save_LoadName( GLuint name
)
1730 GET_CURRENT_CONTEXT(ctx
);
1732 FLUSH_VB(ctx
, "dlist");
1733 n
= alloc_instruction( ctx
, OPCODE_LOAD_NAME
, 1 );
1737 if (ctx
->ExecuteFlag
) {
1738 (*ctx
->Exec
.LoadName
)( name
);
1743 static void save_LogicOp( GLenum opcode
)
1745 GET_CURRENT_CONTEXT(ctx
);
1747 FLUSH_VB(ctx
, "dlist");
1748 n
= alloc_instruction( ctx
, OPCODE_LOGIC_OP
, 1 );
1752 if (ctx
->ExecuteFlag
) {
1753 (*ctx
->Exec
.LogicOp
)( opcode
);
1758 static void save_Map1d( GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
1759 GLint order
, const GLdouble
*points
)
1761 GET_CURRENT_CONTEXT(ctx
);
1763 FLUSH_VB(ctx
, "dlist");
1764 n
= alloc_instruction( ctx
, OPCODE_MAP1
, 6 );
1766 GLfloat
*pnts
= gl_copy_map_points1d( target
, stride
, order
, points
);
1770 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
1772 n
[6].data
= (void *) pnts
;
1774 if (ctx
->ExecuteFlag
) {
1775 (*ctx
->Exec
.Map1d
)( target
, u1
, u2
, stride
, order
, points
);
1779 static void save_Map1f( GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
1780 GLint order
, const GLfloat
*points
)
1782 GET_CURRENT_CONTEXT(ctx
);
1784 FLUSH_VB(ctx
, "dlist");
1785 n
= alloc_instruction( ctx
, OPCODE_MAP1
, 6 );
1787 GLfloat
*pnts
= gl_copy_map_points1f( target
, stride
, order
, points
);
1791 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
1793 n
[6].data
= (void *) pnts
;
1795 if (ctx
->ExecuteFlag
) {
1796 (*ctx
->Exec
.Map1f
)( target
, u1
, u2
, stride
, order
, points
);
1801 static void save_Map2d( GLenum target
,
1802 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
1803 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
1804 const GLdouble
*points
)
1806 GET_CURRENT_CONTEXT(ctx
);
1808 FLUSH_VB(ctx
, "dlist");
1809 n
= alloc_instruction( ctx
, OPCODE_MAP2
, 10 );
1811 GLfloat
*pnts
= gl_copy_map_points2d( target
, ustride
, uorder
,
1812 vstride
, vorder
, points
);
1818 /* XXX verify these strides are correct */
1819 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
1820 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
1823 n
[10].data
= (void *) pnts
;
1825 if (ctx
->ExecuteFlag
) {
1826 (*ctx
->Exec
.Map2d
)( target
,
1827 u1
, u2
, ustride
, uorder
,
1828 v1
, v2
, vstride
, vorder
, points
);
1833 static void save_Map2f( GLenum target
,
1834 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
1835 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
1836 const GLfloat
*points
)
1838 GET_CURRENT_CONTEXT(ctx
);
1840 FLUSH_VB(ctx
, "dlist");
1841 n
= alloc_instruction( ctx
, OPCODE_MAP2
, 10 );
1843 GLfloat
*pnts
= gl_copy_map_points2f( target
, ustride
, uorder
,
1844 vstride
, vorder
, points
);
1850 /* XXX verify these strides are correct */
1851 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
1852 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
1855 n
[10].data
= (void *) pnts
;
1857 if (ctx
->ExecuteFlag
) {
1858 (*ctx
->Exec
.Map2f
)( target
, u1
, u2
, ustride
, uorder
,
1859 v1
, v2
, vstride
, vorder
, points
);
1864 static void save_MapGrid1f( GLint un
, GLfloat u1
, GLfloat u2
)
1866 GET_CURRENT_CONTEXT(ctx
);
1868 FLUSH_VB(ctx
, "dlist");
1869 n
= alloc_instruction( ctx
, OPCODE_MAPGRID1
, 3 );
1875 if (ctx
->ExecuteFlag
) {
1876 (*ctx
->Exec
.MapGrid1f
)( un
, u1
, u2
);
1881 static void save_MapGrid1d( GLint un
, GLdouble u1
, GLdouble u2
)
1883 save_MapGrid1f(un
, u1
, u2
);
1887 static void save_MapGrid2f( GLint un
, GLfloat u1
, GLfloat u2
,
1888 GLint vn
, GLfloat v1
, GLfloat v2
)
1890 GET_CURRENT_CONTEXT(ctx
);
1892 FLUSH_VB(ctx
, "dlist");
1893 n
= alloc_instruction( ctx
, OPCODE_MAPGRID2
, 6 );
1902 if (ctx
->ExecuteFlag
) {
1903 (*ctx
->Exec
.MapGrid2f
)( un
, u1
, u2
, vn
, v1
, v2
);
1909 static void save_MapGrid2d( GLint un
, GLdouble u1
, GLdouble u2
,
1910 GLint vn
, GLdouble v1
, GLdouble v2
)
1912 save_MapGrid2f(un
, u1
, u2
, vn
, v1
, v2
);
1916 static void save_MatrixMode( GLenum mode
)
1918 GET_CURRENT_CONTEXT(ctx
);
1920 FLUSH_VB(ctx
, "dlist");
1921 n
= alloc_instruction( ctx
, OPCODE_MATRIX_MODE
, 1 );
1925 if (ctx
->ExecuteFlag
) {
1926 (*ctx
->Exec
.MatrixMode
)( mode
);
1931 static void save_MultMatrixf( const GLfloat
*m
)
1933 GET_CURRENT_CONTEXT(ctx
);
1935 FLUSH_VB(ctx
, "dlist");
1936 n
= alloc_instruction( ctx
, OPCODE_MULT_MATRIX
, 16 );
1939 for (i
=0;i
<16;i
++) {
1943 if (ctx
->ExecuteFlag
) {
1944 (*ctx
->Exec
.MultMatrixf
)( m
);
1949 static void save_MultMatrixd( const GLdouble
*m
)
1953 for (i
= 0; i
< 16; i
++) {
1956 save_MultMatrixf(f
);
1960 static void save_NewList( GLuint list
, GLenum mode
)
1962 GET_CURRENT_CONTEXT(ctx
);
1963 /* It's an error to call this function while building a display list */
1964 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
1971 static void save_Ortho( GLdouble left
, GLdouble right
,
1972 GLdouble bottom
, GLdouble top
,
1973 GLdouble nearval
, GLdouble farval
)
1975 GET_CURRENT_CONTEXT(ctx
);
1977 FLUSH_VB(ctx
, "dlist");
1978 n
= alloc_instruction( ctx
, OPCODE_ORTHO
, 6 );
1987 if (ctx
->ExecuteFlag
) {
1988 (*ctx
->Exec
.Ortho
)( left
, right
, bottom
, top
, nearval
, farval
);
1993 static void save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
1995 GET_CURRENT_CONTEXT(ctx
);
1997 FLUSH_VB(ctx
, "dlist");
1998 n
= alloc_instruction( ctx
, OPCODE_PIXEL_MAP
, 3 );
2002 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
2003 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
2005 if (ctx
->ExecuteFlag
) {
2006 (*ctx
->Exec
.PixelMapfv
)( map
, mapsize
, values
);
2011 static void save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2013 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2015 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2016 for (i
=0;i
<mapsize
;i
++) {
2017 fvalues
[i
] = (GLfloat
) values
[i
];
2021 for (i
=0;i
<mapsize
;i
++) {
2022 fvalues
[i
] = UINT_TO_FLOAT( values
[i
] );
2025 save_PixelMapfv(map
, mapsize
, fvalues
);
2029 static void save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2031 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2033 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2034 for (i
=0;i
<mapsize
;i
++) {
2035 fvalues
[i
] = (GLfloat
) values
[i
];
2039 for (i
=0;i
<mapsize
;i
++) {
2040 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2043 save_PixelMapfv(map
, mapsize
, fvalues
);
2047 static void save_PixelTransferf( GLenum pname
, GLfloat param
)
2049 GET_CURRENT_CONTEXT(ctx
);
2051 FLUSH_VB(ctx
, "dlist");
2052 n
= alloc_instruction( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2057 if (ctx
->ExecuteFlag
) {
2058 (*ctx
->Exec
.PixelTransferf
)( pname
, param
);
2063 static void save_PixelTransferi( GLenum pname
, GLint param
)
2065 save_PixelTransferf( pname
, (GLfloat
) param
);
2069 static void save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2071 GET_CURRENT_CONTEXT(ctx
);
2073 FLUSH_VB(ctx
, "dlist");
2074 n
= alloc_instruction( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2079 if (ctx
->ExecuteFlag
) {
2080 (*ctx
->Exec
.PixelZoom
)( xfactor
, yfactor
);
2085 static void save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2087 GET_CURRENT_CONTEXT(ctx
);
2089 FLUSH_VB(ctx
, "dlist");
2090 n
= alloc_instruction( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2097 if (ctx
->ExecuteFlag
) {
2098 (*ctx
->Exec
.PointParameterfvEXT
)( pname
, params
);
2103 static void save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2105 save_PointParameterfvEXT(pname
, ¶m
);
2109 static void save_PointSize( GLfloat size
)
2111 GET_CURRENT_CONTEXT(ctx
);
2113 FLUSH_VB(ctx
, "dlist");
2114 n
= alloc_instruction( ctx
, OPCODE_POINT_SIZE
, 1 );
2118 if (ctx
->ExecuteFlag
) {
2119 (*ctx
->Exec
.PointSize
)( size
);
2124 static void save_PolygonMode( GLenum face
, GLenum mode
)
2126 GET_CURRENT_CONTEXT(ctx
);
2128 FLUSH_VB(ctx
, "dlist");
2129 n
= alloc_instruction( ctx
, OPCODE_POLYGON_MODE
, 2 );
2134 if (ctx
->ExecuteFlag
) {
2135 (*ctx
->Exec
.PolygonMode
)( face
, mode
);
2141 * Polygon stipple must have been upacked already!
2143 static void save_PolygonStipple( const GLubyte
*pattern
)
2145 GET_CURRENT_CONTEXT(ctx
);
2147 FLUSH_VB(ctx
, "dlist");
2148 n
= alloc_instruction( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2151 n
[1].data
= MALLOC( 32 * 4 );
2152 data
= n
[1].data
; /* This needed for Acorn compiler */
2153 MEMCPY( data
, pattern
, 32 * 4 );
2155 if (ctx
->ExecuteFlag
) {
2156 (*ctx
->Exec
.PolygonStipple
)( (GLubyte
*) pattern
);
2161 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2163 GET_CURRENT_CONTEXT(ctx
);
2165 FLUSH_VB(ctx
, "dlist");
2166 n
= alloc_instruction( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2171 if (ctx
->ExecuteFlag
) {
2172 (*ctx
->Exec
.PolygonOffset
)( factor
, units
);
2177 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2179 save_PolygonOffset(factor
, DEPTH_SCALE
* bias
);
2183 static void save_PopAttrib( void )
2185 GET_CURRENT_CONTEXT(ctx
);
2186 FLUSH_VB(ctx
, "dlist");
2187 (void) alloc_instruction( ctx
, OPCODE_POP_ATTRIB
, 0 );
2188 if (ctx
->ExecuteFlag
) {
2189 (*ctx
->Exec
.PopAttrib
)();
2194 static void save_PopMatrix( void )
2196 GET_CURRENT_CONTEXT(ctx
);
2197 FLUSH_VB(ctx
, "dlist");
2198 (void) alloc_instruction( ctx
, OPCODE_POP_MATRIX
, 0 );
2199 if (ctx
->ExecuteFlag
) {
2200 (*ctx
->Exec
.PopMatrix
)();
2205 static void save_PopName( void )
2207 GET_CURRENT_CONTEXT(ctx
);
2208 FLUSH_VB(ctx
, "dlist");
2209 (void) alloc_instruction( ctx
, OPCODE_POP_NAME
, 0 );
2210 if (ctx
->ExecuteFlag
) {
2211 (*ctx
->Exec
.PopName
)();
2216 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2217 const GLclampf
*priorities
)
2219 GET_CURRENT_CONTEXT(ctx
);
2221 FLUSH_VB(ctx
, "dlist");
2223 for (i
=0;i
<num
;i
++) {
2225 n
= alloc_instruction( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2227 n
[1].ui
= textures
[i
];
2228 n
[2].f
= priorities
[i
];
2231 if (ctx
->ExecuteFlag
) {
2232 (*ctx
->Exec
.PrioritizeTextures
)( num
, textures
, priorities
);
2237 static void save_PushAttrib( GLbitfield mask
)
2239 GET_CURRENT_CONTEXT(ctx
);
2241 FLUSH_VB(ctx
, "dlist");
2242 n
= alloc_instruction( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2246 if (ctx
->ExecuteFlag
) {
2247 (*ctx
->Exec
.PushAttrib
)( mask
);
2252 static void save_PushMatrix( void )
2254 GET_CURRENT_CONTEXT(ctx
);
2255 FLUSH_VB(ctx
, "dlist");
2256 (void) alloc_instruction( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2257 if (ctx
->ExecuteFlag
) {
2258 (*ctx
->Exec
.PushMatrix
)();
2263 static void save_PushName( GLuint name
)
2265 GET_CURRENT_CONTEXT(ctx
);
2267 FLUSH_VB(ctx
, "dlist");
2268 n
= alloc_instruction( ctx
, OPCODE_PUSH_NAME
, 1 );
2272 if (ctx
->ExecuteFlag
) {
2273 (*ctx
->Exec
.PushName
)( name
);
2278 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2280 GET_CURRENT_CONTEXT(ctx
);
2282 FLUSH_VB(ctx
, "dlist");
2283 n
= alloc_instruction( ctx
, OPCODE_RASTER_POS
, 4 );
2290 if (ctx
->ExecuteFlag
) {
2291 (*ctx
->Exec
.RasterPos4f
)( x
, y
, z
, w
);
2295 static void save_RasterPos2d(GLdouble x
, GLdouble y
)
2297 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2300 static void save_RasterPos2f(GLfloat x
, GLfloat y
)
2302 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2305 static void save_RasterPos2i(GLint x
, GLint y
)
2307 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2310 static void save_RasterPos2s(GLshort x
, GLshort y
)
2312 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2315 static void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2317 save_RasterPos4f(x
, y
, z
, 1.0F
);
2320 static void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2322 save_RasterPos4f(x
, y
, z
, 1.0F
);
2325 static void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2327 save_RasterPos4f(x
, y
, z
, 1.0F
);
2330 static void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2332 save_RasterPos4f(x
, y
, z
, 1.0F
);
2335 static void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2337 save_RasterPos4f(x
, y
, z
, w
);
2340 static void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2342 save_RasterPos4f(x
, y
, z
, w
);
2345 static void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2347 save_RasterPos4f(x
, y
, z
, w
);
2350 static void save_RasterPos2dv(const GLdouble
*v
)
2352 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2355 static void save_RasterPos2fv(const GLfloat
*v
)
2357 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2360 static void save_RasterPos2iv(const GLint
*v
)
2362 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2365 static void save_RasterPos2sv(const GLshort
*v
)
2367 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2370 static void save_RasterPos3dv(const GLdouble
*v
)
2372 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2375 static void save_RasterPos3fv(const GLfloat
*v
)
2377 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2380 static void save_RasterPos3iv(const GLint
*v
)
2382 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2385 static void save_RasterPos3sv(const GLshort
*v
)
2387 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2390 static void save_RasterPos4dv(const GLdouble
*v
)
2392 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2395 static void save_RasterPos4fv(const GLfloat
*v
)
2397 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2400 static void save_RasterPos4iv(const GLint
*v
)
2402 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2405 static void save_RasterPos4sv(const GLshort
*v
)
2407 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2411 static void save_PassThrough( GLfloat token
)
2413 GET_CURRENT_CONTEXT(ctx
);
2415 FLUSH_VB(ctx
, "dlist");
2416 n
= alloc_instruction( ctx
, OPCODE_PASSTHROUGH
, 1 );
2420 if (ctx
->ExecuteFlag
) {
2421 (*ctx
->Exec
.PassThrough
)( token
);
2426 static void save_ReadBuffer( GLenum mode
)
2428 GET_CURRENT_CONTEXT(ctx
);
2430 FLUSH_VB(ctx
, "dlist");
2431 n
= alloc_instruction( ctx
, OPCODE_READ_BUFFER
, 1 );
2435 if (ctx
->ExecuteFlag
) {
2436 (*ctx
->Exec
.ReadBuffer
)( mode
);
2441 static void save_Rectf( GLfloat x1
, GLfloat y1
, GLfloat x2
, GLfloat y2
)
2443 GET_CURRENT_CONTEXT(ctx
);
2445 FLUSH_VB(ctx
, "dlist");
2446 n
= alloc_instruction( ctx
, OPCODE_RECTF
, 4 );
2453 if (ctx
->ExecuteFlag
) {
2454 (*ctx
->Exec
.Rectf
)( x1
, y1
, x2
, y2
);
2458 static void save_Rectd(GLdouble x1
, GLdouble y1
, GLdouble x2
, GLdouble y2
)
2460 save_Rectf(x1
, y1
, x2
, y2
);
2463 static void save_Rectdv(const GLdouble
*v1
, const GLdouble
*v2
)
2465 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2468 static void save_Rectfv( const GLfloat
*v1
, const GLfloat
*v2
)
2470 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2473 static void save_Recti(GLint x1
, GLint y1
, GLint x2
, GLint y2
)
2475 save_Rectf(x1
, y1
, x2
, y2
);
2478 static void save_Rectiv(const GLint
*v1
, const GLint
*v2
)
2480 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2483 static void save_Rects(GLshort x1
, GLshort y1
, GLshort x2
, GLshort y2
)
2485 save_Rectf(x1
, y1
, x2
, y2
);
2488 static void save_Rectsv(const GLshort
*v1
, const GLshort
*v2
)
2490 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2494 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2497 gl_rotation_matrix( angle
, x
, y
, z
, m
);
2498 save_MultMatrixf( m
); /* save and maybe execute */
2502 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2504 save_Rotatef(angle
, x
, y
, z
);
2508 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2510 GET_CURRENT_CONTEXT(ctx
);
2512 FLUSH_VB(ctx
, "dlist");
2513 n
= alloc_instruction( ctx
, OPCODE_SCALE
, 3 );
2519 if (ctx
->ExecuteFlag
) {
2520 (*ctx
->Exec
.Scalef
)( x
, y
, z
);
2525 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
2527 save_Scalef(x
, y
, z
);
2531 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
2533 GET_CURRENT_CONTEXT(ctx
);
2535 FLUSH_VB(ctx
, "dlist");
2536 n
= alloc_instruction( ctx
, OPCODE_SCISSOR
, 4 );
2543 if (ctx
->ExecuteFlag
) {
2544 (*ctx
->Exec
.Scissor
)( x
, y
, width
, height
);
2549 static void save_ShadeModel( GLenum mode
)
2551 GET_CURRENT_CONTEXT(ctx
);
2553 FLUSH_VB(ctx
, "dlist");
2554 n
= alloc_instruction( ctx
, OPCODE_SHADE_MODEL
, 1 );
2558 if (ctx
->ExecuteFlag
) {
2559 (*ctx
->Exec
.ShadeModel
)( mode
);
2564 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
2566 GET_CURRENT_CONTEXT(ctx
);
2568 FLUSH_VB(ctx
, "dlist");
2569 n
= alloc_instruction( ctx
, OPCODE_STENCIL_FUNC
, 3 );
2575 if (ctx
->ExecuteFlag
) {
2576 (*ctx
->Exec
.StencilFunc
)( func
, ref
, mask
);
2581 static void save_StencilMask( GLuint mask
)
2583 GET_CURRENT_CONTEXT(ctx
);
2585 FLUSH_VB(ctx
, "dlist");
2586 n
= alloc_instruction( ctx
, OPCODE_STENCIL_MASK
, 1 );
2590 if (ctx
->ExecuteFlag
) {
2591 (*ctx
->Exec
.StencilMask
)( mask
);
2596 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
2598 GET_CURRENT_CONTEXT(ctx
);
2600 FLUSH_VB(ctx
, "dlist");
2601 n
= alloc_instruction( ctx
, OPCODE_STENCIL_OP
, 3 );
2607 if (ctx
->ExecuteFlag
) {
2608 (*ctx
->Exec
.StencilOp
)( fail
, zfail
, zpass
);
2613 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
2615 GET_CURRENT_CONTEXT(ctx
);
2617 FLUSH_VB(ctx
, "dlist");
2618 n
= alloc_instruction( ctx
, OPCODE_TEXENV
, 6 );
2627 if (ctx
->ExecuteFlag
) {
2628 (*ctx
->Exec
.TexEnvfv
)( target
, pname
, params
);
2633 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
2635 save_TexEnvfv( target
, pname
, ¶m
);
2639 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
2642 p
[0] = (GLfloat
) param
;
2643 p
[1] = p
[2] = p
[3] = 0.0;
2644 save_TexEnvfv( target
, pname
, p
);
2648 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
2651 p
[0] = INT_TO_FLOAT( param
[0] );
2652 p
[1] = INT_TO_FLOAT( param
[1] );
2653 p
[2] = INT_TO_FLOAT( param
[2] );
2654 p
[3] = INT_TO_FLOAT( param
[3] );
2655 save_TexEnvfv( target
, pname
, p
);
2659 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
2661 GET_CURRENT_CONTEXT(ctx
);
2663 FLUSH_VB(ctx
, "dlist");
2664 n
= alloc_instruction( ctx
, OPCODE_TEXGEN
, 6 );
2673 if (ctx
->ExecuteFlag
) {
2674 (*ctx
->Exec
.TexGenfv
)( coord
, pname
, params
);
2679 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
2686 save_TexGenfv(coord
, pname
, p
);
2690 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
2692 GLfloat p
= (GLfloat
) param
;
2693 save_TexGenfv( coord
, pname
, &p
);
2697 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
2704 save_TexGenfv( coord
, pname
, p
);
2708 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
2710 save_TexGenfv(coord
, pname
, ¶m
);
2714 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
2716 save_TexGeniv( coord
, pname
, ¶m
);
2720 static void save_TexParameterfv( GLenum target
,
2721 GLenum pname
, const GLfloat
*params
)
2723 GET_CURRENT_CONTEXT(ctx
);
2725 FLUSH_VB(ctx
, "dlist");
2726 n
= alloc_instruction( ctx
, OPCODE_TEXPARAMETER
, 6 );
2735 if (ctx
->ExecuteFlag
) {
2736 (*ctx
->Exec
.TexParameterfv
)( target
, pname
, params
);
2741 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
2743 save_TexParameterfv(target
, pname
, ¶m
);
2747 static void save_TexParameteri( GLenum target
, GLenum pname
, const GLint param
)
2750 fparam
[0] = (GLfloat
) param
;
2751 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
2752 save_TexParameterfv(target
, pname
, fparam
);
2756 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
2759 fparam
[0] = (GLfloat
) params
[0];
2760 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
2761 save_TexParameterfv(target
, pname
, fparam
);
2765 static void save_TexImage1D( GLenum target
,
2766 GLint level
, GLint components
,
2767 GLsizei width
, GLint border
,
2768 GLenum format
, GLenum type
,
2769 const GLvoid
*pixels
)
2771 GET_CURRENT_CONTEXT(ctx
);
2772 if (target
== GL_PROXY_TEXTURE_1D
) {
2773 /* don't compile, execute immediately */
2774 (*ctx
->Exec
.TexImage1D
)( target
, level
, components
, width
,
2775 border
, format
, type
, pixels
);
2778 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
2779 pixels
, &ctx
->Unpack
);
2781 FLUSH_VB(ctx
, "dlist");
2782 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
2786 n
[3].i
= components
;
2787 n
[4].i
= (GLint
) width
;
2796 if (ctx
->ExecuteFlag
) {
2797 (*ctx
->Exec
.TexImage1D
)( target
, level
, components
, width
,
2798 border
, format
, type
, pixels
);
2804 static void save_TexImage2D( GLenum target
,
2805 GLint level
, GLint components
,
2806 GLsizei width
, GLsizei height
, GLint border
,
2807 GLenum format
, GLenum type
,
2808 const GLvoid
*pixels
)
2810 GET_CURRENT_CONTEXT(ctx
);
2811 if (target
== GL_PROXY_TEXTURE_2D
) {
2812 /* don't compile, execute immediately */
2813 (*ctx
->Exec
.TexImage2D
)( target
, level
, components
, width
,
2814 height
, border
, format
, type
, pixels
);
2817 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
2818 pixels
, &ctx
->Unpack
);
2820 FLUSH_VB(ctx
, "dlist");
2821 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
2825 n
[3].i
= components
;
2826 n
[4].i
= (GLint
) width
;
2827 n
[5].i
= (GLint
) height
;
2836 if (ctx
->ExecuteFlag
) {
2837 (*ctx
->Exec
.TexImage2D
)( target
, level
, components
, width
,
2838 height
, border
, format
, type
, pixels
);
2844 static void save_TexImage3D( GLenum target
,
2845 GLint level
, GLint components
,
2846 GLsizei width
, GLsizei height
, GLsizei depth
,
2848 GLenum format
, GLenum type
,
2849 const GLvoid
*pixels
)
2851 GET_CURRENT_CONTEXT(ctx
);
2852 if (target
== GL_PROXY_TEXTURE_3D
) {
2853 /* don't compile, execute immediately */
2854 (*ctx
->Exec
.TexImage3D
)( target
, level
, components
, width
,
2855 height
, depth
, border
, format
, type
, pixels
);
2859 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
2860 pixels
, &ctx
->Unpack
);
2861 FLUSH_VB(ctx
, "dlist");
2862 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
2866 n
[3].i
= components
;
2867 n
[4].i
= (GLint
) width
;
2868 n
[5].i
= (GLint
) height
;
2869 n
[6].i
= (GLint
) depth
;
2878 if (ctx
->ExecuteFlag
) {
2879 (*ctx
->Exec
.TexImage3D
)( target
, level
, components
, width
,
2880 height
, depth
, border
, format
, type
, pixels
);
2886 static void save_TexImage3DEXT( GLenum target
,
2887 GLint level
, GLenum components
,
2888 GLsizei width
, GLsizei height
, GLsizei depth
,
2889 GLint border
, GLenum format
, GLenum type
,
2890 const GLvoid
*pixels
)
2892 save_TexImage3D(target
, level
, (GLint
) components
, width
, height
,
2893 depth
, border
, format
, type
, pixels
);
2897 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
2898 GLsizei width
, GLenum format
, GLenum type
,
2899 const GLvoid
*pixels
)
2901 GET_CURRENT_CONTEXT(ctx
);
2903 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
2904 pixels
, &ctx
->Unpack
);
2905 FLUSH_VB(ctx
, "dlist");
2906 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
2911 n
[4].i
= (GLint
) width
;
2919 if (ctx
->ExecuteFlag
) {
2920 (*ctx
->Exec
.TexSubImage1D
)( target
, level
, xoffset
, width
,
2921 format
, type
, pixels
);
2926 static void save_TexSubImage2D( GLenum target
, GLint level
,
2927 GLint xoffset
, GLint yoffset
,
2928 GLsizei width
, GLsizei height
,
2929 GLenum format
, GLenum type
,
2930 const GLvoid
*pixels
)
2932 GET_CURRENT_CONTEXT(ctx
);
2934 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
2935 pixels
, &ctx
->Unpack
);
2936 FLUSH_VB(ctx
, "dlist");
2937 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
2943 n
[5].i
= (GLint
) width
;
2944 n
[6].i
= (GLint
) height
;
2952 if (ctx
->ExecuteFlag
) {
2953 (*ctx
->Exec
.TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
2954 width
, height
, format
, type
, pixels
);
2959 static void save_TexSubImage3D( GLenum target
, GLint level
,
2960 GLint xoffset
, GLint yoffset
,GLint zoffset
,
2961 GLsizei width
, GLsizei height
, GLsizei depth
,
2962 GLenum format
, GLenum type
,
2963 const GLvoid
*pixels
)
2965 GET_CURRENT_CONTEXT(ctx
);
2967 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
2968 pixels
, &ctx
->Unpack
);
2969 FLUSH_VB(ctx
, "dlist");
2970 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
2977 n
[6].i
= (GLint
) width
;
2978 n
[7].i
= (GLint
) height
;
2979 n
[8].i
= (GLint
) depth
;
2987 if (ctx
->ExecuteFlag
) {
2988 (*ctx
->Exec
.TexSubImage3D
)( target
, level
,
2989 xoffset
, yoffset
, zoffset
,
2990 width
, height
, depth
, format
, type
, pixels
);
2995 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
2997 GET_CURRENT_CONTEXT(ctx
);
2999 FLUSH_VB(ctx
, "dlist");
3000 n
= alloc_instruction( ctx
, OPCODE_TRANSLATE
, 3 );
3006 if (ctx
->ExecuteFlag
) {
3007 (*ctx
->Exec
.Translatef
)( x
, y
, z
);
3012 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3014 save_Translatef(x
, y
, z
);
3019 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3021 GET_CURRENT_CONTEXT(ctx
);
3023 FLUSH_VB(ctx
, "dlist");
3024 n
= alloc_instruction( ctx
, OPCODE_VIEWPORT
, 4 );
3028 n
[3].i
= (GLint
) width
;
3029 n
[4].i
= (GLint
) height
;
3031 if (ctx
->ExecuteFlag
) {
3032 (*ctx
->Exec
.Viewport
)( x
, y
, width
, height
);
3037 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3039 GET_CURRENT_CONTEXT(ctx
);
3041 FLUSH_VB(ctx
, "dlist");
3042 n
= alloc_instruction( ctx
, OPCODE_WINDOW_POS
, 4 );
3049 if (ctx
->ExecuteFlag
) {
3050 (*ctx
->Exec
.WindowPos4fMESA
)( x
, y
, z
, w
);
3057 /* GL_ARB_multitexture */
3058 static void save_ActiveTextureARB( GLenum target
)
3060 GET_CURRENT_CONTEXT(ctx
);
3062 FLUSH_VB(ctx
, "dlist");
3063 n
= alloc_instruction( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3067 if (ctx
->ExecuteFlag
) {
3068 (*ctx
->Exec
.ActiveTextureARB
)( target
);
3073 /* GL_ARB_multitexture */
3074 static void save_ClientActiveTextureARB( GLenum target
)
3076 GET_CURRENT_CONTEXT(ctx
);
3078 FLUSH_VB(ctx
, "dlist");
3079 n
= alloc_instruction( ctx
, OPCODE_CLIENT_ACTIVE_TEXTURE
, 1 );
3083 if (ctx
->ExecuteFlag
) {
3084 (*ctx
->Exec
.ClientActiveTextureARB
)( target
);
3090 static void save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3093 gl_matrix_transposed(tm
, m
);
3094 save_LoadMatrixd(tm
);
3098 static void save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3101 gl_matrix_transposef(tm
, m
);
3102 save_LoadMatrixf(tm
);
3106 static void save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3109 gl_matrix_transposed(tm
, m
);
3110 save_MultMatrixd(tm
);
3114 static void save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3117 gl_matrix_transposef(tm
, m
);
3118 save_MultMatrixf(tm
);
3123 void gl_compile_cassette( GLcontext
*ctx
)
3125 Node
*n
= alloc_instruction( ctx
, OPCODE_VERTEX_CASSETTE
, 8 );
3126 struct immediate
*im
= ctx
->input
;
3132 /* Do some easy optimizations of the cassette.
3135 if (0 && im
->v
.Obj
.size
< 4 && im
->Count
> 15) {
3136 im
->Bounds
= (GLfloat (*)[3]) MALLOC(6 * sizeof(GLfloat
));
3137 (gl_calc_bound_tab
[im
->v
.Obj
.size
])( im
->Bounds
, &im
->v
.Obj
);
3141 n
[1].data
= (void *)im
;
3142 n
[2].ui
= im
->Start
;
3143 n
[3].ui
= im
->Count
;
3144 n
[4].ui
= im
->BeginState
;
3145 n
[5].ui
= im
->OrFlag
;
3146 n
[6].ui
= im
->AndFlag
;
3147 n
[7].ui
= im
->LastData
;
3148 n
[8].ui
= im
->LastPrimitive
;
3150 if (im
->Count
> VB_MAX
- 4) {
3152 struct immediate
*new_im
= gl_immediate_alloc(ctx
);
3153 if (!new_im
) return;
3154 SET_IMMEDIATE( ctx
, new_im
);
3155 gl_reset_input( ctx
);
3159 im
->Start
= im
->Count
; /* don't clear anything in reset_input */
3162 im
->Primitive
[im
->Start
] = ctx
->Current
.Primitive
;
3163 im
->LastPrimitive
= im
->Start
;
3164 im
->BeginState
= VERT_BEGIN_0
;
3169 fprintf(stderr
, "in compile_cassette, BeginState is %x\n",
3174 /* KW: Compile commands
3176 * Will appear in the list before the vertex buffer containing the
3177 * command that provoked the error. I don't see this as a problem.
3179 void gl_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
3182 n
= alloc_instruction( ctx
, OPCODE_ERROR
, 2 );
3185 n
[2].data
= (void *) s
;
3187 /* execute already done */
3192 islist(GLcontext
*ctx
, GLuint list
)
3194 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
3204 /**********************************************************************/
3205 /* Display list execution */
3206 /**********************************************************************/
3210 * Execute a display list. Note that the ListBase offset must have already
3211 * been added before calling this function. I.e. the list argument is
3212 * the absolute list number, not relative to ListBase.
3213 * Input: list - display list number
3215 static void execute_list( GLcontext
*ctx
, GLuint list
)
3221 if (!islist(ctx
,list
))
3224 /* mesa_print_display_list( list ); */
3228 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
3232 opcode
= n
[0].opcode
;
3236 gl_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
3238 case OPCODE_VERTEX_CASSETTE
: {
3239 struct immediate
*IM
;
3242 gl_update_state(ctx
);
3243 if (ctx
->CompileCVAFlag
) {
3244 ctx
->CompileCVAFlag
= 0;
3245 ctx
->CVA
.elt
.pipeline_valid
= 0;
3247 if (!ctx
->CVA
.elt
.pipeline_valid
)
3248 gl_build_immediate_pipeline( ctx
);
3251 IM
= (struct immediate
*) n
[1].data
;
3252 IM
->Start
= n
[2].ui
;
3253 IM
->Count
= n
[3].ui
;
3254 IM
->BeginState
= n
[4].ui
;
3255 IM
->OrFlag
= n
[5].ui
;
3256 IM
->AndFlag
= n
[6].ui
;
3257 IM
->LastData
= n
[7].ui
;
3258 IM
->LastPrimitive
= n
[8].ui
;
3260 if ((MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
) &&
3261 (MESA_VERBOSE
& VERBOSE_IMMEDIATE
))
3262 gl_print_cassette( (struct immediate
*) n
[1].data
);
3265 fprintf(stderr
, "Run cassette %d, rows %d..%d, beginstate %x\n",
3267 IM
->Start
, IM
->Count
, IM
->BeginState
);
3269 gl_fixup_cassette( ctx
, (struct immediate
*) n
[1].data
);
3270 gl_execute_cassette( ctx
, (struct immediate
*) n
[1].data
);
3274 (*ctx
->Exec
.Accum
)( n
[1].e
, n
[2].f
);
3276 case OPCODE_ALPHA_FUNC
:
3277 (*ctx
->Exec
.AlphaFunc
)( n
[1].e
, n
[2].f
);
3279 case OPCODE_BIND_TEXTURE
:
3280 (*ctx
->Exec
.BindTexture
)( n
[1].e
, n
[2].ui
);
3284 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3285 ctx
->Unpack
= _mesa_native_packing
;
3286 (*ctx
->Exec
.Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
3287 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, n
[7].data
);
3288 ctx
->Unpack
= save
; /* restore */
3291 case OPCODE_BLEND_COLOR
:
3292 (*ctx
->Exec
.BlendColorEXT
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3294 case OPCODE_BLEND_EQUATION
:
3295 (*ctx
->Exec
.BlendEquationEXT
)( n
[1].e
);
3297 case OPCODE_BLEND_FUNC
:
3298 (*ctx
->Exec
.BlendFunc
)( n
[1].e
, n
[2].e
);
3300 case OPCODE_BLEND_FUNC_SEPARATE
:
3301 (*ctx
->Exec
.BlendFuncSeparateINGR
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
3303 case OPCODE_CALL_LIST
:
3304 /* Generated by glCallList(), don't add ListBase */
3305 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
3306 execute_list( ctx
, n
[1].ui
);
3309 case OPCODE_CALL_LIST_OFFSET
:
3310 /* Generated by glCallLists() so we must add ListBase */
3311 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
3312 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
3316 (*ctx
->Exec
.Clear
)( n
[1].bf
);
3318 case OPCODE_CLEAR_COLOR
:
3319 (*ctx
->Exec
.ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3321 case OPCODE_CLEAR_ACCUM
:
3322 (*ctx
->Exec
.ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3324 case OPCODE_CLEAR_DEPTH
:
3325 (*ctx
->Exec
.ClearDepth
)( (GLclampd
) n
[1].f
);
3327 case OPCODE_CLEAR_INDEX
:
3328 (*ctx
->Exec
.ClearIndex
)( n
[1].ui
);
3330 case OPCODE_CLEAR_STENCIL
:
3331 (*ctx
->Exec
.ClearStencil
)( n
[1].i
);
3333 case OPCODE_CLIP_PLANE
:
3340 (*ctx
->Exec
.ClipPlane
)( n
[1].e
, eq
);
3343 case OPCODE_COLOR_MASK
:
3344 (*ctx
->Exec
.ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
3346 case OPCODE_COLOR_MATERIAL
:
3347 (*ctx
->Exec
.ColorMaterial
)( n
[1].e
, n
[2].e
);
3349 case OPCODE_COLOR_TABLE
:
3351 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3352 ctx
->Unpack
= _mesa_native_packing
;
3353 (*ctx
->Exec
.ColorTableEXT
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
3354 n
[5].e
, n
[6].data
);
3355 ctx
->Unpack
= save
; /* restore */
3358 case OPCODE_COLOR_SUB_TABLE
:
3360 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3361 ctx
->Unpack
= _mesa_native_packing
;
3362 (*ctx
->Exec
.ColorSubTableEXT
)( n
[1].e
, n
[2].i
, n
[3].i
,
3363 n
[4].e
, n
[5].e
, n
[6].data
);
3364 ctx
->Unpack
= save
; /* restore */
3367 case OPCODE_COPY_PIXELS
:
3368 (*ctx
->Exec
.CopyPixels
)( n
[1].i
, n
[2].i
,
3369 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
3371 case OPCODE_COPY_TEX_IMAGE1D
:
3372 (*ctx
->Exec
.CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
3373 n
[5].i
, n
[6].i
, n
[7].i
);
3375 case OPCODE_COPY_TEX_IMAGE2D
:
3376 (*ctx
->Exec
.CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
3377 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
3379 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
3380 (*ctx
->Exec
.CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3381 n
[4].i
, n
[5].i
, n
[6].i
);
3383 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
3384 (*ctx
->Exec
.CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3385 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
3387 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
3388 (*ctx
->Exec
.CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3389 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
3391 case OPCODE_CULL_FACE
:
3392 (*ctx
->Exec
.CullFace
)( n
[1].e
);
3394 case OPCODE_DEPTH_FUNC
:
3395 (*ctx
->Exec
.DepthFunc
)( n
[1].e
);
3397 case OPCODE_DEPTH_MASK
:
3398 (*ctx
->Exec
.DepthMask
)( n
[1].b
);
3400 case OPCODE_DEPTH_RANGE
:
3401 (*ctx
->Exec
.DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
3403 case OPCODE_DISABLE
:
3404 (*ctx
->Exec
.Disable
)( n
[1].e
);
3406 case OPCODE_DRAW_BUFFER
:
3407 (*ctx
->Exec
.DrawBuffer
)( n
[1].e
);
3409 case OPCODE_DRAW_PIXELS
:
3411 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3412 ctx
->Unpack
= _mesa_native_packing
;
3413 (*ctx
->Exec
.DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
3415 ctx
->Unpack
= save
; /* restore */
3419 (*ctx
->Exec
.Enable
)( n
[1].e
);
3421 case OPCODE_EVALMESH1
:
3422 (*ctx
->Exec
.EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
3424 case OPCODE_EVALMESH2
:
3425 (*ctx
->Exec
.EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
3434 (*ctx
->Exec
.Fogfv
)( n
[1].e
, p
);
3437 case OPCODE_FRONT_FACE
:
3438 (*ctx
->Exec
.FrontFace
)( n
[1].e
);
3440 case OPCODE_FRUSTUM
:
3441 (*ctx
->Exec
.Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
3444 (*ctx
->Exec
.Hint
)( n
[1].e
, n
[2].e
);
3446 case OPCODE_HINT_PGI
:
3447 (*ctx
->Exec
.HintPGI
)( n
[1].e
, n
[2].i
);
3449 case OPCODE_INDEX_MASK
:
3450 (*ctx
->Exec
.IndexMask
)( n
[1].ui
);
3452 case OPCODE_INIT_NAMES
:
3453 (*ctx
->Exec
.InitNames
)();
3462 (*ctx
->Exec
.Lightfv
)( n
[1].e
, n
[2].e
, p
);
3465 case OPCODE_LIGHT_MODEL
:
3472 (*ctx
->Exec
.LightModelfv
)( n
[1].e
, p
);
3475 case OPCODE_LINE_STIPPLE
:
3476 (*ctx
->Exec
.LineStipple
)( n
[1].i
, n
[2].us
);
3478 case OPCODE_LINE_WIDTH
:
3479 (*ctx
->Exec
.LineWidth
)( n
[1].f
);
3481 case OPCODE_LIST_BASE
:
3482 (*ctx
->Exec
.ListBase
)( n
[1].ui
);
3484 case OPCODE_LOAD_IDENTITY
:
3485 (*ctx
->Exec
.LoadIdentity
)();
3487 case OPCODE_LOAD_MATRIX
:
3488 if (sizeof(Node
)==sizeof(GLfloat
)) {
3489 (*ctx
->Exec
.LoadMatrixf
)( &n
[1].f
);
3494 for (i
=0;i
<16;i
++) {
3497 (*ctx
->Exec
.LoadMatrixf
)( m
);
3500 case OPCODE_LOAD_NAME
:
3501 (*ctx
->Exec
.LoadName
)( n
[1].ui
);
3503 case OPCODE_LOGIC_OP
:
3504 (*ctx
->Exec
.LogicOp
)( n
[1].e
);
3508 GLenum target
= n
[1].e
;
3509 GLint ustride
= _mesa_evaluator_components(target
);
3510 GLint uorder
= n
[5].i
;
3511 GLfloat u1
= n
[2].f
;
3512 GLfloat u2
= n
[3].f
;
3513 (*ctx
->Exec
.Map1f
)( target
, u1
, u2
, ustride
, uorder
,
3514 (GLfloat
*) n
[6].data
);
3519 GLenum target
= n
[1].e
;
3520 GLfloat u1
= n
[2].f
;
3521 GLfloat u2
= n
[3].f
;
3522 GLfloat v1
= n
[4].f
;
3523 GLfloat v2
= n
[5].f
;
3524 GLint ustride
= n
[6].i
;
3525 GLint vstride
= n
[7].i
;
3526 GLint uorder
= n
[8].i
;
3527 GLint vorder
= n
[9].i
;
3528 (*ctx
->Exec
.Map2f
)( target
, u1
, u2
, ustride
, uorder
,
3529 v1
, v2
, vstride
, vorder
,
3530 (GLfloat
*) n
[10].data
);
3533 case OPCODE_MAPGRID1
:
3534 (*ctx
->Exec
.MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
3536 case OPCODE_MAPGRID2
:
3537 (*ctx
->Exec
.MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
3539 case OPCODE_MATRIX_MODE
:
3540 (*ctx
->Exec
.MatrixMode
)( n
[1].e
);
3542 case OPCODE_MULT_MATRIX
:
3543 if (sizeof(Node
)==sizeof(GLfloat
)) {
3544 (*ctx
->Exec
.MultMatrixf
)( &n
[1].f
);
3549 for (i
=0;i
<16;i
++) {
3552 (*ctx
->Exec
.MultMatrixf
)( m
);
3556 (*ctx
->Exec
.Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
3558 case OPCODE_PASSTHROUGH
:
3559 (*ctx
->Exec
.PassThrough
)( n
[1].f
);
3561 case OPCODE_PIXEL_MAP
:
3562 (*ctx
->Exec
.PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
3564 case OPCODE_PIXEL_TRANSFER
:
3565 (*ctx
->Exec
.PixelTransferf
)( n
[1].e
, n
[2].f
);
3567 case OPCODE_PIXEL_ZOOM
:
3568 (*ctx
->Exec
.PixelZoom
)( n
[1].f
, n
[2].f
);
3570 case OPCODE_POINT_SIZE
:
3571 (*ctx
->Exec
.PointSize
)( n
[1].f
);
3573 case OPCODE_POINT_PARAMETERS
:
3579 (*ctx
->Exec
.PointParameterfvEXT
)( n
[1].e
, params
);
3582 case OPCODE_POLYGON_MODE
:
3583 (*ctx
->Exec
.PolygonMode
)( n
[1].e
, n
[2].e
);
3585 case OPCODE_POLYGON_STIPPLE
:
3586 (*ctx
->Exec
.PolygonStipple
)( (GLubyte
*) n
[1].data
);
3588 case OPCODE_POLYGON_OFFSET
:
3589 (*ctx
->Exec
.PolygonOffset
)( n
[1].f
, n
[2].f
);
3591 case OPCODE_POP_ATTRIB
:
3592 (*ctx
->Exec
.PopAttrib
)();
3594 case OPCODE_POP_MATRIX
:
3595 (*ctx
->Exec
.PopMatrix
)();
3597 case OPCODE_POP_NAME
:
3598 (*ctx
->Exec
.PopName
)();
3600 case OPCODE_PRIORITIZE_TEXTURE
:
3601 (*ctx
->Exec
.PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
3603 case OPCODE_PUSH_ATTRIB
:
3604 (*ctx
->Exec
.PushAttrib
)( n
[1].bf
);
3606 case OPCODE_PUSH_MATRIX
:
3607 (*ctx
->Exec
.PushMatrix
)();
3609 case OPCODE_PUSH_NAME
:
3610 (*ctx
->Exec
.PushName
)( n
[1].ui
);
3612 case OPCODE_RASTER_POS
:
3613 (*ctx
->Exec
.RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3615 case OPCODE_READ_BUFFER
:
3616 (*ctx
->Exec
.ReadBuffer
)( n
[1].e
);
3619 (*ctx
->Exec
.Rectf
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3622 (*ctx
->Exec
.Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
3624 case OPCODE_SCISSOR
:
3625 (*ctx
->Exec
.Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
3627 case OPCODE_SHADE_MODEL
:
3628 (*ctx
->Exec
.ShadeModel
)( n
[1].e
);
3630 case OPCODE_STENCIL_FUNC
:
3631 (*ctx
->Exec
.StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
3633 case OPCODE_STENCIL_MASK
:
3634 (*ctx
->Exec
.StencilMask
)( n
[1].ui
);
3636 case OPCODE_STENCIL_OP
:
3637 (*ctx
->Exec
.StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
3646 (*ctx
->Exec
.TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
3656 (*ctx
->Exec
.TexGenfv
)( n
[1].e
, n
[2].e
, params
);
3659 case OPCODE_TEXPARAMETER
:
3666 (*ctx
->Exec
.TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
3669 case OPCODE_TEX_IMAGE1D
:
3671 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3672 ctx
->Unpack
= _mesa_native_packing
;
3673 (*ctx
->Exec
.TexImage1D
)(
3674 n
[1].e
, /* target */
3676 n
[3].i
, /* components */
3678 n
[5].e
, /* border */
3679 n
[6].e
, /* format */
3682 ctx
->Unpack
= save
; /* restore */
3685 case OPCODE_TEX_IMAGE2D
:
3687 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3688 ctx
->Unpack
= _mesa_native_packing
;
3689 (*ctx
->Exec
.TexImage2D
)(
3690 n
[1].e
, /* target */
3692 n
[3].i
, /* components */
3694 n
[5].i
, /* height */
3695 n
[6].e
, /* border */
3696 n
[7].e
, /* format */
3699 ctx
->Unpack
= save
; /* restore */
3702 case OPCODE_TEX_IMAGE3D
:
3704 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3705 ctx
->Unpack
= _mesa_native_packing
;
3706 (*ctx
->Exec
.TexImage3D
)(
3707 n
[1].e
, /* target */
3709 n
[3].i
, /* components */
3711 n
[5].i
, /* height */
3713 n
[7].e
, /* border */
3714 n
[8].e
, /* format */
3717 ctx
->Unpack
= save
; /* restore */
3720 case OPCODE_TEX_SUB_IMAGE1D
:
3722 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3723 ctx
->Unpack
= _mesa_native_packing
;
3724 (*ctx
->Exec
.TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3726 n
[6].e
, n
[7].data
);
3727 ctx
->Unpack
= save
; /* restore */
3730 case OPCODE_TEX_SUB_IMAGE2D
:
3732 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3733 ctx
->Unpack
= _mesa_native_packing
;
3734 (*ctx
->Exec
.TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3736 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
3737 ctx
->Unpack
= save
; /* restore */
3740 case OPCODE_TEX_SUB_IMAGE3D
:
3742 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
3743 ctx
->Unpack
= _mesa_native_packing
;
3744 (*ctx
->Exec
.TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
3745 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
3746 n
[8].i
, n
[9].e
, n
[10].e
,
3748 ctx
->Unpack
= save
; /* restore */
3751 case OPCODE_TRANSLATE
:
3752 (*ctx
->Exec
.Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
3754 case OPCODE_VIEWPORT
:
3755 (*ctx
->Exec
.Viewport
)(n
[1].i
, n
[2].i
,
3756 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
3758 case OPCODE_WINDOW_POS
:
3759 (*ctx
->Exec
.WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
3761 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
3762 (*ctx
->Exec
.ActiveTextureARB
)( n
[1].e
);
3764 case OPCODE_CLIENT_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
3765 (*ctx
->Exec
.ClientActiveTextureARB
)( n
[1].e
);
3767 case OPCODE_CONTINUE
:
3768 n
= (Node
*) n
[1].next
;
3770 case OPCODE_END_OF_LIST
:
3776 sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
3777 gl_problem( ctx
, msg
);
3782 /* increment n to point to next compiled command */
3783 if (opcode
!=OPCODE_CONTINUE
) {
3784 n
+= InstSize
[opcode
];
3795 /**********************************************************************/
3797 /**********************************************************************/
3803 * Test if a display list number is valid.
3806 _mesa_IsList( GLuint list
)
3808 GET_CURRENT_CONTEXT(ctx
);
3809 return islist(ctx
, list
);
3814 * Delete a sequence of consecutive display lists.
3817 _mesa_DeleteLists( GLuint list
, GLsizei range
)
3819 GET_CURRENT_CONTEXT(ctx
);
3822 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glDeleteLists");
3824 gl_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
3827 for (i
=list
;i
<list
+range
;i
++) {
3828 gl_destroy_list( ctx
, i
);
3835 * Return a display list number, n, such that lists n through n+range-1
3839 _mesa_GenLists(GLsizei range
)
3841 GET_CURRENT_CONTEXT(ctx
);
3844 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx
, "glGenLists", 0);
3846 gl_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
3853 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
3855 /* reserve the list IDs by with empty/dummy lists */
3857 for (i
=0; i
<range
; i
++) {
3858 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
3867 * Begin a new display list.
3870 _mesa_NewList( GLuint list
, GLenum mode
)
3872 GET_CURRENT_CONTEXT(ctx
);
3873 struct immediate
*IM
;
3874 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glNewList");
3876 if (MESA_VERBOSE
&VERBOSE_API
)
3877 fprintf(stderr
, "glNewList %u %s\n", list
, gl_lookup_enum_by_nr(mode
));
3880 gl_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
3884 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
3885 gl_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
3889 if (ctx
->CurrentListPtr
) {
3890 /* already compiling a display list */
3891 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
3895 /* Allocate new display list */
3896 ctx
->CurrentListNum
= list
;
3897 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
3898 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
3899 ctx
->CurrentPos
= 0;
3901 IM
= gl_immediate_alloc( ctx
);
3902 SET_IMMEDIATE( ctx
, IM
);
3903 gl_reset_input( ctx
);
3905 ctx
->CompileFlag
= GL_TRUE
;
3906 ctx
->CompileCVAFlag
= GL_FALSE
;
3907 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
3909 ctx
->CurrentDispatch
= &ctx
->Save
;
3910 _glapi_set_dispatch( ctx
->CurrentDispatch
);
3916 * End definition of current display list.
3919 _mesa_EndList( void )
3921 GET_CURRENT_CONTEXT(ctx
);
3922 if (MESA_VERBOSE
&VERBOSE_API
)
3923 fprintf(stderr
, "glEndList\n");
3925 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
, "glEndList" );
3927 /* Check that a list is under construction */
3928 if (!ctx
->CurrentListPtr
) {
3929 gl_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
3933 (void) alloc_instruction( ctx
, OPCODE_END_OF_LIST
, 0 );
3935 /* Destroy old list, if any */
3936 gl_destroy_list(ctx
, ctx
->CurrentListNum
);
3937 /* Install the list */
3938 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
3941 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
3942 mesa_print_display_list(ctx
->CurrentListNum
);
3944 ctx
->CurrentListNum
= 0;
3945 ctx
->CurrentListPtr
= NULL
;
3946 ctx
->ExecuteFlag
= GL_TRUE
;
3947 ctx
->CompileFlag
= GL_FALSE
;
3948 /* ctx->CompileCVAFlag = ...; */
3950 /* KW: Put back the old input pointer.
3952 if (--ctx
->input
->ref_count
== 0)
3953 gl_immediate_free( ctx
->input
);
3955 SET_IMMEDIATE( ctx
, ctx
->VB
->IM
);
3956 gl_reset_input( ctx
);
3958 /* Haven't tracked down why this is needed.
3962 ctx
->CurrentDispatch
= &ctx
->Exec
;
3963 _glapi_set_dispatch( ctx
->CurrentDispatch
);
3969 _mesa_CallList( GLuint list
)
3971 GET_CURRENT_CONTEXT(ctx
);
3972 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
3973 /* execute the display list, and restore the CompileFlag. */
3974 GLboolean save_compile_flag
;
3976 if (MESA_VERBOSE
&VERBOSE_API
) {
3977 fprintf(stderr
, "glCallList %u\n", list
);
3978 mesa_print_display_list( list
);
3981 save_compile_flag
= ctx
->CompileFlag
;
3982 ctx
->CompileFlag
= GL_FALSE
;
3984 FLUSH_VB( ctx
, "call list" );
3985 execute_list( ctx
, list
);
3986 ctx
->CompileFlag
= save_compile_flag
;
3988 /* also restore API function pointers to point to "save" versions */
3989 if (save_compile_flag
) {
3990 ctx
->CurrentDispatch
= &ctx
->Save
;
3991 _glapi_set_dispatch( ctx
->CurrentDispatch
);
3998 * Execute glCallLists: call multiple display lists.
4001 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
4003 GET_CURRENT_CONTEXT(ctx
);
4006 GLboolean save_compile_flag
;
4008 /* Save the CompileFlag status, turn it off, execute display list,
4009 * and restore the CompileFlag.
4011 save_compile_flag
= ctx
->CompileFlag
;
4012 ctx
->CompileFlag
= GL_FALSE
;
4014 FLUSH_VB( ctx
, "call lists" );
4017 list
= translate_id( i
, type
, lists
);
4018 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
4021 ctx
->CompileFlag
= save_compile_flag
;
4023 /* also restore API function pointers to point to "save" versions */
4024 if (save_compile_flag
) {
4025 ctx
->CurrentDispatch
= &ctx
->Save
;
4026 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4029 /* RESET_IMMEDIATE( ctx ); */
4035 * Set the offset added to list numbers in glCallLists.
4038 _mesa_ListBase( GLuint base
)
4040 GET_CURRENT_CONTEXT(ctx
);
4041 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glListBase");
4042 ctx
->List
.ListBase
= base
;
4049 * Assign all the pointers in 'table' to point to Mesa's display list
4050 * building functions.
4053 _mesa_init_dlist_table( struct _glapi_table
*table
)
4055 _mesa_init_no_op_table(table
);
4058 table
->Accum
= save_Accum
;
4059 table
->AlphaFunc
= save_AlphaFunc
;
4060 table
->Begin
= save_Begin
;
4061 table
->Bitmap
= save_Bitmap
;
4062 table
->BlendFunc
= save_BlendFunc
;
4063 table
->CallList
= save_CallList
;
4064 table
->CallLists
= save_CallLists
;
4065 table
->Clear
= save_Clear
;
4066 table
->ClearAccum
= save_ClearAccum
;
4067 table
->ClearColor
= save_ClearColor
;
4068 table
->ClearDepth
= save_ClearDepth
;
4069 table
->ClearIndex
= save_ClearIndex
;
4070 table
->ClearStencil
= save_ClearStencil
;
4071 table
->ClipPlane
= save_ClipPlane
;
4072 table
->Color3b
= _mesa_Color3b
;
4073 table
->Color3bv
= _mesa_Color3bv
;
4074 table
->Color3d
= _mesa_Color3d
;
4075 table
->Color3dv
= _mesa_Color3dv
;
4076 table
->Color3f
= _mesa_Color3f
;
4077 table
->Color3fv
= _mesa_Color3fv
;
4078 table
->Color3i
= _mesa_Color3i
;
4079 table
->Color3iv
= _mesa_Color3iv
;
4080 table
->Color3s
= _mesa_Color3s
;
4081 table
->Color3sv
= _mesa_Color3sv
;
4082 table
->Color3ub
= _mesa_Color3ub
;
4083 table
->Color3ubv
= _mesa_Color3ubv
;
4084 table
->Color3ui
= _mesa_Color3ui
;
4085 table
->Color3uiv
= _mesa_Color3uiv
;
4086 table
->Color3us
= _mesa_Color3us
;
4087 table
->Color3usv
= _mesa_Color3usv
;
4088 table
->Color4b
= _mesa_Color4b
;
4089 table
->Color4bv
= _mesa_Color4bv
;
4090 table
->Color4d
= _mesa_Color4d
;
4091 table
->Color4dv
= _mesa_Color4dv
;
4092 table
->Color4f
= _mesa_Color4f
;
4093 table
->Color4fv
= _mesa_Color4fv
;
4094 table
->Color4i
= _mesa_Color4i
;
4095 table
->Color4iv
= _mesa_Color4iv
;
4096 table
->Color4s
= _mesa_Color4s
;
4097 table
->Color4sv
= _mesa_Color4sv
;
4098 table
->Color4ub
= _mesa_Color4ub
;
4099 table
->Color4ubv
= _mesa_Color4ubv
;
4100 table
->Color4ui
= _mesa_Color4ui
;
4101 table
->Color4uiv
= _mesa_Color4uiv
;
4102 table
->Color4us
= _mesa_Color4us
;
4103 table
->Color4usv
= _mesa_Color4usv
;
4104 table
->ColorMask
= save_ColorMask
;
4105 table
->ColorMaterial
= save_ColorMaterial
;
4106 table
->CopyPixels
= save_CopyPixels
;
4107 table
->CullFace
= save_CullFace
;
4108 table
->DeleteLists
= _mesa_DeleteLists
;
4109 table
->DepthFunc
= save_DepthFunc
;
4110 table
->DepthMask
= save_DepthMask
;
4111 table
->DepthRange
= save_DepthRange
;
4112 table
->Disable
= save_Disable
;
4113 table
->DrawBuffer
= save_DrawBuffer
;
4114 table
->DrawPixels
= save_DrawPixels
;
4115 table
->EdgeFlag
= _mesa_EdgeFlag
;
4116 table
->EdgeFlagv
= _mesa_EdgeFlagv
;
4117 table
->Enable
= save_Enable
;
4118 table
->End
= _mesa_End
;
4119 table
->EndList
= _mesa_EndList
;
4120 table
->EvalCoord1d
= _mesa_EvalCoord1d
;
4121 table
->EvalCoord1dv
= _mesa_EvalCoord1dv
;
4122 table
->EvalCoord1f
= _mesa_EvalCoord1f
;
4123 table
->EvalCoord1fv
= _mesa_EvalCoord1fv
;
4124 table
->EvalCoord2d
= _mesa_EvalCoord2d
;
4125 table
->EvalCoord2dv
= _mesa_EvalCoord2dv
;
4126 table
->EvalCoord2f
= _mesa_EvalCoord2f
;
4127 table
->EvalCoord2fv
= _mesa_EvalCoord2fv
;
4128 table
->EvalMesh1
= save_EvalMesh1
;
4129 table
->EvalMesh2
= save_EvalMesh2
;
4130 table
->EvalPoint1
= _mesa_EvalPoint1
;
4131 table
->EvalPoint2
= _mesa_EvalPoint2
;
4132 table
->FeedbackBuffer
= _mesa_FeedbackBuffer
;
4133 table
->Finish
= _mesa_Finish
;
4134 table
->Flush
= _mesa_Flush
;
4135 table
->Fogf
= save_Fogf
;
4136 table
->Fogfv
= save_Fogfv
;
4137 table
->Fogi
= save_Fogi
;
4138 table
->Fogiv
= save_Fogiv
;
4139 table
->FrontFace
= save_FrontFace
;
4140 table
->Frustum
= save_Frustum
;
4141 table
->GenLists
= _mesa_GenLists
;
4142 table
->GetBooleanv
= _mesa_GetBooleanv
;
4143 table
->GetClipPlane
= _mesa_GetClipPlane
;
4144 table
->GetDoublev
= _mesa_GetDoublev
;
4145 table
->GetError
= _mesa_GetError
;
4146 table
->GetFloatv
= _mesa_GetFloatv
;
4147 table
->GetIntegerv
= _mesa_GetIntegerv
;
4148 table
->GetLightfv
= _mesa_GetLightfv
;
4149 table
->GetLightiv
= _mesa_GetLightiv
;
4150 table
->GetMapdv
= _mesa_GetMapdv
;
4151 table
->GetMapfv
= _mesa_GetMapfv
;
4152 table
->GetMapiv
= _mesa_GetMapiv
;
4153 table
->GetMaterialfv
= _mesa_GetMaterialfv
;
4154 table
->GetMaterialiv
= _mesa_GetMaterialiv
;
4155 table
->GetPixelMapfv
= _mesa_GetPixelMapfv
;
4156 table
->GetPixelMapuiv
= _mesa_GetPixelMapuiv
;
4157 table
->GetPixelMapusv
= _mesa_GetPixelMapusv
;
4158 table
->GetPolygonStipple
= _mesa_GetPolygonStipple
;
4159 table
->GetString
= _mesa_GetString
;
4160 table
->GetTexEnvfv
= _mesa_GetTexEnvfv
;
4161 table
->GetTexEnviv
= _mesa_GetTexEnviv
;
4162 table
->GetTexGendv
= _mesa_GetTexGendv
;
4163 table
->GetTexGenfv
= _mesa_GetTexGenfv
;
4164 table
->GetTexGeniv
= _mesa_GetTexGeniv
;
4165 table
->GetTexImage
= _mesa_GetTexImage
;
4166 table
->GetTexLevelParameterfv
= _mesa_GetTexLevelParameterfv
;
4167 table
->GetTexLevelParameteriv
= _mesa_GetTexLevelParameteriv
;
4168 table
->GetTexParameterfv
= _mesa_GetTexParameterfv
;
4169 table
->GetTexParameteriv
= _mesa_GetTexParameteriv
;
4170 table
->Hint
= save_Hint
;
4171 table
->IndexMask
= save_IndexMask
;
4172 table
->Indexd
= _mesa_Indexd
;
4173 table
->Indexdv
= _mesa_Indexdv
;
4174 table
->Indexf
= _mesa_Indexf
;
4175 table
->Indexfv
= _mesa_Indexfv
;
4176 table
->Indexi
= _mesa_Indexi
;
4177 table
->Indexiv
= _mesa_Indexiv
;
4178 table
->Indexs
= _mesa_Indexs
;
4179 table
->Indexsv
= _mesa_Indexsv
;
4180 table
->InitNames
= save_InitNames
;
4181 table
->IsEnabled
= _mesa_IsEnabled
;
4182 table
->IsList
= _mesa_IsList
;
4183 table
->LightModelf
= save_LightModelf
;
4184 table
->LightModelfv
= save_LightModelfv
;
4185 table
->LightModeli
= save_LightModeli
;
4186 table
->LightModeliv
= save_LightModeliv
;
4187 table
->Lightf
= save_Lightf
;
4188 table
->Lightfv
= save_Lightfv
;
4189 table
->Lighti
= save_Lighti
;
4190 table
->Lightiv
= save_Lightiv
;
4191 table
->LineStipple
= save_LineStipple
;
4192 table
->LineWidth
= save_LineWidth
;
4193 table
->ListBase
= save_ListBase
;
4194 table
->LoadIdentity
= save_LoadIdentity
;
4195 table
->LoadMatrixd
= save_LoadMatrixd
;
4196 table
->LoadMatrixf
= save_LoadMatrixf
;
4197 table
->LoadName
= save_LoadName
;
4198 table
->LogicOp
= save_LogicOp
;
4199 table
->Map1d
= save_Map1d
;
4200 table
->Map1f
= save_Map1f
;
4201 table
->Map2d
= save_Map2d
;
4202 table
->Map2f
= save_Map2f
;
4203 table
->MapGrid1d
= save_MapGrid1d
;
4204 table
->MapGrid1f
= save_MapGrid1f
;
4205 table
->MapGrid2d
= save_MapGrid2d
;
4206 table
->MapGrid2f
= save_MapGrid2f
;
4207 table
->Materialf
= _mesa_Materialf
;
4208 table
->Materialfv
= _mesa_Materialfv
;
4209 table
->Materiali
= _mesa_Materiali
;
4210 table
->Materialiv
= _mesa_Materialiv
;
4211 table
->MatrixMode
= save_MatrixMode
;
4212 table
->MultMatrixd
= save_MultMatrixd
;
4213 table
->MultMatrixf
= save_MultMatrixf
;
4214 table
->NewList
= save_NewList
;
4215 table
->Normal3b
= _mesa_Normal3b
;
4216 table
->Normal3bv
= _mesa_Normal3bv
;
4217 table
->Normal3d
= _mesa_Normal3d
;
4218 table
->Normal3dv
= _mesa_Normal3dv
;
4219 table
->Normal3f
= _mesa_Normal3f
;
4220 table
->Normal3fv
= _mesa_Normal3fv
;
4221 table
->Normal3i
= _mesa_Normal3i
;
4222 table
->Normal3iv
= _mesa_Normal3iv
;
4223 table
->Normal3s
= _mesa_Normal3s
;
4224 table
->Normal3sv
= _mesa_Normal3sv
;
4225 table
->Ortho
= save_Ortho
;
4226 table
->PassThrough
= save_PassThrough
;
4227 table
->PixelMapfv
= save_PixelMapfv
;
4228 table
->PixelMapuiv
= save_PixelMapuiv
;
4229 table
->PixelMapusv
= save_PixelMapusv
;
4230 table
->PixelStoref
= _mesa_PixelStoref
;
4231 table
->PixelStorei
= _mesa_PixelStorei
;
4232 table
->PixelTransferf
= save_PixelTransferf
;
4233 table
->PixelTransferi
= save_PixelTransferi
;
4234 table
->PixelZoom
= save_PixelZoom
;
4235 table
->PointSize
= save_PointSize
;
4236 table
->PolygonMode
= save_PolygonMode
;
4237 table
->PolygonOffset
= save_PolygonOffset
;
4238 table
->PolygonStipple
= save_PolygonStipple
;
4239 table
->PopAttrib
= save_PopAttrib
;
4240 table
->PopMatrix
= save_PopMatrix
;
4241 table
->PopName
= save_PopName
;
4242 table
->PushAttrib
= save_PushAttrib
;
4243 table
->PushMatrix
= save_PushMatrix
;
4244 table
->PushName
= save_PushName
;
4245 table
->RasterPos2d
= save_RasterPos2d
;
4246 table
->RasterPos2dv
= save_RasterPos2dv
;
4247 table
->RasterPos2f
= save_RasterPos2f
;
4248 table
->RasterPos2fv
= save_RasterPos2fv
;
4249 table
->RasterPos2i
= save_RasterPos2i
;
4250 table
->RasterPos2iv
= save_RasterPos2iv
;
4251 table
->RasterPos2s
= save_RasterPos2s
;
4252 table
->RasterPos2sv
= save_RasterPos2sv
;
4253 table
->RasterPos3d
= save_RasterPos3d
;
4254 table
->RasterPos3dv
= save_RasterPos3dv
;
4255 table
->RasterPos3f
= save_RasterPos3f
;
4256 table
->RasterPos3fv
= save_RasterPos3fv
;
4257 table
->RasterPos3i
= save_RasterPos3i
;
4258 table
->RasterPos3iv
= save_RasterPos3iv
;
4259 table
->RasterPos3s
= save_RasterPos3s
;
4260 table
->RasterPos3sv
= save_RasterPos3sv
;
4261 table
->RasterPos4d
= save_RasterPos4d
;
4262 table
->RasterPos4dv
= save_RasterPos4dv
;
4263 table
->RasterPos4f
= save_RasterPos4f
;
4264 table
->RasterPos4fv
= save_RasterPos4fv
;
4265 table
->RasterPos4i
= save_RasterPos4i
;
4266 table
->RasterPos4iv
= save_RasterPos4iv
;
4267 table
->RasterPos4s
= save_RasterPos4s
;
4268 table
->RasterPos4sv
= save_RasterPos4sv
;
4269 table
->ReadBuffer
= save_ReadBuffer
;
4270 table
->ReadPixels
= _mesa_ReadPixels
;
4271 table
->Rectd
= save_Rectd
;
4272 table
->Rectdv
= save_Rectdv
;
4273 table
->Rectf
= save_Rectf
;
4274 table
->Rectfv
= save_Rectfv
;
4275 table
->Recti
= save_Recti
;
4276 table
->Rectiv
= save_Rectiv
;
4277 table
->Rects
= save_Rects
;
4278 table
->Rectsv
= save_Rectsv
;
4279 table
->RenderMode
= _mesa_RenderMode
;
4280 table
->Rotated
= save_Rotated
;
4281 table
->Rotatef
= save_Rotatef
;
4282 table
->Scaled
= save_Scaled
;
4283 table
->Scalef
= save_Scalef
;
4284 table
->Scissor
= save_Scissor
;
4285 table
->SelectBuffer
= _mesa_SelectBuffer
;
4286 table
->ShadeModel
= save_ShadeModel
;
4287 table
->StencilFunc
= save_StencilFunc
;
4288 table
->StencilMask
= save_StencilMask
;
4289 table
->StencilOp
= save_StencilOp
;
4290 table
->TexCoord1d
= _mesa_TexCoord1d
;
4291 table
->TexCoord1dv
= _mesa_TexCoord1dv
;
4292 table
->TexCoord1f
= _mesa_TexCoord1f
;
4293 table
->TexCoord1fv
= _mesa_TexCoord1fv
;
4294 table
->TexCoord1i
= _mesa_TexCoord1i
;
4295 table
->TexCoord1iv
= _mesa_TexCoord1iv
;
4296 table
->TexCoord1s
= _mesa_TexCoord1s
;
4297 table
->TexCoord1sv
= _mesa_TexCoord1sv
;
4298 table
->TexCoord2d
= _mesa_TexCoord2d
;
4299 table
->TexCoord2dv
= _mesa_TexCoord2dv
;
4300 table
->TexCoord2f
= _mesa_TexCoord2f
;
4301 table
->TexCoord2fv
= _mesa_TexCoord2fv
;
4302 table
->TexCoord2i
= _mesa_TexCoord2i
;
4303 table
->TexCoord2iv
= _mesa_TexCoord2iv
;
4304 table
->TexCoord2s
= _mesa_TexCoord2s
;
4305 table
->TexCoord2sv
= _mesa_TexCoord2sv
;
4306 table
->TexCoord3d
= _mesa_TexCoord3d
;
4307 table
->TexCoord3dv
= _mesa_TexCoord3dv
;
4308 table
->TexCoord3f
= _mesa_TexCoord3f
;
4309 table
->TexCoord3fv
= _mesa_TexCoord3fv
;
4310 table
->TexCoord3i
= _mesa_TexCoord3i
;
4311 table
->TexCoord3iv
= _mesa_TexCoord3iv
;
4312 table
->TexCoord3s
= _mesa_TexCoord3s
;
4313 table
->TexCoord3sv
= _mesa_TexCoord3sv
;
4314 table
->TexCoord4d
= _mesa_TexCoord4d
;
4315 table
->TexCoord4dv
= _mesa_TexCoord4dv
;
4316 table
->TexCoord4f
= _mesa_TexCoord4f
;
4317 table
->TexCoord4fv
= _mesa_TexCoord4fv
;
4318 table
->TexCoord4i
= _mesa_TexCoord4i
;
4319 table
->TexCoord4iv
= _mesa_TexCoord4iv
;
4320 table
->TexCoord4s
= _mesa_TexCoord4s
;
4321 table
->TexCoord4sv
= _mesa_TexCoord4sv
;
4322 table
->TexEnvf
= save_TexEnvf
;
4323 table
->TexEnvfv
= save_TexEnvfv
;
4324 table
->TexEnvi
= save_TexEnvi
;
4325 table
->TexEnviv
= save_TexEnviv
;
4326 table
->TexGend
= save_TexGend
;
4327 table
->TexGendv
= save_TexGendv
;
4328 table
->TexGenf
= save_TexGenf
;
4329 table
->TexGenfv
= save_TexGenfv
;
4330 table
->TexGeni
= save_TexGeni
;
4331 table
->TexGeniv
= save_TexGeniv
;
4332 table
->TexImage1D
= save_TexImage1D
;
4333 table
->TexImage2D
= save_TexImage2D
;
4334 table
->TexParameterf
= save_TexParameterf
;
4335 table
->TexParameterfv
= save_TexParameterfv
;
4336 table
->TexParameteri
= save_TexParameteri
;
4337 table
->TexParameteriv
= save_TexParameteriv
;
4338 table
->Translated
= save_Translated
;
4339 table
->Translatef
= save_Translatef
;
4340 table
->Vertex2d
= _mesa_Vertex2d
;
4341 table
->Vertex2dv
= _mesa_Vertex2dv
;
4342 table
->Vertex2f
= _mesa_Vertex2f
;
4343 table
->Vertex2fv
= _mesa_Vertex2fv
;
4344 table
->Vertex2i
= _mesa_Vertex2i
;
4345 table
->Vertex2iv
= _mesa_Vertex2iv
;
4346 table
->Vertex2s
= _mesa_Vertex2s
;
4347 table
->Vertex2sv
= _mesa_Vertex2sv
;
4348 table
->Vertex3d
= _mesa_Vertex3d
;
4349 table
->Vertex3dv
= _mesa_Vertex3dv
;
4350 table
->Vertex3f
= _mesa_Vertex3f
;
4351 table
->Vertex3fv
= _mesa_Vertex3fv
;
4352 table
->Vertex3i
= _mesa_Vertex3i
;
4353 table
->Vertex3iv
= _mesa_Vertex3iv
;
4354 table
->Vertex3s
= _mesa_Vertex3s
;
4355 table
->Vertex3sv
= _mesa_Vertex3sv
;
4356 table
->Vertex4d
= _mesa_Vertex4d
;
4357 table
->Vertex4dv
= _mesa_Vertex4dv
;
4358 table
->Vertex4f
= _mesa_Vertex4f
;
4359 table
->Vertex4fv
= _mesa_Vertex4fv
;
4360 table
->Vertex4i
= _mesa_Vertex4i
;
4361 table
->Vertex4iv
= _mesa_Vertex4iv
;
4362 table
->Vertex4s
= _mesa_Vertex4s
;
4363 table
->Vertex4sv
= _mesa_Vertex4sv
;
4364 table
->Viewport
= save_Viewport
;
4367 table
->AreTexturesResident
= _mesa_AreTexturesResident
;
4368 table
->ArrayElement
= _mesa_ArrayElement
;
4369 table
->BindTexture
= save_BindTexture
;
4370 table
->ColorPointer
= _mesa_ColorPointer
;
4371 table
->CopyTexImage1D
= save_CopyTexImage1D
;
4372 table
->CopyTexImage2D
= save_CopyTexImage2D
;
4373 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
4374 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
4375 table
->DeleteTextures
= _mesa_DeleteTextures
;
4376 table
->DisableClientState
= _mesa_DisableClientState
;
4377 table
->DrawArrays
= _mesa_DrawArrays
;
4378 table
->DrawElements
= _mesa_DrawElements
;
4379 table
->EdgeFlagPointer
= _mesa_EdgeFlagPointer
;
4380 table
->EnableClientState
= _mesa_EnableClientState
;
4381 table
->GenTextures
= _mesa_GenTextures
;
4382 table
->GetPointerv
= _mesa_GetPointerv
;
4383 table
->IndexPointer
= _mesa_IndexPointer
;
4384 table
->Indexub
= _mesa_Indexub
;
4385 table
->Indexubv
= _mesa_Indexubv
;
4386 table
->InterleavedArrays
= _mesa_InterleavedArrays
;
4387 table
->IsTexture
= _mesa_IsTexture
;
4388 table
->NormalPointer
= _mesa_NormalPointer
;
4389 table
->PopClientAttrib
= _mesa_PopClientAttrib
;
4390 table
->PrioritizeTextures
= save_PrioritizeTextures
;
4391 table
->PushClientAttrib
= _mesa_PushClientAttrib
;
4392 table
->TexCoordPointer
= _mesa_TexCoordPointer
;
4393 table
->TexSubImage1D
= save_TexSubImage1D
;
4394 table
->TexSubImage2D
= save_TexSubImage2D
;
4395 table
->VertexPointer
= _mesa_VertexPointer
;
4398 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
4399 table
->DrawRangeElements
= _mesa_DrawRangeElements
;
4400 table
->TexImage3D
= save_TexImage3D
;
4401 table
->TexSubImage3D
= save_TexSubImage3D
;
4403 /* GL_ARB_imaging */
4404 /* NOT supported, just call stub functions */
4405 table
->BlendColor
= _mesa_BlendColor
;
4406 table
->BlendEquation
= _mesa_BlendEquation
;
4407 table
->ColorSubTable
= _mesa_ColorSubTable
;
4408 table
->ColorTable
= _mesa_ColorTable
;
4409 table
->ColorTableParameterfv
= _mesa_ColorTableParameterfv
;
4410 table
->ColorTableParameteriv
= _mesa_ColorTableParameteriv
;
4411 table
->ConvolutionFilter1D
= _mesa_ConvolutionFilter1D
;
4412 table
->ConvolutionFilter2D
= _mesa_ConvolutionFilter2D
;
4413 table
->ConvolutionParameterf
= _mesa_ConvolutionParameterf
;
4414 table
->ConvolutionParameterfv
= _mesa_ConvolutionParameterfv
;
4415 table
->ConvolutionParameteri
= _mesa_ConvolutionParameteri
;
4416 table
->ConvolutionParameteriv
= _mesa_ConvolutionParameteriv
;
4417 table
->CopyColorSubTable
= _mesa_CopyColorSubTable
;
4418 table
->CopyColorTable
= _mesa_CopyColorTable
;
4419 table
->CopyConvolutionFilter1D
= _mesa_CopyConvolutionFilter1D
;
4420 table
->CopyConvolutionFilter2D
= _mesa_CopyConvolutionFilter2D
;
4421 table
->GetColorTable
= _mesa_GetColorTable
;
4422 table
->GetColorTableParameterfv
= _mesa_GetColorTableParameterfv
;
4423 table
->GetColorTableParameteriv
= _mesa_GetColorTableParameteriv
;
4424 table
->GetConvolutionFilter
= _mesa_GetConvolutionFilter
;
4425 table
->GetConvolutionParameterfv
= _mesa_GetConvolutionParameterfv
;
4426 table
->GetConvolutionParameteriv
= _mesa_GetConvolutionParameteriv
;
4427 table
->GetHistogram
= _mesa_GetHistogram
;
4428 table
->GetHistogramParameterfv
= _mesa_GetHistogramParameterfv
;
4429 table
->GetHistogramParameteriv
= _mesa_GetHistogramParameteriv
;
4430 table
->GetMinmax
= _mesa_GetMinmax
;
4431 table
->GetMinmaxParameterfv
= _mesa_GetMinmaxParameterfv
;
4432 table
->GetMinmaxParameteriv
= _mesa_GetMinmaxParameteriv
;
4433 table
->GetSeparableFilter
= _mesa_GetSeparableFilter
;
4434 table
->Histogram
= _mesa_Histogram
;
4435 table
->Minmax
= _mesa_Minmax
;
4436 table
->ResetHistogram
= _mesa_ResetHistogram
;
4437 table
->ResetMinmax
= _mesa_ResetMinmax
;
4438 table
->SeparableFilter2D
= _mesa_SeparableFilter2D
;
4440 /* 6. GL_EXT_texture3d */
4441 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
4442 table
->TexImage3DEXT
= save_TexImage3DEXT
;
4443 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
4445 /* GL_EXT_paletted_texture */
4446 table
->ColorTableEXT
= save_ColorTableEXT
;
4447 table
->ColorSubTableEXT
= save_ColorSubTableEXT
;
4448 table
->GetColorTableEXT
= _mesa_GetColorTableEXT
;
4449 table
->GetColorTableParameterfvEXT
= _mesa_GetColorTableParameterfvEXT
;
4450 table
->GetColorTableParameterivEXT
= _mesa_GetColorTableParameterivEXT
;
4452 /* GL_EXT_compiled_vertex_array */
4453 table
->LockArraysEXT
= _mesa_LockArraysEXT
;
4454 table
->UnlockArraysEXT
= _mesa_UnlockArraysEXT
;
4456 /* GL_EXT_point_parameters */
4457 table
->PointParameterfEXT
= save_PointParameterfEXT
;
4458 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
4460 /* GL_PGI_misc_hints */
4461 table
->HintPGI
= save_HintPGI
;
4463 /* GL_EXT_polygon_offset */
4464 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
4466 /* GL_EXT_blend_minmax */
4467 table
->BlendEquationEXT
= save_BlendEquation
;
4469 /* GL_EXT_blend_color */
4470 table
->BlendColorEXT
= save_BlendColor
;
4472 /* GL_ARB_multitexture */
4473 table
->ActiveTextureARB
= save_ActiveTextureARB
;
4474 table
->ClientActiveTextureARB
= save_ClientActiveTextureARB
;
4475 table
->MultiTexCoord1dARB
= _mesa_MultiTexCoord1dARB
;
4476 table
->MultiTexCoord1dvARB
= _mesa_MultiTexCoord1dvARB
;
4477 table
->MultiTexCoord1fARB
= _mesa_MultiTexCoord1fARB
;
4478 table
->MultiTexCoord1fvARB
= _mesa_MultiTexCoord1fvARB
;
4479 table
->MultiTexCoord1iARB
= _mesa_MultiTexCoord1iARB
;
4480 table
->MultiTexCoord1ivARB
= _mesa_MultiTexCoord1ivARB
;
4481 table
->MultiTexCoord1sARB
= _mesa_MultiTexCoord1sARB
;
4482 table
->MultiTexCoord1svARB
= _mesa_MultiTexCoord1svARB
;
4483 table
->MultiTexCoord2dARB
= _mesa_MultiTexCoord2dARB
;
4484 table
->MultiTexCoord2dvARB
= _mesa_MultiTexCoord2dvARB
;
4485 table
->MultiTexCoord2fARB
= _mesa_MultiTexCoord2fARB
;
4486 table
->MultiTexCoord2fvARB
= _mesa_MultiTexCoord2fvARB
;
4487 table
->MultiTexCoord2iARB
= _mesa_MultiTexCoord2iARB
;
4488 table
->MultiTexCoord2ivARB
= _mesa_MultiTexCoord2ivARB
;
4489 table
->MultiTexCoord2sARB
= _mesa_MultiTexCoord2sARB
;
4490 table
->MultiTexCoord2svARB
= _mesa_MultiTexCoord2svARB
;
4491 table
->MultiTexCoord3dARB
= _mesa_MultiTexCoord3dARB
;
4492 table
->MultiTexCoord3dvARB
= _mesa_MultiTexCoord3dvARB
;
4493 table
->MultiTexCoord3fARB
= _mesa_MultiTexCoord3fARB
;
4494 table
->MultiTexCoord3fvARB
= _mesa_MultiTexCoord3fvARB
;
4495 table
->MultiTexCoord3iARB
= _mesa_MultiTexCoord3iARB
;
4496 table
->MultiTexCoord3ivARB
= _mesa_MultiTexCoord3ivARB
;
4497 table
->MultiTexCoord3sARB
= _mesa_MultiTexCoord3sARB
;
4498 table
->MultiTexCoord3svARB
= _mesa_MultiTexCoord3svARB
;
4499 table
->MultiTexCoord4dARB
= _mesa_MultiTexCoord4dARB
;
4500 table
->MultiTexCoord4dvARB
= _mesa_MultiTexCoord4dvARB
;
4501 table
->MultiTexCoord4fARB
= _mesa_MultiTexCoord4fARB
;
4502 table
->MultiTexCoord4fvARB
= _mesa_MultiTexCoord4fvARB
;
4503 table
->MultiTexCoord4iARB
= _mesa_MultiTexCoord4iARB
;
4504 table
->MultiTexCoord4ivARB
= _mesa_MultiTexCoord4ivARB
;
4505 table
->MultiTexCoord4sARB
= _mesa_MultiTexCoord4sARB
;
4506 table
->MultiTexCoord4svARB
= _mesa_MultiTexCoord4svARB
;
4508 /* GL_INGR_blend_func_separate */
4509 table
->BlendFuncSeparateINGR
= save_BlendFuncSeparateINGR
;
4511 /* GL_MESA_window_pos */
4512 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
4514 /* GL_MESA_resize_buffers */
4515 table
->ResizeBuffersMESA
= _mesa_ResizeBuffersMESA
;
4517 /* GL_ARB_transpose_matrix */
4518 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
4519 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
4520 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
4521 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
4530 static const char *enum_string( GLenum k
)
4532 return gl_lookup_enum_by_nr( k
);
4537 * Print the commands in a display list. For debugging only.
4538 * TODO: many commands aren't handled yet.
4540 static void print_list( GLcontext
*ctx
, FILE *f
, GLuint list
)
4546 if (!glIsList(list
)) {
4547 fprintf(f
,"%u is not a display list ID\n",list
);
4551 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
4553 fprintf( f
, "START-LIST %u, address %p\n", list
, (void*)n
);
4555 done
= n
? GL_FALSE
: GL_TRUE
;
4557 opcode
= n
[0].opcode
;
4561 fprintf(f
,"accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
4564 fprintf(f
,"Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
4565 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
4567 case OPCODE_CALL_LIST
:
4568 fprintf(f
,"CallList %d\n", (int) n
[1].ui
);
4570 case OPCODE_CALL_LIST_OFFSET
:
4571 fprintf(f
,"CallList %d + offset %u = %u\n", (int) n
[1].ui
,
4572 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
4574 case OPCODE_DISABLE
:
4575 fprintf(f
,"Disable %s\n", enum_string(n
[1].e
));
4578 fprintf(f
,"Enable %s\n", enum_string(n
[1].e
));
4580 case OPCODE_FRUSTUM
:
4581 fprintf(f
,"Frustum %g %g %g %g %g %g\n",
4582 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4584 case OPCODE_LINE_STIPPLE
:
4585 fprintf(f
,"LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
4587 case OPCODE_LOAD_IDENTITY
:
4588 fprintf(f
,"LoadIdentity\n");
4590 case OPCODE_LOAD_MATRIX
:
4591 fprintf(f
,"LoadMatrix\n");
4592 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
4593 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
4594 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
4595 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
4597 case OPCODE_MULT_MATRIX
:
4598 fprintf(f
,"MultMatrix (or Rotate)\n");
4599 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
4600 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
4601 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
4602 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
4605 fprintf(f
,"Ortho %g %g %g %g %g %g\n",
4606 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4608 case OPCODE_POP_ATTRIB
:
4609 fprintf(f
,"PopAttrib\n");
4611 case OPCODE_POP_MATRIX
:
4612 fprintf(f
,"PopMatrix\n");
4614 case OPCODE_POP_NAME
:
4615 fprintf(f
,"PopName\n");
4617 case OPCODE_PUSH_ATTRIB
:
4618 fprintf(f
,"PushAttrib %x\n", n
[1].bf
);
4620 case OPCODE_PUSH_MATRIX
:
4621 fprintf(f
,"PushMatrix\n");
4623 case OPCODE_PUSH_NAME
:
4624 fprintf(f
,"PushName %d\n", (int) n
[1].ui
);
4626 case OPCODE_RASTER_POS
:
4627 fprintf(f
,"RasterPos %g %g %g %g\n", n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
4630 fprintf( f
, "Rectf %g %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4633 fprintf(f
,"Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
4635 case OPCODE_TRANSLATE
:
4636 fprintf(f
,"Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
4638 case OPCODE_BIND_TEXTURE
:
4639 fprintf(f
,"BindTexture %s %d\n", gl_lookup_enum_by_nr(n
[1].ui
),
4642 case OPCODE_SHADE_MODEL
:
4643 fprintf(f
,"ShadeModel %s\n", gl_lookup_enum_by_nr(n
[1].ui
));
4647 * meta opcodes/commands
4650 fprintf(f
,"Error: %s %s\n", enum_string(n
[1].e
), (const char *)n
[2].data
);
4652 case OPCODE_VERTEX_CASSETTE
:
4653 fprintf(f
,"VERTEX-CASSETTE, id %u, rows %u..%u\n",
4654 ((struct immediate
*) n
[1].data
)->id
,
4658 case OPCODE_CONTINUE
:
4659 fprintf(f
,"DISPLAY-LIST-CONTINUE\n");
4660 n
= (Node
*) n
[1].next
;
4662 case OPCODE_END_OF_LIST
:
4663 fprintf(f
,"END-LIST %u\n", list
);
4667 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
4668 fprintf(f
,"ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
4673 fprintf(f
,"command %d, %u operands\n",opcode
,InstSize
[opcode
]);
4677 /* increment n to point to next compiled command */
4678 if (opcode
!=OPCODE_CONTINUE
) {
4679 n
+= InstSize
[opcode
];
4687 * Clients may call this function to help debug display list problems.
4688 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
4689 * changed, or break in the future without notice.
4691 void mesa_print_display_list( GLuint list
)
4693 GET_CURRENT_CONTEXT(ctx
);
4694 print_list( ctx
, stderr
, list
);