1 /* $Id: dlist.c,v 1.42 2000/06/06 17:03:38 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
47 #include "extensions.h"
82 Functions which aren't compiled but executed immediately:
97 Functions which cause errors if called while compiling a display list:
104 * Display list instructions are stored as sequences of "nodes". Nodes
105 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
106 * are linked together with a pointer.
110 /* How many nodes to allocate at a time:
111 * - reduced now that we hold vertices etc. elsewhere.
113 #define BLOCK_SIZE 64
117 * Display list opcodes.
119 * The fact that these identifiers are assigned consecutive
120 * integer values starting at 0 is very important, see InstSize array usage)
122 * KW: Commented out opcodes now handled by vertex-cassettes.
130 OPCODE_BLEND_EQUATION
,
132 OPCODE_BLEND_FUNC_SEPARATE
,
134 OPCODE_CALL_LIST_OFFSET
,
140 OPCODE_CLEAR_STENCIL
,
143 OPCODE_COLOR_MATERIAL
,
145 OPCODE_COLOR_TABLE_PARAMETER_FV
,
146 OPCODE_COLOR_TABLE_PARAMETER_IV
,
147 OPCODE_COLOR_SUB_TABLE
,
148 OPCODE_CONVOLUTION_FILTER_1D
,
149 OPCODE_CONVOLUTION_FILTER_2D
,
150 OPCODE_CONVOLUTION_PARAMETER_I
,
151 OPCODE_CONVOLUTION_PARAMETER_IV
,
152 OPCODE_CONVOLUTION_PARAMETER_F
,
153 OPCODE_CONVOLUTION_PARAMETER_FV
,
154 OPCODE_COPY_COLOR_SUB_TABLE
,
155 OPCODE_COPY_COLOR_TABLE
,
157 OPCODE_COPY_TEX_IMAGE1D
,
158 OPCODE_COPY_TEX_IMAGE2D
,
159 OPCODE_COPY_TEX_SUB_IMAGE1D
,
160 OPCODE_COPY_TEX_SUB_IMAGE2D
,
161 OPCODE_COPY_TEX_SUB_IMAGE3D
,
189 OPCODE_LOAD_IDENTITY
,
203 OPCODE_PIXEL_TRANSFER
,
206 OPCODE_POINT_PARAMETERS
,
208 OPCODE_POLYGON_STIPPLE
,
209 OPCODE_POLYGON_OFFSET
,
213 OPCODE_PRIORITIZE_TEXTURE
,
220 OPCODE_RESET_HISTOGRAM
,
221 OPCODE_RESET_MIN_MAX
,
224 OPCODE_SELECT_TEXTURE_SGIS
,
225 OPCODE_SELECT_TEXTURE_COORD_SET
,
236 OPCODE_TEX_SUB_IMAGE1D
,
237 OPCODE_TEX_SUB_IMAGE2D
,
238 OPCODE_TEX_SUB_IMAGE3D
,
242 /* GL_ARB_multitexture */
243 OPCODE_ACTIVE_TEXTURE
,
244 OPCODE_CLIENT_ACTIVE_TEXTURE
,
245 /* GL_SGIX/SGIS_pixel_texture */
246 OPCODE_PIXEL_TEXGEN_SGIX
,
247 OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
,
248 /* GL_ARB_texture_compression */
249 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
250 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
251 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
252 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
253 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
254 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
255 /* The following three are meta instructions */
256 OPCODE_ERROR
, /* raise compiled-in error */
257 OPCODE_VERTEX_CASSETTE
, /* render prebuilt vertex buffer */
264 * Each instruction in the display list is stored as a sequence of
265 * contiguous nodes in memory.
266 * Each node is the union of a variety of datatypes.
280 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
285 /* Number of nodes of storage needed for each instruction: */
286 static GLuint InstSize
[ OPCODE_END_OF_LIST
+1 ];
288 void mesa_print_display_list( GLuint list
);
291 /**********************************************************************/
292 /***** Private *****/
293 /**********************************************************************/
297 * Allocate space for a display list instruction.
298 * Input: opcode - type of instruction
299 * argcount - number of arguments following the instruction
300 * Return: pointer to first node in the instruction
302 static Node
*alloc_instruction( GLcontext
*ctx
, OpCode opcode
, GLint argcount
)
305 GLuint count
= InstSize
[opcode
];
307 assert( (GLint
) count
== argcount
+1 );
309 if (ctx
->CurrentPos
+ count
+ 2 > BLOCK_SIZE
) {
310 /* This block is full. Allocate a new block and chain to it */
311 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
312 n
[0].opcode
= OPCODE_CONTINUE
;
313 newblock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
315 gl_error( ctx
, GL_OUT_OF_MEMORY
, "Building display list" );
318 n
[1].next
= (Node
*) newblock
;
319 ctx
->CurrentBlock
= newblock
;
323 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
324 ctx
->CurrentPos
+= count
;
326 n
[0].opcode
= opcode
;
334 * Make an empty display list. This is used by glGenLists() to
335 * reserver display list IDs.
337 static Node
*make_empty_list( void )
339 Node
*n
= (Node
*) MALLOC( sizeof(Node
) );
340 n
[0].opcode
= OPCODE_END_OF_LIST
;
347 * Destroy all nodes in a display list.
348 * Input: list - display list number
350 void gl_destroy_list( GLcontext
*ctx
, GLuint list
)
358 block
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
361 done
= block
? GL_FALSE
: GL_TRUE
;
363 switch (n
[0].opcode
) {
364 /* special cases first */
365 case OPCODE_VERTEX_CASSETTE
:
366 if ( ! -- ((struct immediate
*) n
[1].data
)->ref_count
)
367 gl_immediate_free( (struct immediate
*) n
[1].data
);
368 n
+= InstSize
[n
[0].opcode
];
372 n
+= InstSize
[n
[0].opcode
];
376 n
+= InstSize
[n
[0].opcode
];
378 case OPCODE_DRAW_PIXELS
:
380 n
+= InstSize
[n
[0].opcode
];
384 n
+= InstSize
[n
[0].opcode
];
386 case OPCODE_COLOR_TABLE
:
388 n
+= InstSize
[n
[0].opcode
];
390 case OPCODE_COLOR_SUB_TABLE
:
392 n
+= InstSize
[n
[0].opcode
];
394 case OPCODE_CONVOLUTION_FILTER_1D
:
396 n
+= InstSize
[n
[0].opcode
];
398 case OPCODE_CONVOLUTION_FILTER_2D
:
400 n
+= InstSize
[n
[0].opcode
];
402 case OPCODE_POLYGON_STIPPLE
:
404 n
+= InstSize
[n
[0].opcode
];
406 case OPCODE_TEX_IMAGE1D
:
408 n
+= InstSize
[n
[0].opcode
];
410 case OPCODE_TEX_IMAGE2D
:
412 n
+= InstSize
[n
[0].opcode
];
414 case OPCODE_TEX_IMAGE3D
:
416 n
+= InstSize
[n
[0].opcode
];
418 case OPCODE_TEX_SUB_IMAGE1D
:
420 n
+= InstSize
[n
[0].opcode
];
422 case OPCODE_TEX_SUB_IMAGE2D
:
424 n
+= InstSize
[n
[0].opcode
];
426 case OPCODE_TEX_SUB_IMAGE3D
:
428 n
+= InstSize
[n
[0].opcode
];
430 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
432 n
+= InstSize
[n
[0].opcode
];
434 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
436 n
+= InstSize
[n
[0].opcode
];
438 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
440 n
+= InstSize
[n
[0].opcode
];
442 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
444 n
+= InstSize
[n
[0].opcode
];
446 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
448 n
+= InstSize
[n
[0].opcode
];
450 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
452 n
+= InstSize
[n
[0].opcode
];
454 case OPCODE_CONTINUE
:
455 n
= (Node
*) n
[1].next
;
459 case OPCODE_END_OF_LIST
:
464 /* Most frequent case */
465 n
+= InstSize
[n
[0].opcode
];
470 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
476 * Translate the nth element of list from type to GLuint.
478 static GLuint
translate_id( GLsizei n
, GLenum type
, const GLvoid
*list
)
490 bptr
= (GLbyte
*) list
;
491 return (GLuint
) *(bptr
+n
);
492 case GL_UNSIGNED_BYTE
:
493 ubptr
= (GLubyte
*) list
;
494 return (GLuint
) *(ubptr
+n
);
496 sptr
= (GLshort
*) list
;
497 return (GLuint
) *(sptr
+n
);
498 case GL_UNSIGNED_SHORT
:
499 usptr
= (GLushort
*) list
;
500 return (GLuint
) *(usptr
+n
);
502 iptr
= (GLint
*) list
;
503 return (GLuint
) *(iptr
+n
);
504 case GL_UNSIGNED_INT
:
505 uiptr
= (GLuint
*) list
;
506 return (GLuint
) *(uiptr
+n
);
508 fptr
= (GLfloat
*) list
;
509 return (GLuint
) *(fptr
+n
);
511 ubptr
= ((GLubyte
*) list
) + 2*n
;
512 return (GLuint
) *ubptr
* 256 + (GLuint
) *(ubptr
+1);
514 ubptr
= ((GLubyte
*) list
) + 3*n
;
515 return (GLuint
) *ubptr
* 65536
516 + (GLuint
) *(ubptr
+1) * 256
517 + (GLuint
) *(ubptr
+2);
519 ubptr
= ((GLubyte
*) list
) + 4*n
;
520 return (GLuint
) *ubptr
* 16777216
521 + (GLuint
) *(ubptr
+1) * 65536
522 + (GLuint
) *(ubptr
+2) * 256
523 + (GLuint
) *(ubptr
+3);
532 /**********************************************************************/
534 /**********************************************************************/
536 void gl_init_lists( void )
538 static int init_flag
= 0;
541 InstSize
[OPCODE_ACCUM
] = 3;
542 InstSize
[OPCODE_ALPHA_FUNC
] = 3;
543 InstSize
[OPCODE_BIND_TEXTURE
] = 3;
544 InstSize
[OPCODE_BITMAP
] = 8;
545 InstSize
[OPCODE_BLEND_COLOR
] = 5;
546 InstSize
[OPCODE_BLEND_EQUATION
] = 2;
547 InstSize
[OPCODE_BLEND_FUNC
] = 3;
548 InstSize
[OPCODE_BLEND_FUNC_SEPARATE
] = 5;
549 InstSize
[OPCODE_CALL_LIST
] = 2;
550 InstSize
[OPCODE_CALL_LIST_OFFSET
] = 2;
551 InstSize
[OPCODE_CLEAR
] = 2;
552 InstSize
[OPCODE_CLEAR_ACCUM
] = 5;
553 InstSize
[OPCODE_CLEAR_COLOR
] = 5;
554 InstSize
[OPCODE_CLEAR_DEPTH
] = 2;
555 InstSize
[OPCODE_CLEAR_INDEX
] = 2;
556 InstSize
[OPCODE_CLEAR_STENCIL
] = 2;
557 InstSize
[OPCODE_CLIP_PLANE
] = 6;
558 InstSize
[OPCODE_COLOR_MASK
] = 5;
559 InstSize
[OPCODE_COLOR_MATERIAL
] = 3;
560 InstSize
[OPCODE_COLOR_TABLE
] = 7;
561 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_FV
] = 7;
562 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_IV
] = 7;
563 InstSize
[OPCODE_COLOR_SUB_TABLE
] = 7;
564 InstSize
[OPCODE_CONVOLUTION_FILTER_1D
] = 7;
565 InstSize
[OPCODE_CONVOLUTION_FILTER_2D
] = 8;
566 InstSize
[OPCODE_CONVOLUTION_PARAMETER_I
] = 4;
567 InstSize
[OPCODE_CONVOLUTION_PARAMETER_IV
] = 7;
568 InstSize
[OPCODE_CONVOLUTION_PARAMETER_F
] = 4;
569 InstSize
[OPCODE_CONVOLUTION_PARAMETER_FV
] = 7;
570 InstSize
[OPCODE_COPY_PIXELS
] = 6;
571 InstSize
[OPCODE_COPY_COLOR_SUB_TABLE
] = 6;
572 InstSize
[OPCODE_COPY_COLOR_TABLE
] = 6;
573 InstSize
[OPCODE_COPY_TEX_IMAGE1D
] = 8;
574 InstSize
[OPCODE_COPY_TEX_IMAGE2D
] = 9;
575 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE1D
] = 7;
576 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE2D
] = 9;
577 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE3D
] = 10;
578 InstSize
[OPCODE_CULL_FACE
] = 2;
579 InstSize
[OPCODE_DEPTH_FUNC
] = 2;
580 InstSize
[OPCODE_DEPTH_MASK
] = 2;
581 InstSize
[OPCODE_DEPTH_RANGE
] = 3;
582 InstSize
[OPCODE_DISABLE
] = 2;
583 InstSize
[OPCODE_DRAW_BUFFER
] = 2;
584 InstSize
[OPCODE_DRAW_PIXELS
] = 6;
585 InstSize
[OPCODE_ENABLE
] = 2;
586 InstSize
[OPCODE_EVALCOORD1
] = 2;
587 InstSize
[OPCODE_EVALCOORD2
] = 3;
588 InstSize
[OPCODE_EVALMESH1
] = 4;
589 InstSize
[OPCODE_EVALMESH2
] = 6;
590 InstSize
[OPCODE_EVALPOINT1
] = 2;
591 InstSize
[OPCODE_EVALPOINT2
] = 3;
592 InstSize
[OPCODE_FOG
] = 6;
593 InstSize
[OPCODE_FRONT_FACE
] = 2;
594 InstSize
[OPCODE_FRUSTUM
] = 7;
595 InstSize
[OPCODE_HINT
] = 3;
596 InstSize
[OPCODE_HINT_PGI
] = 3;
597 InstSize
[OPCODE_HISTOGRAM
] = 5;
598 InstSize
[OPCODE_INDEX_MASK
] = 2;
599 InstSize
[OPCODE_INIT_NAMES
] = 1;
600 InstSize
[OPCODE_LIGHT
] = 7;
601 InstSize
[OPCODE_LIGHT_MODEL
] = 6;
602 InstSize
[OPCODE_LINE_STIPPLE
] = 3;
603 InstSize
[OPCODE_LINE_WIDTH
] = 2;
604 InstSize
[OPCODE_LIST_BASE
] = 2;
605 InstSize
[OPCODE_LOAD_IDENTITY
] = 1;
606 InstSize
[OPCODE_LOAD_MATRIX
] = 17;
607 InstSize
[OPCODE_LOAD_NAME
] = 2;
608 InstSize
[OPCODE_LOGIC_OP
] = 2;
609 InstSize
[OPCODE_MAP1
] = 7;
610 InstSize
[OPCODE_MAP2
] = 11;
611 InstSize
[OPCODE_MAPGRID1
] = 4;
612 InstSize
[OPCODE_MAPGRID2
] = 7;
613 InstSize
[OPCODE_MATRIX_MODE
] = 2;
614 InstSize
[OPCODE_MIN_MAX
] = 4;
615 InstSize
[OPCODE_MULT_MATRIX
] = 17;
616 InstSize
[OPCODE_ORTHO
] = 7;
617 InstSize
[OPCODE_PASSTHROUGH
] = 2;
618 InstSize
[OPCODE_PIXEL_MAP
] = 4;
619 InstSize
[OPCODE_PIXEL_TRANSFER
] = 3;
620 InstSize
[OPCODE_PIXEL_ZOOM
] = 3;
621 InstSize
[OPCODE_POINT_SIZE
] = 2;
622 InstSize
[OPCODE_POINT_PARAMETERS
] = 5;
623 InstSize
[OPCODE_POLYGON_MODE
] = 3;
624 InstSize
[OPCODE_POLYGON_STIPPLE
] = 2;
625 InstSize
[OPCODE_POLYGON_OFFSET
] = 3;
626 InstSize
[OPCODE_POP_ATTRIB
] = 1;
627 InstSize
[OPCODE_POP_MATRIX
] = 1;
628 InstSize
[OPCODE_POP_NAME
] = 1;
629 InstSize
[OPCODE_PRIORITIZE_TEXTURE
] = 3;
630 InstSize
[OPCODE_PUSH_ATTRIB
] = 2;
631 InstSize
[OPCODE_PUSH_MATRIX
] = 1;
632 InstSize
[OPCODE_PUSH_NAME
] = 2;
633 InstSize
[OPCODE_RASTER_POS
] = 5;
634 InstSize
[OPCODE_RECTF
] = 5;
635 InstSize
[OPCODE_READ_BUFFER
] = 2;
636 InstSize
[OPCODE_RESET_HISTOGRAM
] = 2;
637 InstSize
[OPCODE_RESET_MIN_MAX
] = 2;
638 InstSize
[OPCODE_SCALE
] = 4;
639 InstSize
[OPCODE_SCISSOR
] = 5;
640 InstSize
[OPCODE_STENCIL_FUNC
] = 4;
641 InstSize
[OPCODE_STENCIL_MASK
] = 2;
642 InstSize
[OPCODE_STENCIL_OP
] = 4;
643 InstSize
[OPCODE_SHADE_MODEL
] = 2;
644 InstSize
[OPCODE_TEXENV
] = 7;
645 InstSize
[OPCODE_TEXGEN
] = 7;
646 InstSize
[OPCODE_TEXPARAMETER
] = 7;
647 InstSize
[OPCODE_TEX_IMAGE1D
] = 9;
648 InstSize
[OPCODE_TEX_IMAGE2D
] = 10;
649 InstSize
[OPCODE_TEX_IMAGE3D
] = 11;
650 InstSize
[OPCODE_TEX_SUB_IMAGE1D
] = 8;
651 InstSize
[OPCODE_TEX_SUB_IMAGE2D
] = 10;
652 InstSize
[OPCODE_TEX_SUB_IMAGE3D
] = 12;
653 InstSize
[OPCODE_TRANSLATE
] = 4;
654 InstSize
[OPCODE_VIEWPORT
] = 5;
655 InstSize
[OPCODE_WINDOW_POS
] = 5;
656 InstSize
[OPCODE_CONTINUE
] = 2;
657 InstSize
[OPCODE_ERROR
] = 3;
658 InstSize
[OPCODE_VERTEX_CASSETTE
] = 9;
659 InstSize
[OPCODE_END_OF_LIST
] = 1;
660 /* GL_SGIX/SGIS_pixel_texture */
661 InstSize
[OPCODE_PIXEL_TEXGEN_SGIX
] = 2;
662 InstSize
[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
] = 3;
663 /* GL_ARB_texture_compression */
664 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_1D
] = 8;
665 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_2D
] = 9;
666 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_3D
] = 10;
667 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
] = 8;
668 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
] = 10;
669 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
] = 12;
670 /* GL_ARB_multitexture */
671 InstSize
[OPCODE_ACTIVE_TEXTURE
] = 2;
672 InstSize
[OPCODE_CLIENT_ACTIVE_TEXTURE
] = 2;
679 * Display List compilation functions
684 static void save_Accum( GLenum op
, GLfloat value
)
686 GET_CURRENT_CONTEXT(ctx
);
688 FLUSH_VB(ctx
, "dlist");
689 n
= alloc_instruction( ctx
, OPCODE_ACCUM
, 2 );
694 if (ctx
->ExecuteFlag
) {
695 (*ctx
->Exec
->Accum
)( op
, value
);
700 static void save_AlphaFunc( GLenum func
, GLclampf ref
)
702 GET_CURRENT_CONTEXT(ctx
);
704 FLUSH_VB(ctx
, "dlist");
705 n
= alloc_instruction( ctx
, OPCODE_ALPHA_FUNC
, 2 );
708 n
[2].f
= (GLfloat
) ref
;
710 if (ctx
->ExecuteFlag
) {
711 (*ctx
->Exec
->AlphaFunc
)( func
, ref
);
716 static void save_Begin( GLenum mode
)
718 _mesa_Begin(mode
); /* special case */
722 static void save_BindTexture( GLenum target
, GLuint texture
)
724 GET_CURRENT_CONTEXT(ctx
);
726 FLUSH_VB(ctx
, "dlist");
727 n
= alloc_instruction( ctx
, OPCODE_BIND_TEXTURE
, 2 );
732 if (ctx
->ExecuteFlag
) {
733 (*ctx
->Exec
->BindTexture
)( target
, texture
);
738 static void save_Bitmap( GLsizei width
, GLsizei height
,
739 GLfloat xorig
, GLfloat yorig
,
740 GLfloat xmove
, GLfloat ymove
,
741 const GLubyte
*pixels
)
743 GET_CURRENT_CONTEXT(ctx
);
744 GLvoid
*image
= _mesa_unpack_bitmap( width
, height
, pixels
, &ctx
->Unpack
);
746 FLUSH_VB(ctx
, "dlist");
747 n
= alloc_instruction( ctx
, OPCODE_BITMAP
, 7 );
749 n
[1].i
= (GLint
) width
;
750 n
[2].i
= (GLint
) height
;
760 if (ctx
->ExecuteFlag
) {
761 (*ctx
->Exec
->Bitmap
)( width
, height
,
762 xorig
, yorig
, xmove
, ymove
, pixels
);
767 static void save_BlendEquation( GLenum mode
)
769 GET_CURRENT_CONTEXT(ctx
);
771 FLUSH_VB(ctx
, "dlist");
772 n
= alloc_instruction( ctx
, OPCODE_BLEND_EQUATION
, 1 );
776 if (ctx
->ExecuteFlag
) {
777 (*ctx
->Exec
->BlendEquation
)( mode
);
782 static void save_BlendFunc( GLenum sfactor
, GLenum dfactor
)
784 GET_CURRENT_CONTEXT(ctx
);
786 FLUSH_VB(ctx
, "dlist");
787 n
= alloc_instruction( ctx
, OPCODE_BLEND_FUNC
, 2 );
792 if (ctx
->ExecuteFlag
) {
793 (*ctx
->Exec
->BlendFunc
)( sfactor
, dfactor
);
798 static void save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
799 GLenum sfactorA
, GLenum dfactorA
)
801 GET_CURRENT_CONTEXT(ctx
);
803 FLUSH_VB(ctx
, "dlist");
804 n
= alloc_instruction( ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4 );
811 if (ctx
->ExecuteFlag
) {
812 (*ctx
->Exec
->BlendFuncSeparateEXT
)( sfactorRGB
, dfactorRGB
,
818 static void save_BlendColor( GLfloat red
, GLfloat green
,
819 GLfloat blue
, GLfloat alpha
)
821 GET_CURRENT_CONTEXT(ctx
);
823 FLUSH_VB(ctx
, "dlist");
824 n
= alloc_instruction( ctx
, OPCODE_BLEND_COLOR
, 4 );
831 if (ctx
->ExecuteFlag
) {
832 (*ctx
->Exec
->BlendColor
)( red
, green
, blue
, alpha
);
837 static void save_CallList( GLuint list
)
839 GET_CURRENT_CONTEXT(ctx
);
841 FLUSH_VB(ctx
, "dlist");
842 n
= alloc_instruction( ctx
, OPCODE_CALL_LIST
, 1 );
846 if (ctx
->ExecuteFlag
) {
847 (*ctx
->Exec
->CallList
)( list
);
852 static void save_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
854 GET_CURRENT_CONTEXT(ctx
);
856 FLUSH_VB(ctx
, "dlist");
859 GLuint list
= translate_id( i
, type
, lists
);
860 Node
*n
= alloc_instruction( ctx
, OPCODE_CALL_LIST_OFFSET
, 1 );
865 if (ctx
->ExecuteFlag
) {
866 (*ctx
->Exec
->CallLists
)( n
, type
, lists
);
871 static void save_Clear( GLbitfield mask
)
873 GET_CURRENT_CONTEXT(ctx
);
875 FLUSH_VB(ctx
, "dlist");
876 n
= alloc_instruction( ctx
, OPCODE_CLEAR
, 1 );
880 if (ctx
->ExecuteFlag
) {
881 (*ctx
->Exec
->Clear
)( mask
);
886 static void save_ClearAccum( GLfloat red
, GLfloat green
,
887 GLfloat blue
, GLfloat alpha
)
889 GET_CURRENT_CONTEXT(ctx
);
891 FLUSH_VB(ctx
, "dlist");
892 n
= alloc_instruction( ctx
, OPCODE_CLEAR_ACCUM
, 4 );
899 if (ctx
->ExecuteFlag
) {
900 (*ctx
->Exec
->ClearAccum
)( red
, green
, blue
, alpha
);
905 static void save_ClearColor( GLclampf red
, GLclampf green
,
906 GLclampf blue
, GLclampf alpha
)
908 GET_CURRENT_CONTEXT(ctx
);
910 FLUSH_VB(ctx
, "dlist");
911 n
= alloc_instruction( ctx
, OPCODE_CLEAR_COLOR
, 4 );
918 if (ctx
->ExecuteFlag
) {
919 (*ctx
->Exec
->ClearColor
)( red
, green
, blue
, alpha
);
924 static void save_ClearDepth( GLclampd depth
)
926 GET_CURRENT_CONTEXT(ctx
);
928 FLUSH_VB(ctx
, "dlist");
929 n
= alloc_instruction( ctx
, OPCODE_CLEAR_DEPTH
, 1 );
931 n
[1].f
= (GLfloat
) depth
;
933 if (ctx
->ExecuteFlag
) {
934 (*ctx
->Exec
->ClearDepth
)( depth
);
939 static void save_ClearIndex( GLfloat c
)
941 GET_CURRENT_CONTEXT(ctx
);
943 FLUSH_VB(ctx
, "dlist");
944 n
= alloc_instruction( ctx
, OPCODE_CLEAR_INDEX
, 1 );
948 if (ctx
->ExecuteFlag
) {
949 (*ctx
->Exec
->ClearIndex
)( c
);
954 static void save_ClearStencil( GLint s
)
956 GET_CURRENT_CONTEXT(ctx
);
958 FLUSH_VB(ctx
, "dlist");
959 n
= alloc_instruction( ctx
, OPCODE_CLEAR_STENCIL
, 1 );
963 if (ctx
->ExecuteFlag
) {
964 (*ctx
->Exec
->ClearStencil
)( s
);
969 static void save_ClipPlane( GLenum plane
, const GLdouble
*equ
)
971 GET_CURRENT_CONTEXT(ctx
);
973 FLUSH_VB(ctx
, "dlist");
974 n
= alloc_instruction( ctx
, OPCODE_CLIP_PLANE
, 5 );
982 if (ctx
->ExecuteFlag
) {
983 (*ctx
->Exec
->ClipPlane
)( plane
, equ
);
989 static void save_ColorMask( GLboolean red
, GLboolean green
,
990 GLboolean blue
, GLboolean alpha
)
992 GET_CURRENT_CONTEXT(ctx
);
994 FLUSH_VB(ctx
, "dlist");
995 n
= alloc_instruction( ctx
, OPCODE_COLOR_MASK
, 4 );
1002 if (ctx
->ExecuteFlag
) {
1003 (*ctx
->Exec
->ColorMask
)( red
, green
, blue
, alpha
);
1008 static void save_ColorMaterial( GLenum face
, GLenum mode
)
1010 GET_CURRENT_CONTEXT(ctx
);
1012 FLUSH_VB(ctx
, "dlist");
1013 n
= alloc_instruction( ctx
, OPCODE_COLOR_MATERIAL
, 2 );
1018 if (ctx
->ExecuteFlag
) {
1019 (*ctx
->Exec
->ColorMaterial
)( face
, mode
);
1024 static void save_ColorTable( GLenum target
, GLenum internalFormat
,
1025 GLsizei width
, GLenum format
, GLenum type
,
1026 const GLvoid
*table
)
1028 GET_CURRENT_CONTEXT(ctx
);
1029 if (target
== GL_PROXY_TEXTURE_1D
||
1030 target
== GL_PROXY_TEXTURE_2D
||
1031 target
== GL_PROXY_TEXTURE_3D
) {
1032 /* execute immediately */
1033 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1034 format
, type
, table
);
1037 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, table
,
1040 FLUSH_VB(ctx
, "dlist");
1041 n
= alloc_instruction( ctx
, OPCODE_COLOR_TABLE
, 6 );
1044 n
[2].e
= internalFormat
;
1053 if (ctx
->ExecuteFlag
) {
1054 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1055 format
, type
, table
);
1063 save_ColorTableParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1065 GET_CURRENT_CONTEXT(ctx
);
1068 ASSERT_OUTSIDE_BEGIN_END(ctx
, "glColorTableParameterfv");
1069 FLUSH_VB(ctx
, "dlist");
1071 n
= alloc_instruction( ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6 );
1076 if (pname
== GL_COLOR_TABLE_SGI
||
1077 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1078 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
) {
1085 if (ctx
->ExecuteFlag
) {
1086 (*ctx
->Exec
->ColorTableParameterfv
)( target
, pname
, params
);
1092 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1094 GET_CURRENT_CONTEXT(ctx
);
1097 ASSERT_OUTSIDE_BEGIN_END(ctx
, "glColorTableParameterfv");
1098 FLUSH_VB(ctx
, "dlist");
1100 n
= alloc_instruction( ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6 );
1105 if (pname
== GL_COLOR_TABLE_SGI
||
1106 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1107 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
) {
1114 if (ctx
->ExecuteFlag
) {
1115 (*ctx
->Exec
->ColorTableParameteriv
)( target
, pname
, params
);
1121 static void save_ColorSubTable( GLenum target
, GLsizei start
, GLsizei count
,
1122 GLenum format
, GLenum type
,
1123 const GLvoid
*table
)
1125 GET_CURRENT_CONTEXT(ctx
);
1126 GLvoid
*image
= _mesa_unpack_image(count
, 1, 1, format
, type
, table
,
1129 FLUSH_VB(ctx
, "dlist");
1130 n
= alloc_instruction( ctx
, OPCODE_COLOR_SUB_TABLE
, 6 );
1142 if (ctx
->ExecuteFlag
) {
1143 (*ctx
->Exec
->ColorSubTable
)(target
, start
, count
, format
, type
, table
);
1149 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1150 GLint x
, GLint y
, GLsizei width
)
1152 GET_CURRENT_CONTEXT(ctx
);
1155 FLUSH_VB(ctx
, "dlist");
1156 n
= alloc_instruction( ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 6 );
1164 if (ctx
->ExecuteFlag
) {
1165 (*ctx
->Exec
->CopyColorSubTable
)(target
, start
, x
, y
, width
);
1171 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1172 GLint x
, GLint y
, GLsizei width
)
1174 GET_CURRENT_CONTEXT(ctx
);
1177 FLUSH_VB(ctx
, "dlist");
1178 n
= alloc_instruction( ctx
, OPCODE_COPY_COLOR_TABLE
, 6 );
1181 n
[2].e
= internalformat
;
1186 if (ctx
->ExecuteFlag
) {
1187 (*ctx
->Exec
->CopyColorTable
)(target
, internalformat
, x
, y
, width
);
1193 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1194 GLenum format
, GLenum type
, const GLvoid
*filter
)
1196 GET_CURRENT_CONTEXT(ctx
);
1197 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, filter
,
1200 FLUSH_VB(ctx
, "dlist");
1201 n
= alloc_instruction( ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6 );
1204 n
[2].e
= internalFormat
;
1213 if (ctx
->ExecuteFlag
) {
1214 (*ctx
->Exec
->ConvolutionFilter1D
)( target
, internalFormat
, width
,
1215 format
, type
, filter
);
1221 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1222 GLsizei width
, GLsizei height
, GLenum format
,
1223 GLenum type
, const GLvoid
*filter
)
1225 GET_CURRENT_CONTEXT(ctx
);
1226 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
, filter
,
1229 FLUSH_VB(ctx
, "dlist");
1230 n
= alloc_instruction( ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7 );
1233 n
[2].e
= internalFormat
;
1243 if (ctx
->ExecuteFlag
) {
1244 (*ctx
->Exec
->ConvolutionFilter2D
)( target
, internalFormat
, width
, height
,
1245 format
, type
, filter
);
1251 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1253 GET_CURRENT_CONTEXT(ctx
);
1255 FLUSH_VB(ctx
, "dlist");
1256 n
= alloc_instruction( ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3 );
1262 if (ctx
->ExecuteFlag
) {
1263 (*ctx
->Exec
->ConvolutionParameteri
)( target
, pname
, param
);
1269 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1271 GET_CURRENT_CONTEXT(ctx
);
1273 FLUSH_VB(ctx
, "dlist");
1274 n
= alloc_instruction( ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6 );
1279 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1280 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1281 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1287 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1290 if (ctx
->ExecuteFlag
) {
1291 (*ctx
->Exec
->ConvolutionParameteriv
)( target
, pname
, params
);
1297 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1299 GET_CURRENT_CONTEXT(ctx
);
1301 FLUSH_VB(ctx
, "dlist");
1302 n
= alloc_instruction( ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3 );
1308 if (ctx
->ExecuteFlag
) {
1309 (*ctx
->Exec
->ConvolutionParameterf
)( target
, pname
, param
);
1315 save_ConvolutionParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1317 GET_CURRENT_CONTEXT(ctx
);
1319 FLUSH_VB(ctx
, "dlist");
1320 n
= alloc_instruction( ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6 );
1325 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1326 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1327 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1333 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1336 if (ctx
->ExecuteFlag
) {
1337 (*ctx
->Exec
->ConvolutionParameterfv
)( target
, pname
, params
);
1342 static void save_CopyPixels( GLint x
, GLint y
,
1343 GLsizei width
, GLsizei height
, GLenum type
)
1345 GET_CURRENT_CONTEXT(ctx
);
1347 FLUSH_VB(ctx
, "dlist");
1348 n
= alloc_instruction( ctx
, OPCODE_COPY_PIXELS
, 5 );
1352 n
[3].i
= (GLint
) width
;
1353 n
[4].i
= (GLint
) height
;
1356 if (ctx
->ExecuteFlag
) {
1357 (*ctx
->Exec
->CopyPixels
)( x
, y
, width
, height
, type
);
1364 save_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
1365 GLint x
, GLint y
, GLsizei width
, GLint border
)
1367 GET_CURRENT_CONTEXT(ctx
);
1369 FLUSH_VB(ctx
, "dlist");
1370 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7 );
1374 n
[3].e
= internalformat
;
1380 if (ctx
->ExecuteFlag
) {
1381 (*ctx
->Exec
->CopyTexImage1D
)( target
, level
, internalformat
,
1382 x
, y
, width
, border
);
1388 save_CopyTexImage2D( GLenum target
, GLint level
,
1389 GLenum internalformat
,
1390 GLint x
, GLint y
, GLsizei width
,
1391 GLsizei height
, GLint border
)
1393 GET_CURRENT_CONTEXT(ctx
);
1395 FLUSH_VB(ctx
, "dlist");
1396 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8 );
1400 n
[3].e
= internalformat
;
1407 if (ctx
->ExecuteFlag
) {
1408 (*ctx
->Exec
->CopyTexImage2D
)( target
, level
, internalformat
,
1409 x
, y
, width
, height
, border
);
1416 save_CopyTexSubImage1D( GLenum target
, GLint level
,
1417 GLint xoffset
, GLint x
, GLint y
,
1420 GET_CURRENT_CONTEXT(ctx
);
1422 FLUSH_VB(ctx
, "dlist");
1423 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6 );
1432 if (ctx
->ExecuteFlag
) {
1433 (*ctx
->Exec
->CopyTexSubImage1D
)( target
, level
, xoffset
, x
, y
, width
);
1439 save_CopyTexSubImage2D( GLenum target
, GLint level
,
1440 GLint xoffset
, GLint yoffset
,
1442 GLsizei width
, GLint height
)
1444 GET_CURRENT_CONTEXT(ctx
);
1446 FLUSH_VB(ctx
, "dlist");
1447 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8 );
1458 if (ctx
->ExecuteFlag
) {
1459 (*ctx
->Exec
->CopyTexSubImage2D
)( target
, level
, xoffset
, yoffset
,
1460 x
, y
, width
, height
);
1466 save_CopyTexSubImage3D( GLenum target
, GLint level
,
1467 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1469 GLsizei width
, GLint height
)
1471 GET_CURRENT_CONTEXT(ctx
);
1473 FLUSH_VB(ctx
, "dlist");
1474 n
= alloc_instruction( ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9 );
1486 if (ctx
->ExecuteFlag
) {
1487 (*ctx
->Exec
->CopyTexSubImage3D
)( target
, level
,
1488 xoffset
, yoffset
, zoffset
,
1489 x
, y
, width
, height
);
1494 static void save_CullFace( GLenum mode
)
1496 GET_CURRENT_CONTEXT(ctx
);
1498 FLUSH_VB(ctx
, "dlist");
1499 n
= alloc_instruction( ctx
, OPCODE_CULL_FACE
, 1 );
1503 if (ctx
->ExecuteFlag
) {
1504 (*ctx
->Exec
->CullFace
)( mode
);
1509 static void save_DepthFunc( GLenum func
)
1511 GET_CURRENT_CONTEXT(ctx
);
1513 FLUSH_VB(ctx
, "dlist");
1514 n
= alloc_instruction( ctx
, OPCODE_DEPTH_FUNC
, 1 );
1518 if (ctx
->ExecuteFlag
) {
1519 (*ctx
->Exec
->DepthFunc
)( func
);
1524 static void save_DepthMask( GLboolean mask
)
1526 GET_CURRENT_CONTEXT(ctx
);
1528 FLUSH_VB(ctx
, "dlist");
1529 n
= alloc_instruction( ctx
, OPCODE_DEPTH_MASK
, 1 );
1533 if (ctx
->ExecuteFlag
) {
1534 (*ctx
->Exec
->DepthMask
)( mask
);
1539 static void save_DepthRange( GLclampd nearval
, GLclampd farval
)
1541 GET_CURRENT_CONTEXT(ctx
);
1543 FLUSH_VB(ctx
, "dlist");
1544 n
= alloc_instruction( ctx
, OPCODE_DEPTH_RANGE
, 2 );
1546 n
[1].f
= (GLfloat
) nearval
;
1547 n
[2].f
= (GLfloat
) farval
;
1549 if (ctx
->ExecuteFlag
) {
1550 (*ctx
->Exec
->DepthRange
)( nearval
, farval
);
1555 static void save_Disable( GLenum cap
)
1557 GET_CURRENT_CONTEXT(ctx
);
1559 FLUSH_VB(ctx
, "dlist");
1560 n
= alloc_instruction( ctx
, OPCODE_DISABLE
, 1 );
1564 if (ctx
->ExecuteFlag
) {
1565 (*ctx
->Exec
->Disable
)( cap
);
1570 static void save_DrawBuffer( GLenum mode
)
1572 GET_CURRENT_CONTEXT(ctx
);
1574 FLUSH_VB(ctx
, "dlist");
1575 n
= alloc_instruction( ctx
, OPCODE_DRAW_BUFFER
, 1 );
1579 if (ctx
->ExecuteFlag
) {
1580 (*ctx
->Exec
->DrawBuffer
)( mode
);
1585 static void save_DrawPixels( GLsizei width
, GLsizei height
,
1586 GLenum format
, GLenum type
,
1587 const GLvoid
*pixels
)
1589 GET_CURRENT_CONTEXT(ctx
);
1590 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
1591 pixels
, &ctx
->Unpack
);
1593 FLUSH_VB(ctx
, "dlist");
1594 n
= alloc_instruction( ctx
, OPCODE_DRAW_PIXELS
, 5 );
1605 if (ctx
->ExecuteFlag
) {
1606 (*ctx
->Exec
->DrawPixels
)( width
, height
, format
, type
, pixels
);
1612 static void save_Enable( GLenum cap
)
1614 GET_CURRENT_CONTEXT(ctx
);
1616 FLUSH_VB(ctx
, "dlist");
1617 n
= alloc_instruction( ctx
, OPCODE_ENABLE
, 1 );
1621 if (ctx
->ExecuteFlag
) {
1622 (*ctx
->Exec
->Enable
)( cap
);
1628 static void save_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
1630 GET_CURRENT_CONTEXT(ctx
);
1632 FLUSH_VB(ctx
, "dlist");
1633 n
= alloc_instruction( ctx
, OPCODE_EVALMESH1
, 3 );
1639 if (ctx
->ExecuteFlag
) {
1640 (*ctx
->Exec
->EvalMesh1
)( mode
, i1
, i2
);
1645 static void save_EvalMesh2(
1646 GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1648 GET_CURRENT_CONTEXT(ctx
);
1650 FLUSH_VB(ctx
, "dlist");
1651 n
= alloc_instruction( ctx
, OPCODE_EVALMESH2
, 5 );
1659 if (ctx
->ExecuteFlag
) {
1660 (*ctx
->Exec
->EvalMesh2
)( mode
, i1
, i2
, j1
, j2
);
1667 static void save_Fogfv( GLenum pname
, const GLfloat
*params
)
1669 GET_CURRENT_CONTEXT(ctx
);
1671 FLUSH_VB(ctx
, "dlist");
1672 n
= alloc_instruction( ctx
, OPCODE_FOG
, 5 );
1680 if (ctx
->ExecuteFlag
) {
1681 (*ctx
->Exec
->Fogfv
)( pname
, params
);
1686 static void save_Fogf( GLenum pname
, GLfloat param
)
1688 save_Fogfv(pname
, ¶m
);
1692 static void save_Fogiv(GLenum pname
, const GLint
*params
)
1697 case GL_FOG_DENSITY
:
1701 p
[0] = (GLfloat
) *params
;
1704 p
[0] = INT_TO_FLOAT( params
[0] );
1705 p
[1] = INT_TO_FLOAT( params
[1] );
1706 p
[2] = INT_TO_FLOAT( params
[2] );
1707 p
[3] = INT_TO_FLOAT( params
[3] );
1710 /* Error will be caught later in gl_Fogfv */
1713 save_Fogfv(pname
, p
);
1717 static void save_Fogi(GLenum pname
, GLint param
)
1719 save_Fogiv(pname
, ¶m
);
1723 static void save_FrontFace( GLenum mode
)
1725 GET_CURRENT_CONTEXT(ctx
);
1727 FLUSH_VB(ctx
, "dlist");
1728 n
= alloc_instruction( ctx
, OPCODE_FRONT_FACE
, 1 );
1732 if (ctx
->ExecuteFlag
) {
1733 (*ctx
->Exec
->FrontFace
)( mode
);
1738 static void save_Frustum( GLdouble left
, GLdouble right
,
1739 GLdouble bottom
, GLdouble top
,
1740 GLdouble nearval
, GLdouble farval
)
1742 GET_CURRENT_CONTEXT(ctx
);
1744 FLUSH_VB(ctx
, "dlist");
1745 n
= alloc_instruction( ctx
, OPCODE_FRUSTUM
, 6 );
1754 if (ctx
->ExecuteFlag
) {
1755 (*ctx
->Exec
->Frustum
)( left
, right
, bottom
, top
, nearval
, farval
);
1760 static void save_Hint( GLenum target
, GLenum mode
)
1762 GET_CURRENT_CONTEXT(ctx
);
1764 FLUSH_VB(ctx
, "dlist");
1765 n
= alloc_instruction( ctx
, OPCODE_HINT
, 2 );
1770 if (ctx
->ExecuteFlag
) {
1771 (*ctx
->Exec
->Hint
)( target
, mode
);
1776 /* GL_PGI_misc_hints*/
1777 static void save_HintPGI( GLenum target
, GLint mode
)
1779 GET_CURRENT_CONTEXT(ctx
);
1781 FLUSH_VB(ctx
, "dlist");
1782 n
= alloc_instruction( ctx
, OPCODE_HINT_PGI
, 2 );
1787 if (ctx
->ExecuteFlag
) {
1788 (*ctx
->Exec
->HintPGI
)( target
, mode
);
1794 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
, GLboolean sink
)
1796 GET_CURRENT_CONTEXT(ctx
);
1799 FLUSH_VB(ctx
, "dlist");
1800 n
= alloc_instruction( ctx
, OPCODE_HISTOGRAM
, 4 );
1804 n
[3].e
= internalFormat
;
1807 if (ctx
->ExecuteFlag
) {
1808 (*ctx
->Exec
->Histogram
)( target
, width
, internalFormat
, sink
);
1813 static void save_IndexMask( GLuint mask
)
1815 GET_CURRENT_CONTEXT(ctx
);
1817 FLUSH_VB(ctx
, "dlist");
1818 n
= alloc_instruction( ctx
, OPCODE_INDEX_MASK
, 1 );
1822 if (ctx
->ExecuteFlag
) {
1823 (*ctx
->Exec
->IndexMask
)( mask
);
1828 static void save_InitNames( void )
1830 GET_CURRENT_CONTEXT(ctx
);
1831 FLUSH_VB(ctx
, "dlist");
1832 (void) alloc_instruction( ctx
, OPCODE_INIT_NAMES
, 0 );
1833 if (ctx
->ExecuteFlag
) {
1834 (*ctx
->Exec
->InitNames
)();
1839 static void save_Lightfv( GLenum light
, GLenum pname
, const GLfloat
*params
)
1841 GET_CURRENT_CONTEXT(ctx
);
1843 FLUSH_VB(ctx
, "dlist");
1844 n
= alloc_instruction( ctx
, OPCODE_LIGHT
, 6 );
1862 case GL_SPOT_DIRECTION
:
1865 case GL_SPOT_EXPONENT
:
1868 case GL_SPOT_CUTOFF
:
1871 case GL_CONSTANT_ATTENUATION
:
1874 case GL_LINEAR_ATTENUATION
:
1877 case GL_QUADRATIC_ATTENUATION
:
1883 for (i
= 0; i
< nParams
; i
++) {
1884 n
[3+i
].f
= params
[i
];
1887 if (ctx
->ExecuteFlag
) {
1888 (*ctx
->Exec
->Lightfv
)( light
, pname
, params
);
1893 static void save_Lightf( GLenum light
, GLenum pname
, GLfloat params
)
1895 save_Lightfv(light
, pname
, ¶ms
);
1899 static void save_Lightiv( GLenum light
, GLenum pname
, const GLint
*params
)
1906 fparam
[0] = INT_TO_FLOAT( params
[0] );
1907 fparam
[1] = INT_TO_FLOAT( params
[1] );
1908 fparam
[2] = INT_TO_FLOAT( params
[2] );
1909 fparam
[3] = INT_TO_FLOAT( params
[3] );
1912 fparam
[0] = (GLfloat
) params
[0];
1913 fparam
[1] = (GLfloat
) params
[1];
1914 fparam
[2] = (GLfloat
) params
[2];
1915 fparam
[3] = (GLfloat
) params
[3];
1917 case GL_SPOT_DIRECTION
:
1918 fparam
[0] = (GLfloat
) params
[0];
1919 fparam
[1] = (GLfloat
) params
[1];
1920 fparam
[2] = (GLfloat
) params
[2];
1922 case GL_SPOT_EXPONENT
:
1923 case GL_SPOT_CUTOFF
:
1924 case GL_CONSTANT_ATTENUATION
:
1925 case GL_LINEAR_ATTENUATION
:
1926 case GL_QUADRATIC_ATTENUATION
:
1927 fparam
[0] = (GLfloat
) params
[0];
1930 /* error will be caught later in gl_Lightfv */
1933 save_Lightfv( light
, pname
, fparam
);
1937 static void save_Lighti( GLenum light
, GLenum pname
, GLint param
)
1939 save_Lightiv( light
, pname
, ¶m
);
1943 static void save_LightModelfv( GLenum pname
, const GLfloat
*params
)
1945 GET_CURRENT_CONTEXT(ctx
);
1947 FLUSH_VB(ctx
, "dlist");
1948 n
= alloc_instruction( ctx
, OPCODE_LIGHT_MODEL
, 5 );
1956 if (ctx
->ExecuteFlag
) {
1957 (*ctx
->Exec
->LightModelfv
)( pname
, params
);
1962 static void save_LightModelf( GLenum pname
, GLfloat param
)
1964 save_LightModelfv(pname
, ¶m
);
1968 static void save_LightModeliv( GLenum pname
, const GLint
*params
)
1972 case GL_LIGHT_MODEL_AMBIENT
:
1973 fparam
[0] = INT_TO_FLOAT( params
[0] );
1974 fparam
[1] = INT_TO_FLOAT( params
[1] );
1975 fparam
[2] = INT_TO_FLOAT( params
[2] );
1976 fparam
[3] = INT_TO_FLOAT( params
[3] );
1978 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
1979 case GL_LIGHT_MODEL_TWO_SIDE
:
1980 case GL_LIGHT_MODEL_COLOR_CONTROL
:
1981 fparam
[0] = (GLfloat
) params
[0];
1984 /* Error will be caught later in gl_LightModelfv */
1987 save_LightModelfv(pname
, fparam
);
1991 static void save_LightModeli( GLenum pname
, GLint param
)
1993 save_LightModeliv(pname
, ¶m
);
1997 static void save_LineStipple( GLint factor
, GLushort pattern
)
1999 GET_CURRENT_CONTEXT(ctx
);
2001 FLUSH_VB(ctx
, "dlist");
2002 n
= alloc_instruction( ctx
, OPCODE_LINE_STIPPLE
, 2 );
2007 if (ctx
->ExecuteFlag
) {
2008 (*ctx
->Exec
->LineStipple
)( factor
, pattern
);
2013 static void save_LineWidth( GLfloat width
)
2015 GET_CURRENT_CONTEXT(ctx
);
2017 FLUSH_VB(ctx
, "dlist");
2018 n
= alloc_instruction( ctx
, OPCODE_LINE_WIDTH
, 1 );
2022 if (ctx
->ExecuteFlag
) {
2023 (*ctx
->Exec
->LineWidth
)( width
);
2028 static void save_ListBase( GLuint base
)
2030 GET_CURRENT_CONTEXT(ctx
);
2032 FLUSH_VB(ctx
, "dlist");
2033 n
= alloc_instruction( ctx
, OPCODE_LIST_BASE
, 1 );
2037 if (ctx
->ExecuteFlag
) {
2038 (*ctx
->Exec
->ListBase
)( base
);
2043 static void save_LoadIdentity( void )
2045 GET_CURRENT_CONTEXT(ctx
);
2046 FLUSH_VB(ctx
, "dlist");
2047 (void) alloc_instruction( ctx
, OPCODE_LOAD_IDENTITY
, 0 );
2048 if (ctx
->ExecuteFlag
) {
2049 (*ctx
->Exec
->LoadIdentity
)();
2054 static void save_LoadMatrixf( const GLfloat
*m
)
2056 GET_CURRENT_CONTEXT(ctx
);
2058 FLUSH_VB(ctx
, "dlist");
2059 n
= alloc_instruction( ctx
, OPCODE_LOAD_MATRIX
, 16 );
2062 for (i
=0;i
<16;i
++) {
2066 if (ctx
->ExecuteFlag
) {
2067 (*ctx
->Exec
->LoadMatrixf
)( m
);
2072 static void save_LoadMatrixd( const GLdouble
*m
)
2076 for (i
= 0; i
< 16; i
++) {
2079 save_LoadMatrixf(f
);
2083 static void save_LoadName( GLuint name
)
2085 GET_CURRENT_CONTEXT(ctx
);
2087 FLUSH_VB(ctx
, "dlist");
2088 n
= alloc_instruction( ctx
, OPCODE_LOAD_NAME
, 1 );
2092 if (ctx
->ExecuteFlag
) {
2093 (*ctx
->Exec
->LoadName
)( name
);
2098 static void save_LogicOp( GLenum opcode
)
2100 GET_CURRENT_CONTEXT(ctx
);
2102 FLUSH_VB(ctx
, "dlist");
2103 n
= alloc_instruction( ctx
, OPCODE_LOGIC_OP
, 1 );
2107 if (ctx
->ExecuteFlag
) {
2108 (*ctx
->Exec
->LogicOp
)( opcode
);
2113 static void save_Map1d( GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2114 GLint order
, const GLdouble
*points
)
2116 GET_CURRENT_CONTEXT(ctx
);
2118 FLUSH_VB(ctx
, "dlist");
2119 n
= alloc_instruction( ctx
, OPCODE_MAP1
, 6 );
2121 GLfloat
*pnts
= gl_copy_map_points1d( target
, stride
, order
, points
);
2125 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2127 n
[6].data
= (void *) pnts
;
2129 if (ctx
->ExecuteFlag
) {
2130 (*ctx
->Exec
->Map1d
)( target
, u1
, u2
, stride
, order
, points
);
2134 static void save_Map1f( GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2135 GLint order
, const GLfloat
*points
)
2137 GET_CURRENT_CONTEXT(ctx
);
2139 FLUSH_VB(ctx
, "dlist");
2140 n
= alloc_instruction( ctx
, OPCODE_MAP1
, 6 );
2142 GLfloat
*pnts
= gl_copy_map_points1f( target
, stride
, order
, points
);
2146 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2148 n
[6].data
= (void *) pnts
;
2150 if (ctx
->ExecuteFlag
) {
2151 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, stride
, order
, points
);
2156 static void save_Map2d( GLenum target
,
2157 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2158 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2159 const GLdouble
*points
)
2161 GET_CURRENT_CONTEXT(ctx
);
2163 FLUSH_VB(ctx
, "dlist");
2164 n
= alloc_instruction( ctx
, OPCODE_MAP2
, 10 );
2166 GLfloat
*pnts
= gl_copy_map_points2d( target
, ustride
, uorder
,
2167 vstride
, vorder
, points
);
2173 /* XXX verify these strides are correct */
2174 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2175 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2178 n
[10].data
= (void *) pnts
;
2180 if (ctx
->ExecuteFlag
) {
2181 (*ctx
->Exec
->Map2d
)( target
,
2182 u1
, u2
, ustride
, uorder
,
2183 v1
, v2
, vstride
, vorder
, points
);
2188 static void save_Map2f( GLenum target
,
2189 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2190 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2191 const GLfloat
*points
)
2193 GET_CURRENT_CONTEXT(ctx
);
2195 FLUSH_VB(ctx
, "dlist");
2196 n
= alloc_instruction( ctx
, OPCODE_MAP2
, 10 );
2198 GLfloat
*pnts
= gl_copy_map_points2f( target
, ustride
, uorder
,
2199 vstride
, vorder
, points
);
2205 /* XXX verify these strides are correct */
2206 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2207 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2210 n
[10].data
= (void *) pnts
;
2212 if (ctx
->ExecuteFlag
) {
2213 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
2214 v1
, v2
, vstride
, vorder
, points
);
2219 static void save_MapGrid1f( GLint un
, GLfloat u1
, GLfloat u2
)
2221 GET_CURRENT_CONTEXT(ctx
);
2223 FLUSH_VB(ctx
, "dlist");
2224 n
= alloc_instruction( ctx
, OPCODE_MAPGRID1
, 3 );
2230 if (ctx
->ExecuteFlag
) {
2231 (*ctx
->Exec
->MapGrid1f
)( un
, u1
, u2
);
2236 static void save_MapGrid1d( GLint un
, GLdouble u1
, GLdouble u2
)
2238 save_MapGrid1f(un
, u1
, u2
);
2242 static void save_MapGrid2f( GLint un
, GLfloat u1
, GLfloat u2
,
2243 GLint vn
, GLfloat v1
, GLfloat v2
)
2245 GET_CURRENT_CONTEXT(ctx
);
2247 FLUSH_VB(ctx
, "dlist");
2248 n
= alloc_instruction( ctx
, OPCODE_MAPGRID2
, 6 );
2257 if (ctx
->ExecuteFlag
) {
2258 (*ctx
->Exec
->MapGrid2f
)( un
, u1
, u2
, vn
, v1
, v2
);
2264 static void save_MapGrid2d( GLint un
, GLdouble u1
, GLdouble u2
,
2265 GLint vn
, GLdouble v1
, GLdouble v2
)
2267 save_MapGrid2f(un
, u1
, u2
, vn
, v1
, v2
);
2271 static void save_MatrixMode( GLenum mode
)
2273 GET_CURRENT_CONTEXT(ctx
);
2275 FLUSH_VB(ctx
, "dlist");
2276 n
= alloc_instruction( ctx
, OPCODE_MATRIX_MODE
, 1 );
2280 if (ctx
->ExecuteFlag
) {
2281 (*ctx
->Exec
->MatrixMode
)( mode
);
2287 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2289 GET_CURRENT_CONTEXT(ctx
);
2292 FLUSH_VB(ctx
, "dlist");
2293 n
= alloc_instruction( ctx
, OPCODE_MIN_MAX
, 3 );
2296 n
[2].e
= internalFormat
;
2299 if (ctx
->ExecuteFlag
) {
2300 (*ctx
->Exec
->Minmax
)( target
, internalFormat
, sink
);
2305 static void save_MultMatrixf( const GLfloat
*m
)
2307 GET_CURRENT_CONTEXT(ctx
);
2309 FLUSH_VB(ctx
, "dlist");
2310 n
= alloc_instruction( ctx
, OPCODE_MULT_MATRIX
, 16 );
2313 for (i
=0;i
<16;i
++) {
2317 if (ctx
->ExecuteFlag
) {
2318 (*ctx
->Exec
->MultMatrixf
)( m
);
2323 static void save_MultMatrixd( const GLdouble
*m
)
2327 for (i
= 0; i
< 16; i
++) {
2330 save_MultMatrixf(f
);
2334 static void save_NewList( GLuint list
, GLenum mode
)
2336 GET_CURRENT_CONTEXT(ctx
);
2337 /* It's an error to call this function while building a display list */
2338 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
2345 static void save_Ortho( GLdouble left
, GLdouble right
,
2346 GLdouble bottom
, GLdouble top
,
2347 GLdouble nearval
, GLdouble farval
)
2349 GET_CURRENT_CONTEXT(ctx
);
2351 FLUSH_VB(ctx
, "dlist");
2352 n
= alloc_instruction( ctx
, OPCODE_ORTHO
, 6 );
2361 if (ctx
->ExecuteFlag
) {
2362 (*ctx
->Exec
->Ortho
)( left
, right
, bottom
, top
, nearval
, farval
);
2367 static void save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
2369 GET_CURRENT_CONTEXT(ctx
);
2371 FLUSH_VB(ctx
, "dlist");
2372 n
= alloc_instruction( ctx
, OPCODE_PIXEL_MAP
, 3 );
2376 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
2377 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
2379 if (ctx
->ExecuteFlag
) {
2380 (*ctx
->Exec
->PixelMapfv
)( map
, mapsize
, values
);
2385 static void save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2387 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2389 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2390 for (i
=0;i
<mapsize
;i
++) {
2391 fvalues
[i
] = (GLfloat
) values
[i
];
2395 for (i
=0;i
<mapsize
;i
++) {
2396 fvalues
[i
] = UINT_TO_FLOAT( values
[i
] );
2399 save_PixelMapfv(map
, mapsize
, fvalues
);
2403 static void save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2405 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2407 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2408 for (i
=0;i
<mapsize
;i
++) {
2409 fvalues
[i
] = (GLfloat
) values
[i
];
2413 for (i
=0;i
<mapsize
;i
++) {
2414 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2417 save_PixelMapfv(map
, mapsize
, fvalues
);
2421 static void save_PixelTransferf( GLenum pname
, GLfloat param
)
2423 GET_CURRENT_CONTEXT(ctx
);
2425 FLUSH_VB(ctx
, "dlist");
2426 n
= alloc_instruction( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2431 if (ctx
->ExecuteFlag
) {
2432 (*ctx
->Exec
->PixelTransferf
)( pname
, param
);
2437 static void save_PixelTransferi( GLenum pname
, GLint param
)
2439 save_PixelTransferf( pname
, (GLfloat
) param
);
2443 static void save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2445 GET_CURRENT_CONTEXT(ctx
);
2447 FLUSH_VB(ctx
, "dlist");
2448 n
= alloc_instruction( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2453 if (ctx
->ExecuteFlag
) {
2454 (*ctx
->Exec
->PixelZoom
)( xfactor
, yfactor
);
2459 static void save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2461 GET_CURRENT_CONTEXT(ctx
);
2463 FLUSH_VB(ctx
, "dlist");
2464 n
= alloc_instruction( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2471 if (ctx
->ExecuteFlag
) {
2472 (*ctx
->Exec
->PointParameterfvEXT
)( pname
, params
);
2477 static void save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2479 save_PointParameterfvEXT(pname
, ¶m
);
2483 static void save_PointSize( GLfloat size
)
2485 GET_CURRENT_CONTEXT(ctx
);
2487 FLUSH_VB(ctx
, "dlist");
2488 n
= alloc_instruction( ctx
, OPCODE_POINT_SIZE
, 1 );
2492 if (ctx
->ExecuteFlag
) {
2493 (*ctx
->Exec
->PointSize
)( size
);
2498 static void save_PolygonMode( GLenum face
, GLenum mode
)
2500 GET_CURRENT_CONTEXT(ctx
);
2502 FLUSH_VB(ctx
, "dlist");
2503 n
= alloc_instruction( ctx
, OPCODE_POLYGON_MODE
, 2 );
2508 if (ctx
->ExecuteFlag
) {
2509 (*ctx
->Exec
->PolygonMode
)( face
, mode
);
2515 * Polygon stipple must have been upacked already!
2517 static void save_PolygonStipple( const GLubyte
*pattern
)
2519 GET_CURRENT_CONTEXT(ctx
);
2521 FLUSH_VB(ctx
, "dlist");
2522 n
= alloc_instruction( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2525 n
[1].data
= MALLOC( 32 * 4 );
2526 data
= n
[1].data
; /* This needed for Acorn compiler */
2527 MEMCPY( data
, pattern
, 32 * 4 );
2529 if (ctx
->ExecuteFlag
) {
2530 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) pattern
);
2535 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2537 GET_CURRENT_CONTEXT(ctx
);
2539 FLUSH_VB(ctx
, "dlist");
2540 n
= alloc_instruction( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2545 if (ctx
->ExecuteFlag
) {
2546 (*ctx
->Exec
->PolygonOffset
)( factor
, units
);
2551 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2553 GET_CURRENT_CONTEXT(ctx
);
2554 save_PolygonOffset(factor
, ctx
->Visual
->DepthMaxF
* bias
);
2558 static void save_PopAttrib( void )
2560 GET_CURRENT_CONTEXT(ctx
);
2561 FLUSH_VB(ctx
, "dlist");
2562 (void) alloc_instruction( ctx
, OPCODE_POP_ATTRIB
, 0 );
2563 if (ctx
->ExecuteFlag
) {
2564 (*ctx
->Exec
->PopAttrib
)();
2569 static void save_PopMatrix( void )
2571 GET_CURRENT_CONTEXT(ctx
);
2572 FLUSH_VB(ctx
, "dlist");
2573 (void) alloc_instruction( ctx
, OPCODE_POP_MATRIX
, 0 );
2574 if (ctx
->ExecuteFlag
) {
2575 (*ctx
->Exec
->PopMatrix
)();
2580 static void save_PopName( void )
2582 GET_CURRENT_CONTEXT(ctx
);
2583 FLUSH_VB(ctx
, "dlist");
2584 (void) alloc_instruction( ctx
, OPCODE_POP_NAME
, 0 );
2585 if (ctx
->ExecuteFlag
) {
2586 (*ctx
->Exec
->PopName
)();
2591 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2592 const GLclampf
*priorities
)
2594 GET_CURRENT_CONTEXT(ctx
);
2596 FLUSH_VB(ctx
, "dlist");
2598 for (i
=0;i
<num
;i
++) {
2600 n
= alloc_instruction( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2602 n
[1].ui
= textures
[i
];
2603 n
[2].f
= priorities
[i
];
2606 if (ctx
->ExecuteFlag
) {
2607 (*ctx
->Exec
->PrioritizeTextures
)( num
, textures
, priorities
);
2612 static void save_PushAttrib( GLbitfield mask
)
2614 GET_CURRENT_CONTEXT(ctx
);
2616 FLUSH_VB(ctx
, "dlist");
2617 n
= alloc_instruction( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2621 if (ctx
->ExecuteFlag
) {
2622 (*ctx
->Exec
->PushAttrib
)( mask
);
2627 static void save_PushMatrix( void )
2629 GET_CURRENT_CONTEXT(ctx
);
2630 FLUSH_VB(ctx
, "dlist");
2631 (void) alloc_instruction( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2632 if (ctx
->ExecuteFlag
) {
2633 (*ctx
->Exec
->PushMatrix
)();
2638 static void save_PushName( GLuint name
)
2640 GET_CURRENT_CONTEXT(ctx
);
2642 FLUSH_VB(ctx
, "dlist");
2643 n
= alloc_instruction( ctx
, OPCODE_PUSH_NAME
, 1 );
2647 if (ctx
->ExecuteFlag
) {
2648 (*ctx
->Exec
->PushName
)( name
);
2653 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2655 GET_CURRENT_CONTEXT(ctx
);
2657 FLUSH_VB(ctx
, "dlist");
2658 n
= alloc_instruction( ctx
, OPCODE_RASTER_POS
, 4 );
2665 if (ctx
->ExecuteFlag
) {
2666 (*ctx
->Exec
->RasterPos4f
)( x
, y
, z
, w
);
2670 static void save_RasterPos2d(GLdouble x
, GLdouble y
)
2672 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2675 static void save_RasterPos2f(GLfloat x
, GLfloat y
)
2677 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2680 static void save_RasterPos2i(GLint x
, GLint y
)
2682 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2685 static void save_RasterPos2s(GLshort x
, GLshort y
)
2687 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2690 static void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2692 save_RasterPos4f(x
, y
, z
, 1.0F
);
2695 static void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2697 save_RasterPos4f(x
, y
, z
, 1.0F
);
2700 static void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2702 save_RasterPos4f(x
, y
, z
, 1.0F
);
2705 static void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2707 save_RasterPos4f(x
, y
, z
, 1.0F
);
2710 static void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2712 save_RasterPos4f(x
, y
, z
, w
);
2715 static void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2717 save_RasterPos4f(x
, y
, z
, w
);
2720 static void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2722 save_RasterPos4f(x
, y
, z
, w
);
2725 static void save_RasterPos2dv(const GLdouble
*v
)
2727 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2730 static void save_RasterPos2fv(const GLfloat
*v
)
2732 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2735 static void save_RasterPos2iv(const GLint
*v
)
2737 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2740 static void save_RasterPos2sv(const GLshort
*v
)
2742 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2745 static void save_RasterPos3dv(const GLdouble
*v
)
2747 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2750 static void save_RasterPos3fv(const GLfloat
*v
)
2752 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2755 static void save_RasterPos3iv(const GLint
*v
)
2757 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2760 static void save_RasterPos3sv(const GLshort
*v
)
2762 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2765 static void save_RasterPos4dv(const GLdouble
*v
)
2767 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2770 static void save_RasterPos4fv(const GLfloat
*v
)
2772 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2775 static void save_RasterPos4iv(const GLint
*v
)
2777 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2780 static void save_RasterPos4sv(const GLshort
*v
)
2782 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2786 static void save_PassThrough( GLfloat token
)
2788 GET_CURRENT_CONTEXT(ctx
);
2790 FLUSH_VB(ctx
, "dlist");
2791 n
= alloc_instruction( ctx
, OPCODE_PASSTHROUGH
, 1 );
2795 if (ctx
->ExecuteFlag
) {
2796 (*ctx
->Exec
->PassThrough
)( token
);
2801 static void save_ReadBuffer( GLenum mode
)
2803 GET_CURRENT_CONTEXT(ctx
);
2805 FLUSH_VB(ctx
, "dlist");
2806 n
= alloc_instruction( ctx
, OPCODE_READ_BUFFER
, 1 );
2810 if (ctx
->ExecuteFlag
) {
2811 (*ctx
->Exec
->ReadBuffer
)( mode
);
2816 static void save_Rectf( GLfloat x1
, GLfloat y1
, GLfloat x2
, GLfloat y2
)
2818 GET_CURRENT_CONTEXT(ctx
);
2820 FLUSH_VB(ctx
, "dlist");
2821 n
= alloc_instruction( ctx
, OPCODE_RECTF
, 4 );
2828 if (ctx
->ExecuteFlag
) {
2829 (*ctx
->Exec
->Rectf
)( x1
, y1
, x2
, y2
);
2833 static void save_Rectd(GLdouble x1
, GLdouble y1
, GLdouble x2
, GLdouble y2
)
2835 save_Rectf(x1
, y1
, x2
, y2
);
2838 static void save_Rectdv(const GLdouble
*v1
, const GLdouble
*v2
)
2840 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2843 static void save_Rectfv( const GLfloat
*v1
, const GLfloat
*v2
)
2845 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2848 static void save_Recti(GLint x1
, GLint y1
, GLint x2
, GLint y2
)
2850 save_Rectf(x1
, y1
, x2
, y2
);
2853 static void save_Rectiv(const GLint
*v1
, const GLint
*v2
)
2855 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2858 static void save_Rects(GLshort x1
, GLshort y1
, GLshort x2
, GLshort y2
)
2860 save_Rectf(x1
, y1
, x2
, y2
);
2863 static void save_Rectsv(const GLshort
*v1
, const GLshort
*v2
)
2865 save_Rectf(v1
[0], v1
[1], v2
[0], v2
[1]);
2870 save_ResetHistogram(GLenum target
)
2872 GET_CURRENT_CONTEXT(ctx
);
2874 FLUSH_VB(ctx
, "dlist");
2875 n
= alloc_instruction( ctx
, OPCODE_RESET_HISTOGRAM
, 1 );
2879 if (ctx
->ExecuteFlag
) {
2880 (*ctx
->Exec
->ResetHistogram
)( target
);
2886 save_ResetMinmax(GLenum target
)
2888 GET_CURRENT_CONTEXT(ctx
);
2890 FLUSH_VB(ctx
, "dlist");
2891 n
= alloc_instruction( ctx
, OPCODE_RESET_MIN_MAX
, 1 );
2895 if (ctx
->ExecuteFlag
) {
2896 (*ctx
->Exec
->ResetMinmax
)( target
);
2901 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2904 gl_rotation_matrix( angle
, x
, y
, z
, m
);
2905 save_MultMatrixf( m
); /* save and maybe execute */
2909 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2911 save_Rotatef(angle
, x
, y
, z
);
2915 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2917 GET_CURRENT_CONTEXT(ctx
);
2919 FLUSH_VB(ctx
, "dlist");
2920 n
= alloc_instruction( ctx
, OPCODE_SCALE
, 3 );
2926 if (ctx
->ExecuteFlag
) {
2927 (*ctx
->Exec
->Scalef
)( x
, y
, z
);
2932 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
2934 save_Scalef(x
, y
, z
);
2938 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
2940 GET_CURRENT_CONTEXT(ctx
);
2942 FLUSH_VB(ctx
, "dlist");
2943 n
= alloc_instruction( ctx
, OPCODE_SCISSOR
, 4 );
2950 if (ctx
->ExecuteFlag
) {
2951 (*ctx
->Exec
->Scissor
)( x
, y
, width
, height
);
2956 static void save_ShadeModel( GLenum mode
)
2958 GET_CURRENT_CONTEXT(ctx
);
2960 FLUSH_VB(ctx
, "dlist");
2961 n
= alloc_instruction( ctx
, OPCODE_SHADE_MODEL
, 1 );
2965 if (ctx
->ExecuteFlag
) {
2966 (*ctx
->Exec
->ShadeModel
)( mode
);
2971 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
2973 GET_CURRENT_CONTEXT(ctx
);
2975 FLUSH_VB(ctx
, "dlist");
2976 n
= alloc_instruction( ctx
, OPCODE_STENCIL_FUNC
, 3 );
2982 if (ctx
->ExecuteFlag
) {
2983 (*ctx
->Exec
->StencilFunc
)( func
, ref
, mask
);
2988 static void save_StencilMask( GLuint mask
)
2990 GET_CURRENT_CONTEXT(ctx
);
2992 FLUSH_VB(ctx
, "dlist");
2993 n
= alloc_instruction( ctx
, OPCODE_STENCIL_MASK
, 1 );
2997 if (ctx
->ExecuteFlag
) {
2998 (*ctx
->Exec
->StencilMask
)( mask
);
3003 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
3005 GET_CURRENT_CONTEXT(ctx
);
3007 FLUSH_VB(ctx
, "dlist");
3008 n
= alloc_instruction( ctx
, OPCODE_STENCIL_OP
, 3 );
3014 if (ctx
->ExecuteFlag
) {
3015 (*ctx
->Exec
->StencilOp
)( fail
, zfail
, zpass
);
3020 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
3022 GET_CURRENT_CONTEXT(ctx
);
3024 FLUSH_VB(ctx
, "dlist");
3025 n
= alloc_instruction( ctx
, OPCODE_TEXENV
, 6 );
3034 if (ctx
->ExecuteFlag
) {
3035 (*ctx
->Exec
->TexEnvfv
)( target
, pname
, params
);
3040 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
3042 save_TexEnvfv( target
, pname
, ¶m
);
3046 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
3049 p
[0] = (GLfloat
) param
;
3050 p
[1] = p
[2] = p
[3] = 0.0;
3051 save_TexEnvfv( target
, pname
, p
);
3055 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
3058 p
[0] = INT_TO_FLOAT( param
[0] );
3059 p
[1] = INT_TO_FLOAT( param
[1] );
3060 p
[2] = INT_TO_FLOAT( param
[2] );
3061 p
[3] = INT_TO_FLOAT( param
[3] );
3062 save_TexEnvfv( target
, pname
, p
);
3066 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
3068 GET_CURRENT_CONTEXT(ctx
);
3070 FLUSH_VB(ctx
, "dlist");
3071 n
= alloc_instruction( ctx
, OPCODE_TEXGEN
, 6 );
3080 if (ctx
->ExecuteFlag
) {
3081 (*ctx
->Exec
->TexGenfv
)( coord
, pname
, params
);
3086 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3093 save_TexGenfv(coord
, pname
, p
);
3097 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3099 GLfloat p
= (GLfloat
) param
;
3100 save_TexGenfv( coord
, pname
, &p
);
3104 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3111 save_TexGenfv( coord
, pname
, p
);
3115 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
3117 save_TexGenfv(coord
, pname
, ¶m
);
3121 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
3123 save_TexGeniv( coord
, pname
, ¶m
);
3127 static void save_TexParameterfv( GLenum target
,
3128 GLenum pname
, const GLfloat
*params
)
3130 GET_CURRENT_CONTEXT(ctx
);
3132 FLUSH_VB(ctx
, "dlist");
3133 n
= alloc_instruction( ctx
, OPCODE_TEXPARAMETER
, 6 );
3142 if (ctx
->ExecuteFlag
) {
3143 (*ctx
->Exec
->TexParameterfv
)( target
, pname
, params
);
3148 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
3150 save_TexParameterfv(target
, pname
, ¶m
);
3154 static void save_TexParameteri( GLenum target
, GLenum pname
, const GLint param
)
3157 fparam
[0] = (GLfloat
) param
;
3158 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3159 save_TexParameterfv(target
, pname
, fparam
);
3163 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
3166 fparam
[0] = (GLfloat
) params
[0];
3167 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3168 save_TexParameterfv(target
, pname
, fparam
);
3172 static void save_TexImage1D( GLenum target
,
3173 GLint level
, GLint components
,
3174 GLsizei width
, GLint border
,
3175 GLenum format
, GLenum type
,
3176 const GLvoid
*pixels
)
3178 GET_CURRENT_CONTEXT(ctx
);
3179 if (target
== GL_PROXY_TEXTURE_1D
) {
3180 /* don't compile, execute immediately */
3181 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3182 border
, format
, type
, pixels
);
3185 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3186 pixels
, &ctx
->Unpack
);
3188 FLUSH_VB(ctx
, "dlist");
3189 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
3193 n
[3].i
= components
;
3194 n
[4].i
= (GLint
) width
;
3203 if (ctx
->ExecuteFlag
) {
3204 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3205 border
, format
, type
, pixels
);
3211 static void save_TexImage2D( GLenum target
,
3212 GLint level
, GLint components
,
3213 GLsizei width
, GLsizei height
, GLint border
,
3214 GLenum format
, GLenum type
,
3215 const GLvoid
*pixels
)
3217 GET_CURRENT_CONTEXT(ctx
);
3218 if (target
== GL_PROXY_TEXTURE_2D
) {
3219 /* don't compile, execute immediately */
3220 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3221 height
, border
, format
, type
, pixels
);
3224 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3225 pixels
, &ctx
->Unpack
);
3227 FLUSH_VB(ctx
, "dlist");
3228 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
3232 n
[3].i
= components
;
3233 n
[4].i
= (GLint
) width
;
3234 n
[5].i
= (GLint
) height
;
3243 if (ctx
->ExecuteFlag
) {
3244 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3245 height
, border
, format
, type
, pixels
);
3251 static void save_TexImage3D( GLenum target
,
3252 GLint level
, GLint internalFormat
,
3253 GLsizei width
, GLsizei height
, GLsizei depth
,
3255 GLenum format
, GLenum type
,
3256 const GLvoid
*pixels
)
3258 GET_CURRENT_CONTEXT(ctx
);
3259 if (target
== GL_PROXY_TEXTURE_3D
) {
3260 /* don't compile, execute immediately */
3261 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3262 height
, depth
, border
, format
, type
, pixels
);
3266 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3267 pixels
, &ctx
->Unpack
);
3268 FLUSH_VB(ctx
, "dlist");
3269 n
= alloc_instruction( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
3273 n
[3].i
= internalFormat
;
3274 n
[4].i
= (GLint
) width
;
3275 n
[5].i
= (GLint
) height
;
3276 n
[6].i
= (GLint
) depth
;
3285 if (ctx
->ExecuteFlag
) {
3286 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3287 height
, depth
, border
, format
, type
, pixels
);
3293 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
3294 GLsizei width
, GLenum format
, GLenum type
,
3295 const GLvoid
*pixels
)
3297 GET_CURRENT_CONTEXT(ctx
);
3299 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3300 pixels
, &ctx
->Unpack
);
3301 FLUSH_VB(ctx
, "dlist");
3302 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
3307 n
[4].i
= (GLint
) width
;
3315 if (ctx
->ExecuteFlag
) {
3316 (*ctx
->Exec
->TexSubImage1D
)( target
, level
, xoffset
, width
,
3317 format
, type
, pixels
);
3322 static void save_TexSubImage2D( GLenum target
, GLint level
,
3323 GLint xoffset
, GLint yoffset
,
3324 GLsizei width
, GLsizei height
,
3325 GLenum format
, GLenum type
,
3326 const GLvoid
*pixels
)
3328 GET_CURRENT_CONTEXT(ctx
);
3330 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3331 pixels
, &ctx
->Unpack
);
3332 FLUSH_VB(ctx
, "dlist");
3333 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
3339 n
[5].i
= (GLint
) width
;
3340 n
[6].i
= (GLint
) height
;
3348 if (ctx
->ExecuteFlag
) {
3349 (*ctx
->Exec
->TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
3350 width
, height
, format
, type
, pixels
);
3355 static void save_TexSubImage3D( GLenum target
, GLint level
,
3356 GLint xoffset
, GLint yoffset
,GLint zoffset
,
3357 GLsizei width
, GLsizei height
, GLsizei depth
,
3358 GLenum format
, GLenum type
,
3359 const GLvoid
*pixels
)
3361 GET_CURRENT_CONTEXT(ctx
);
3363 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3364 pixels
, &ctx
->Unpack
);
3365 FLUSH_VB(ctx
, "dlist");
3366 n
= alloc_instruction( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
3373 n
[6].i
= (GLint
) width
;
3374 n
[7].i
= (GLint
) height
;
3375 n
[8].i
= (GLint
) depth
;
3383 if (ctx
->ExecuteFlag
) {
3384 (*ctx
->Exec
->TexSubImage3D
)( target
, level
,
3385 xoffset
, yoffset
, zoffset
,
3386 width
, height
, depth
, format
, type
, pixels
);
3391 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
3393 GET_CURRENT_CONTEXT(ctx
);
3395 FLUSH_VB(ctx
, "dlist");
3396 n
= alloc_instruction( ctx
, OPCODE_TRANSLATE
, 3 );
3402 if (ctx
->ExecuteFlag
) {
3403 (*ctx
->Exec
->Translatef
)( x
, y
, z
);
3408 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3410 save_Translatef(x
, y
, z
);
3415 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3417 GET_CURRENT_CONTEXT(ctx
);
3419 FLUSH_VB(ctx
, "dlist");
3420 n
= alloc_instruction( ctx
, OPCODE_VIEWPORT
, 4 );
3424 n
[3].i
= (GLint
) width
;
3425 n
[4].i
= (GLint
) height
;
3427 if (ctx
->ExecuteFlag
) {
3428 (*ctx
->Exec
->Viewport
)( x
, y
, width
, height
);
3433 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3435 GET_CURRENT_CONTEXT(ctx
);
3437 FLUSH_VB(ctx
, "dlist");
3438 n
= alloc_instruction( ctx
, OPCODE_WINDOW_POS
, 4 );
3445 if (ctx
->ExecuteFlag
) {
3446 (*ctx
->Exec
->WindowPos4fMESA
)( x
, y
, z
, w
);
3450 static void save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3452 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3455 static void save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3457 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3460 static void save_WindowPos2iMESA(GLint x
, GLint y
)
3462 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3465 static void save_WindowPos2sMESA(GLshort x
, GLshort y
)
3467 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3470 static void save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3472 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3475 static void save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3477 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3480 static void save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3482 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3485 static void save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3487 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3490 static void save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3492 save_WindowPos4fMESA(x
, y
, z
, w
);
3495 static void save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3497 save_WindowPos4fMESA(x
, y
, z
, w
);
3500 static void save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3502 save_WindowPos4fMESA(x
, y
, z
, w
);
3505 static void save_WindowPos2dvMESA(const GLdouble
*v
)
3507 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3510 static void save_WindowPos2fvMESA(const GLfloat
*v
)
3512 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3515 static void save_WindowPos2ivMESA(const GLint
*v
)
3517 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3520 static void save_WindowPos2svMESA(const GLshort
*v
)
3522 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3525 static void save_WindowPos3dvMESA(const GLdouble
*v
)
3527 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3530 static void save_WindowPos3fvMESA(const GLfloat
*v
)
3532 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3535 static void save_WindowPos3ivMESA(const GLint
*v
)
3537 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3540 static void save_WindowPos3svMESA(const GLshort
*v
)
3542 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3545 static void save_WindowPos4dvMESA(const GLdouble
*v
)
3547 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3550 static void save_WindowPos4fvMESA(const GLfloat
*v
)
3552 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3555 static void save_WindowPos4ivMESA(const GLint
*v
)
3557 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3560 static void save_WindowPos4svMESA(const GLshort
*v
)
3562 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3567 /* GL_ARB_multitexture */
3568 static void save_ActiveTextureARB( GLenum target
)
3570 GET_CURRENT_CONTEXT(ctx
);
3572 FLUSH_VB(ctx
, "dlist");
3573 n
= alloc_instruction( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3577 if (ctx
->ExecuteFlag
) {
3578 (*ctx
->Exec
->ActiveTextureARB
)( target
);
3583 /* GL_ARB_multitexture */
3584 static void save_ClientActiveTextureARB( GLenum target
)
3586 GET_CURRENT_CONTEXT(ctx
);
3588 FLUSH_VB(ctx
, "dlist");
3589 n
= alloc_instruction( ctx
, OPCODE_CLIENT_ACTIVE_TEXTURE
, 1 );
3593 if (ctx
->ExecuteFlag
) {
3594 (*ctx
->Exec
->ClientActiveTextureARB
)( target
);
3600 /* GL_ARB_transpose_matrix */
3602 static void save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3605 gl_matrix_transposed(tm
, m
);
3606 save_LoadMatrixd(tm
);
3610 static void save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3613 gl_matrix_transposef(tm
, m
);
3614 save_LoadMatrixf(tm
);
3618 static void save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3621 gl_matrix_transposed(tm
, m
);
3622 save_MultMatrixd(tm
);
3626 static void save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3629 gl_matrix_transposef(tm
, m
);
3630 save_MultMatrixf(tm
);
3634 static void save_PixelTexGenSGIX(GLenum mode
)
3636 GET_CURRENT_CONTEXT(ctx
);
3638 FLUSH_VB(ctx
, "dlist");
3639 n
= alloc_instruction( ctx
, OPCODE_PIXEL_TEXGEN_SGIX
, 1 );
3643 if (ctx
->ExecuteFlag
) {
3644 (*ctx
->Exec
->PixelTexGenSGIX
)( mode
);
3649 /* GL_ARB_texture_compression */
3651 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3652 GLenum internalFormat
, GLsizei width
,
3653 GLint border
, GLsizei imageSize
,
3656 GET_CURRENT_CONTEXT(ctx
);
3657 if (target
== GL_PROXY_TEXTURE_1D
) {
3658 /* don't compile, execute immediately */
3659 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3660 width
, border
, imageSize
, data
);
3665 FLUSH_VB(ctx
, "dlist");
3666 /* make copy of image */
3667 image
= MALLOC(imageSize
);
3669 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3672 MEMCPY(image
, data
, imageSize
);
3673 n
= alloc_instruction( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 8 );
3677 n
[3].e
= internalFormat
;
3678 n
[4].i
= (GLint
) width
;
3686 if (ctx
->ExecuteFlag
) {
3687 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3688 width
, border
, imageSize
, data
);
3695 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
3696 GLenum internalFormat
, GLsizei width
,
3697 GLsizei height
, GLint border
, GLsizei imageSize
,
3700 GET_CURRENT_CONTEXT(ctx
);
3701 if (target
== GL_PROXY_TEXTURE_2D
) {
3702 /* don't compile, execute immediately */
3703 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3704 width
, height
, border
, imageSize
, data
);
3709 FLUSH_VB(ctx
, "dlist");
3710 /* make copy of image */
3711 image
= MALLOC(imageSize
);
3713 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
3716 MEMCPY(image
, data
, imageSize
);
3717 n
= alloc_instruction( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 9 );
3721 n
[3].e
= internalFormat
;
3722 n
[4].i
= (GLint
) width
;
3723 n
[5].i
= (GLint
) height
;
3731 if (ctx
->ExecuteFlag
) {
3732 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3733 width
, height
, border
, imageSize
, data
);
3740 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
3741 GLenum internalFormat
, GLsizei width
,
3742 GLsizei height
, GLsizei depth
, GLint border
,
3743 GLsizei imageSize
, const GLvoid
*data
)
3745 GET_CURRENT_CONTEXT(ctx
);
3746 if (target
== GL_PROXY_TEXTURE_3D
) {
3747 /* don't compile, execute immediately */
3748 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3749 width
, height
, depth
, border
, imageSize
, data
);
3754 FLUSH_VB(ctx
, "dlist");
3755 /* make copy of image */
3756 image
= MALLOC(imageSize
);
3758 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
3761 MEMCPY(image
, data
, imageSize
);
3762 n
= alloc_instruction( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 10 );
3766 n
[3].e
= internalFormat
;
3767 n
[4].i
= (GLint
) width
;
3768 n
[5].i
= (GLint
) height
;
3769 n
[6].i
= (GLint
) depth
;
3777 if (ctx
->ExecuteFlag
) {
3778 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3779 width
, height
, depth
, border
, imageSize
, data
);
3786 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
3787 GLsizei width
, GLenum format
,
3788 GLsizei imageSize
, const GLvoid
*data
)
3793 GET_CURRENT_CONTEXT(ctx
);
3794 FLUSH_VB(ctx
, "dlist");
3796 /* make copy of image */
3797 image
= MALLOC(imageSize
);
3799 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
3802 MEMCPY(image
, data
, imageSize
);
3803 n
= alloc_instruction( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 8 );
3808 n
[4].i
= (GLint
) width
;
3816 if (ctx
->ExecuteFlag
) {
3817 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(target
, level
, xoffset
,
3818 width
, format
, imageSize
, data
);
3824 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
3825 GLint yoffset
, GLsizei width
, GLsizei height
,
3826 GLenum format
, GLsizei imageSize
,
3832 GET_CURRENT_CONTEXT(ctx
);
3833 FLUSH_VB(ctx
, "dlist");
3835 /* make copy of image */
3836 image
= MALLOC(imageSize
);
3838 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
3841 MEMCPY(image
, data
, imageSize
);
3842 n
= alloc_instruction( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 10 );
3848 n
[5].i
= (GLint
) width
;
3849 n
[6].i
= (GLint
) height
;
3857 if (ctx
->ExecuteFlag
) {
3858 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(target
, level
, xoffset
, yoffset
,
3859 width
, height
, format
, imageSize
, data
);
3865 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
3866 GLint yoffset
, GLint zoffset
, GLsizei width
,
3867 GLsizei height
, GLsizei depth
, GLenum format
,
3868 GLsizei imageSize
, const GLvoid
*data
)
3873 GET_CURRENT_CONTEXT(ctx
);
3874 FLUSH_VB(ctx
, "dlist");
3876 /* make copy of image */
3877 image
= MALLOC(imageSize
);
3879 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
3882 MEMCPY(image
, data
, imageSize
);
3883 n
= alloc_instruction( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 12 );
3890 n
[6].i
= (GLint
) width
;
3891 n
[7].i
= (GLint
) height
;
3892 n
[8].i
= (GLint
) depth
;
3894 n
[10].i
= imageSize
;
3900 if (ctx
->ExecuteFlag
) {
3901 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(target
, level
, xoffset
, yoffset
,
3902 zoffset
, width
, height
, depth
, format
, imageSize
, data
);
3907 /* GL_SGIS_pixel_texture */
3909 static void save_PixelTexGenParameteriSGIS(GLenum target
, GLint value
)
3911 GET_CURRENT_CONTEXT(ctx
);
3913 FLUSH_VB(ctx
, "dlist");
3914 n
= alloc_instruction( ctx
, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
, 2 );
3919 if (ctx
->ExecuteFlag
) {
3920 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( target
, value
);
3925 static void save_PixelTexGenParameterfSGIS(GLenum target
, GLfloat value
)
3927 save_PixelTexGenParameteriSGIS(target
, (GLint
) value
);
3931 static void save_PixelTexGenParameterivSGIS(GLenum target
, const GLint
*value
)
3933 save_PixelTexGenParameteriSGIS(target
, *value
);
3937 static void save_PixelTexGenParameterfvSGIS(GLenum target
, const GLfloat
*value
)
3939 save_PixelTexGenParameteriSGIS(target
, (GLint
) *value
);
3942 void gl_compile_cassette( GLcontext
*ctx
)
3944 Node
*n
= alloc_instruction( ctx
, OPCODE_VERTEX_CASSETTE
, 8 );
3945 struct immediate
*im
= ctx
->input
;
3951 /* Do some easy optimizations of the cassette.
3954 if (0 && im
->v
.Obj
.size
< 4 && im
->Count
> 15) {
3955 im
->Bounds
= (GLfloat (*)[3]) MALLOC(6 * sizeof(GLfloat
));
3956 (gl_calc_bound_tab
[im
->v
.Obj
.size
])( im
->Bounds
, &im
->v
.Obj
);
3960 n
[1].data
= (void *)im
;
3961 n
[2].ui
= im
->Start
;
3962 n
[3].ui
= im
->Count
;
3963 n
[4].ui
= im
->BeginState
;
3964 n
[5].ui
= im
->OrFlag
;
3965 n
[6].ui
= im
->AndFlag
;
3966 n
[7].ui
= im
->LastData
;
3967 n
[8].ui
= im
->LastPrimitive
;
3969 if (im
->Count
> VB_MAX
- 4) {
3971 struct immediate
*new_im
= gl_immediate_alloc(ctx
);
3972 if (!new_im
) return;
3973 SET_IMMEDIATE( ctx
, new_im
);
3974 gl_reset_input( ctx
);
3978 im
->Start
= im
->Count
; /* don't clear anything in reset_input */
3981 im
->Primitive
[im
->Start
] = ctx
->Current
.Primitive
;
3982 im
->LastPrimitive
= im
->Start
;
3983 im
->BeginState
= VERT_BEGIN_0
;
3988 fprintf(stderr
, "in compile_cassette, BeginState is %x\n",
3993 /* KW: Compile commands
3995 * Will appear in the list before the vertex buffer containing the
3996 * command that provoked the error. I don't see this as a problem.
3998 void gl_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
4001 n
= alloc_instruction( ctx
, OPCODE_ERROR
, 2 );
4004 n
[2].data
= (void *) s
;
4006 /* execute already done */
4011 islist(GLcontext
*ctx
, GLuint list
)
4013 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
4023 /**********************************************************************/
4024 /* Display list execution */
4025 /**********************************************************************/
4029 * Execute a display list. Note that the ListBase offset must have already
4030 * been added before calling this function. I.e. the list argument is
4031 * the absolute list number, not relative to ListBase.
4032 * Input: list - display list number
4034 static void execute_list( GLcontext
*ctx
, GLuint list
)
4040 if (!islist(ctx
,list
))
4043 /* mesa_print_display_list( list ); */
4047 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
4051 opcode
= n
[0].opcode
;
4055 gl_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
4057 case OPCODE_VERTEX_CASSETTE
: {
4058 struct immediate
*IM
;
4061 gl_update_state(ctx
);
4062 if (ctx
->CompileCVAFlag
) {
4063 ctx
->CompileCVAFlag
= 0;
4064 ctx
->CVA
.elt
.pipeline_valid
= 0;
4066 if (!ctx
->CVA
.elt
.pipeline_valid
)
4067 gl_build_immediate_pipeline( ctx
);
4070 IM
= (struct immediate
*) n
[1].data
;
4071 IM
->Start
= n
[2].ui
;
4072 IM
->Count
= n
[3].ui
;
4073 IM
->BeginState
= n
[4].ui
;
4074 IM
->OrFlag
= n
[5].ui
;
4075 IM
->AndFlag
= n
[6].ui
;
4076 IM
->LastData
= n
[7].ui
;
4077 IM
->LastPrimitive
= n
[8].ui
;
4079 if ((MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
) &&
4080 (MESA_VERBOSE
& VERBOSE_IMMEDIATE
))
4081 gl_print_cassette( (struct immediate
*) n
[1].data
);
4083 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
) {
4084 fprintf(stderr
, "Run cassette %d, rows %d..%d, beginstate %x ",
4086 IM
->Start
, IM
->Count
, IM
->BeginState
);
4087 gl_print_vert_flags("orflag", IM
->OrFlag
);
4090 gl_fixup_cassette( ctx
, (struct immediate
*) n
[1].data
);
4091 gl_execute_cassette( ctx
, (struct immediate
*) n
[1].data
);
4095 (*ctx
->Exec
->Accum
)( n
[1].e
, n
[2].f
);
4097 case OPCODE_ALPHA_FUNC
:
4098 (*ctx
->Exec
->AlphaFunc
)( n
[1].e
, n
[2].f
);
4100 case OPCODE_BIND_TEXTURE
:
4101 (*ctx
->Exec
->BindTexture
)( n
[1].e
, n
[2].ui
);
4105 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4106 ctx
->Unpack
= _mesa_native_packing
;
4107 (*ctx
->Exec
->Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
4108 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (const GLubyte
*) n
[7].data
);
4109 ctx
->Unpack
= save
; /* restore */
4112 case OPCODE_BLEND_COLOR
:
4113 (*ctx
->Exec
->BlendColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4115 case OPCODE_BLEND_EQUATION
:
4116 (*ctx
->Exec
->BlendEquation
)( n
[1].e
);
4118 case OPCODE_BLEND_FUNC
:
4119 (*ctx
->Exec
->BlendFunc
)( n
[1].e
, n
[2].e
);
4121 case OPCODE_BLEND_FUNC_SEPARATE
:
4122 (*ctx
->Exec
->BlendFuncSeparateEXT
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
4124 case OPCODE_CALL_LIST
:
4125 /* Generated by glCallList(), don't add ListBase */
4126 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4127 execute_list( ctx
, n
[1].ui
);
4130 case OPCODE_CALL_LIST_OFFSET
:
4131 /* Generated by glCallLists() so we must add ListBase */
4132 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4133 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
4137 (*ctx
->Exec
->Clear
)( n
[1].bf
);
4139 case OPCODE_CLEAR_COLOR
:
4140 (*ctx
->Exec
->ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4142 case OPCODE_CLEAR_ACCUM
:
4143 (*ctx
->Exec
->ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4145 case OPCODE_CLEAR_DEPTH
:
4146 (*ctx
->Exec
->ClearDepth
)( (GLclampd
) n
[1].f
);
4148 case OPCODE_CLEAR_INDEX
:
4149 (*ctx
->Exec
->ClearIndex
)( n
[1].ui
);
4151 case OPCODE_CLEAR_STENCIL
:
4152 (*ctx
->Exec
->ClearStencil
)( n
[1].i
);
4154 case OPCODE_CLIP_PLANE
:
4161 (*ctx
->Exec
->ClipPlane
)( n
[1].e
, eq
);
4164 case OPCODE_COLOR_MASK
:
4165 (*ctx
->Exec
->ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
4167 case OPCODE_COLOR_MATERIAL
:
4168 (*ctx
->Exec
->ColorMaterial
)( n
[1].e
, n
[2].e
);
4170 case OPCODE_COLOR_TABLE
:
4172 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4173 ctx
->Unpack
= _mesa_native_packing
;
4174 (*ctx
->Exec
->ColorTable
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
4175 n
[5].e
, n
[6].data
);
4176 ctx
->Unpack
= save
; /* restore */
4179 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
4186 (*ctx
->Exec
->ColorTableParameterfv
)( n
[1].e
, n
[2].e
, params
);
4189 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
4196 (*ctx
->Exec
->ColorTableParameteriv
)( n
[1].e
, n
[2].e
, params
);
4199 case OPCODE_COLOR_SUB_TABLE
:
4201 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4202 ctx
->Unpack
= _mesa_native_packing
;
4203 (*ctx
->Exec
->ColorSubTable
)( n
[1].e
, n
[2].i
, n
[3].i
,
4204 n
[4].e
, n
[5].e
, n
[6].data
);
4205 ctx
->Unpack
= save
; /* restore */
4208 case OPCODE_CONVOLUTION_FILTER_1D
:
4210 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4211 ctx
->Unpack
= _mesa_native_packing
;
4212 (*ctx
->Exec
->ConvolutionFilter1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4213 n
[4].e
, n
[5].e
, n
[6].data
);
4214 ctx
->Unpack
= save
; /* restore */
4217 case OPCODE_CONVOLUTION_FILTER_2D
:
4219 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4220 ctx
->Unpack
= _mesa_native_packing
;
4221 (*ctx
->Exec
->ConvolutionFilter2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4222 n
[4].i
, n
[5].e
, n
[6].e
, n
[7].data
);
4223 ctx
->Unpack
= save
; /* restore */
4226 case OPCODE_CONVOLUTION_PARAMETER_I
:
4227 (*ctx
->Exec
->ConvolutionParameteri
)( n
[1].e
, n
[2].e
, n
[3].i
);
4229 case OPCODE_CONVOLUTION_PARAMETER_IV
:
4236 (*ctx
->Exec
->ConvolutionParameteriv
)( n
[1].e
, n
[2].e
, params
);
4239 case OPCODE_CONVOLUTION_PARAMETER_F
:
4240 (*ctx
->Exec
->ConvolutionParameterf
)( n
[1].e
, n
[2].e
, n
[3].f
);
4242 case OPCODE_CONVOLUTION_PARAMETER_FV
:
4249 (*ctx
->Exec
->ConvolutionParameterfv
)( n
[1].e
, n
[2].e
, params
);
4252 case OPCODE_COPY_COLOR_SUB_TABLE
:
4253 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4254 n
[3].i
, n
[4].i
, n
[5].i
);
4256 case OPCODE_COPY_COLOR_TABLE
:
4257 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4258 n
[3].i
, n
[4].i
, n
[5].i
);
4260 case OPCODE_COPY_PIXELS
:
4261 (*ctx
->Exec
->CopyPixels
)( n
[1].i
, n
[2].i
,
4262 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
4264 case OPCODE_COPY_TEX_IMAGE1D
:
4265 (*ctx
->Exec
->CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4266 n
[5].i
, n
[6].i
, n
[7].i
);
4268 case OPCODE_COPY_TEX_IMAGE2D
:
4269 (*ctx
->Exec
->CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4270 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4272 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
4273 (*ctx
->Exec
->CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4274 n
[4].i
, n
[5].i
, n
[6].i
);
4276 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
4277 (*ctx
->Exec
->CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4278 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4280 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
4281 (*ctx
->Exec
->CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4282 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
4284 case OPCODE_CULL_FACE
:
4285 (*ctx
->Exec
->CullFace
)( n
[1].e
);
4287 case OPCODE_DEPTH_FUNC
:
4288 (*ctx
->Exec
->DepthFunc
)( n
[1].e
);
4290 case OPCODE_DEPTH_MASK
:
4291 (*ctx
->Exec
->DepthMask
)( n
[1].b
);
4293 case OPCODE_DEPTH_RANGE
:
4294 (*ctx
->Exec
->DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
4296 case OPCODE_DISABLE
:
4297 (*ctx
->Exec
->Disable
)( n
[1].e
);
4299 case OPCODE_DRAW_BUFFER
:
4300 (*ctx
->Exec
->DrawBuffer
)( n
[1].e
);
4302 case OPCODE_DRAW_PIXELS
:
4304 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4305 ctx
->Unpack
= _mesa_native_packing
;
4306 (*ctx
->Exec
->DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
4308 ctx
->Unpack
= save
; /* restore */
4312 (*ctx
->Exec
->Enable
)( n
[1].e
);
4314 case OPCODE_EVALMESH1
:
4315 (*ctx
->Exec
->EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
4317 case OPCODE_EVALMESH2
:
4318 (*ctx
->Exec
->EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
4327 (*ctx
->Exec
->Fogfv
)( n
[1].e
, p
);
4330 case OPCODE_FRONT_FACE
:
4331 (*ctx
->Exec
->FrontFace
)( n
[1].e
);
4333 case OPCODE_FRUSTUM
:
4334 (*ctx
->Exec
->Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4337 (*ctx
->Exec
->Hint
)( n
[1].e
, n
[2].e
);
4339 case OPCODE_HINT_PGI
:
4340 (*ctx
->Exec
->HintPGI
)( n
[1].e
, n
[2].i
);
4342 case OPCODE_HISTOGRAM
:
4343 (*ctx
->Exec
->Histogram
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
);
4345 case OPCODE_INDEX_MASK
:
4346 (*ctx
->Exec
->IndexMask
)( n
[1].ui
);
4348 case OPCODE_INIT_NAMES
:
4349 (*ctx
->Exec
->InitNames
)();
4358 (*ctx
->Exec
->Lightfv
)( n
[1].e
, n
[2].e
, p
);
4361 case OPCODE_LIGHT_MODEL
:
4368 (*ctx
->Exec
->LightModelfv
)( n
[1].e
, p
);
4371 case OPCODE_LINE_STIPPLE
:
4372 (*ctx
->Exec
->LineStipple
)( n
[1].i
, n
[2].us
);
4374 case OPCODE_LINE_WIDTH
:
4375 (*ctx
->Exec
->LineWidth
)( n
[1].f
);
4377 case OPCODE_LIST_BASE
:
4378 (*ctx
->Exec
->ListBase
)( n
[1].ui
);
4380 case OPCODE_LOAD_IDENTITY
:
4381 (*ctx
->Exec
->LoadIdentity
)();
4383 case OPCODE_LOAD_MATRIX
:
4384 if (sizeof(Node
)==sizeof(GLfloat
)) {
4385 (*ctx
->Exec
->LoadMatrixf
)( &n
[1].f
);
4390 for (i
=0;i
<16;i
++) {
4393 (*ctx
->Exec
->LoadMatrixf
)( m
);
4396 case OPCODE_LOAD_NAME
:
4397 (*ctx
->Exec
->LoadName
)( n
[1].ui
);
4399 case OPCODE_LOGIC_OP
:
4400 (*ctx
->Exec
->LogicOp
)( n
[1].e
);
4404 GLenum target
= n
[1].e
;
4405 GLint ustride
= _mesa_evaluator_components(target
);
4406 GLint uorder
= n
[5].i
;
4407 GLfloat u1
= n
[2].f
;
4408 GLfloat u2
= n
[3].f
;
4409 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, ustride
, uorder
,
4410 (GLfloat
*) n
[6].data
);
4415 GLenum target
= n
[1].e
;
4416 GLfloat u1
= n
[2].f
;
4417 GLfloat u2
= n
[3].f
;
4418 GLfloat v1
= n
[4].f
;
4419 GLfloat v2
= n
[5].f
;
4420 GLint ustride
= n
[6].i
;
4421 GLint vstride
= n
[7].i
;
4422 GLint uorder
= n
[8].i
;
4423 GLint vorder
= n
[9].i
;
4424 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
4425 v1
, v2
, vstride
, vorder
,
4426 (GLfloat
*) n
[10].data
);
4429 case OPCODE_MAPGRID1
:
4430 (*ctx
->Exec
->MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
4432 case OPCODE_MAPGRID2
:
4433 (*ctx
->Exec
->MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
4435 case OPCODE_MATRIX_MODE
:
4436 (*ctx
->Exec
->MatrixMode
)( n
[1].e
);
4438 case OPCODE_MIN_MAX
:
4439 (*ctx
->Exec
->Minmax
)(n
[1].e
, n
[2].e
, n
[3].b
);
4441 case OPCODE_MULT_MATRIX
:
4442 if (sizeof(Node
)==sizeof(GLfloat
)) {
4443 (*ctx
->Exec
->MultMatrixf
)( &n
[1].f
);
4448 for (i
=0;i
<16;i
++) {
4451 (*ctx
->Exec
->MultMatrixf
)( m
);
4455 (*ctx
->Exec
->Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4457 case OPCODE_PASSTHROUGH
:
4458 (*ctx
->Exec
->PassThrough
)( n
[1].f
);
4460 case OPCODE_PIXEL_MAP
:
4461 (*ctx
->Exec
->PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
4463 case OPCODE_PIXEL_TRANSFER
:
4464 (*ctx
->Exec
->PixelTransferf
)( n
[1].e
, n
[2].f
);
4466 case OPCODE_PIXEL_ZOOM
:
4467 (*ctx
->Exec
->PixelZoom
)( n
[1].f
, n
[2].f
);
4469 case OPCODE_POINT_SIZE
:
4470 (*ctx
->Exec
->PointSize
)( n
[1].f
);
4472 case OPCODE_POINT_PARAMETERS
:
4478 (*ctx
->Exec
->PointParameterfvEXT
)( n
[1].e
, params
);
4481 case OPCODE_POLYGON_MODE
:
4482 (*ctx
->Exec
->PolygonMode
)( n
[1].e
, n
[2].e
);
4484 case OPCODE_POLYGON_STIPPLE
:
4485 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) n
[1].data
);
4487 case OPCODE_POLYGON_OFFSET
:
4488 (*ctx
->Exec
->PolygonOffset
)( n
[1].f
, n
[2].f
);
4490 case OPCODE_POP_ATTRIB
:
4491 (*ctx
->Exec
->PopAttrib
)();
4493 case OPCODE_POP_MATRIX
:
4494 (*ctx
->Exec
->PopMatrix
)();
4496 case OPCODE_POP_NAME
:
4497 (*ctx
->Exec
->PopName
)();
4499 case OPCODE_PRIORITIZE_TEXTURE
:
4500 (*ctx
->Exec
->PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
4502 case OPCODE_PUSH_ATTRIB
:
4503 (*ctx
->Exec
->PushAttrib
)( n
[1].bf
);
4505 case OPCODE_PUSH_MATRIX
:
4506 (*ctx
->Exec
->PushMatrix
)();
4508 case OPCODE_PUSH_NAME
:
4509 (*ctx
->Exec
->PushName
)( n
[1].ui
);
4511 case OPCODE_RASTER_POS
:
4512 (*ctx
->Exec
->RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4514 case OPCODE_READ_BUFFER
:
4515 (*ctx
->Exec
->ReadBuffer
)( n
[1].e
);
4518 (*ctx
->Exec
->Rectf
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4520 case OPCODE_RESET_HISTOGRAM
:
4521 (*ctx
->Exec
->ResetHistogram
)( n
[1].e
);
4523 case OPCODE_RESET_MIN_MAX
:
4524 (*ctx
->Exec
->ResetMinmax
)( n
[1].e
);
4527 (*ctx
->Exec
->Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4529 case OPCODE_SCISSOR
:
4530 (*ctx
->Exec
->Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
4532 case OPCODE_SHADE_MODEL
:
4533 (*ctx
->Exec
->ShadeModel
)( n
[1].e
);
4535 case OPCODE_STENCIL_FUNC
:
4536 (*ctx
->Exec
->StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
4538 case OPCODE_STENCIL_MASK
:
4539 (*ctx
->Exec
->StencilMask
)( n
[1].ui
);
4541 case OPCODE_STENCIL_OP
:
4542 (*ctx
->Exec
->StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
4551 (*ctx
->Exec
->TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
4561 (*ctx
->Exec
->TexGenfv
)( n
[1].e
, n
[2].e
, params
);
4564 case OPCODE_TEXPARAMETER
:
4571 (*ctx
->Exec
->TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
4574 case OPCODE_TEX_IMAGE1D
:
4576 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4577 ctx
->Unpack
= _mesa_native_packing
;
4578 (*ctx
->Exec
->TexImage1D
)(
4579 n
[1].e
, /* target */
4581 n
[3].i
, /* components */
4583 n
[5].e
, /* border */
4584 n
[6].e
, /* format */
4587 ctx
->Unpack
= save
; /* restore */
4590 case OPCODE_TEX_IMAGE2D
:
4592 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4593 ctx
->Unpack
= _mesa_native_packing
;
4594 (*ctx
->Exec
->TexImage2D
)(
4595 n
[1].e
, /* target */
4597 n
[3].i
, /* components */
4599 n
[5].i
, /* height */
4600 n
[6].e
, /* border */
4601 n
[7].e
, /* format */
4604 ctx
->Unpack
= save
; /* restore */
4607 case OPCODE_TEX_IMAGE3D
:
4609 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4610 ctx
->Unpack
= _mesa_native_packing
;
4611 (*ctx
->Exec
->TexImage3D
)(
4612 n
[1].e
, /* target */
4614 n
[3].i
, /* components */
4616 n
[5].i
, /* height */
4618 n
[7].e
, /* border */
4619 n
[8].e
, /* format */
4622 ctx
->Unpack
= save
; /* restore */
4625 case OPCODE_TEX_SUB_IMAGE1D
:
4627 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4628 ctx
->Unpack
= _mesa_native_packing
;
4629 (*ctx
->Exec
->TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4631 n
[6].e
, n
[7].data
);
4632 ctx
->Unpack
= save
; /* restore */
4635 case OPCODE_TEX_SUB_IMAGE2D
:
4637 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4638 ctx
->Unpack
= _mesa_native_packing
;
4639 (*ctx
->Exec
->TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4641 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
4642 ctx
->Unpack
= save
; /* restore */
4645 case OPCODE_TEX_SUB_IMAGE3D
:
4647 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4648 ctx
->Unpack
= _mesa_native_packing
;
4649 (*ctx
->Exec
->TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4650 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
4651 n
[8].i
, n
[9].e
, n
[10].e
,
4653 ctx
->Unpack
= save
; /* restore */
4656 case OPCODE_TRANSLATE
:
4657 (*ctx
->Exec
->Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4659 case OPCODE_VIEWPORT
:
4660 (*ctx
->Exec
->Viewport
)(n
[1].i
, n
[2].i
,
4661 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
4663 case OPCODE_WINDOW_POS
:
4664 (*ctx
->Exec
->WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4666 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
4667 (*ctx
->Exec
->ActiveTextureARB
)( n
[1].e
);
4669 case OPCODE_CLIENT_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
4670 (*ctx
->Exec
->ClientActiveTextureARB
)( n
[1].e
);
4672 case OPCODE_PIXEL_TEXGEN_SGIX
: /* GL_SGIX_pixel_texture */
4673 (*ctx
->Exec
->PixelTexGenSGIX
)( n
[1].e
);
4675 case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
: /* GL_SGIS_pixel_texture */
4676 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( n
[1].e
, n
[2].i
);
4678 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
4679 (*ctx
->Exec
->CompressedTexImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4680 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].data
);
4682 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
4683 (*ctx
->Exec
->CompressedTexImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4684 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].data
);
4686 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
4687 (*ctx
->Exec
->CompressedTexImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4688 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].data
);
4690 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
4691 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4692 n
[4].i
, n
[5].e
, n
[6].i
, n
[7].data
);
4694 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
4695 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4696 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
, n
[9].data
);
4698 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
4699 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4700 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
4701 n
[9].e
, n
[10].i
, n
[11].data
);
4703 case OPCODE_CONTINUE
:
4704 n
= (Node
*) n
[1].next
;
4706 case OPCODE_END_OF_LIST
:
4712 sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
4713 gl_problem( ctx
, msg
);
4718 /* increment n to point to next compiled command */
4719 if (opcode
!=OPCODE_CONTINUE
) {
4720 n
+= InstSize
[opcode
];
4731 /**********************************************************************/
4733 /**********************************************************************/
4739 * Test if a display list number is valid.
4742 _mesa_IsList( GLuint list
)
4744 GET_CURRENT_CONTEXT(ctx
);
4745 return islist(ctx
, list
);
4750 * Delete a sequence of consecutive display lists.
4753 _mesa_DeleteLists( GLuint list
, GLsizei range
)
4755 GET_CURRENT_CONTEXT(ctx
);
4758 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glDeleteLists");
4760 gl_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
4763 for (i
=list
;i
<list
+range
;i
++) {
4764 gl_destroy_list( ctx
, i
);
4771 * Return a display list number, n, such that lists n through n+range-1
4775 _mesa_GenLists(GLsizei range
)
4777 GET_CURRENT_CONTEXT(ctx
);
4780 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx
, "glGenLists", 0);
4782 gl_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
4790 * Make this an atomic operation
4792 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
4794 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
4796 /* reserve the list IDs by with empty/dummy lists */
4798 for (i
=0; i
<range
; i
++) {
4799 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
4803 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
4811 * Begin a new display list.
4814 _mesa_NewList( GLuint list
, GLenum mode
)
4816 GET_CURRENT_CONTEXT(ctx
);
4817 struct immediate
*IM
;
4818 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glNewList");
4820 if (MESA_VERBOSE
&VERBOSE_API
)
4821 fprintf(stderr
, "glNewList %u %s\n", list
, gl_lookup_enum_by_nr(mode
));
4824 gl_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
4828 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
4829 gl_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
4833 if (ctx
->CurrentListPtr
) {
4834 /* already compiling a display list */
4835 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
4839 /* Allocate new display list */
4840 ctx
->CurrentListNum
= list
;
4841 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
4842 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
4843 ctx
->CurrentPos
= 0;
4845 IM
= gl_immediate_alloc( ctx
);
4846 SET_IMMEDIATE( ctx
, IM
);
4847 gl_reset_input( ctx
);
4849 ctx
->CompileFlag
= GL_TRUE
;
4850 ctx
->CompileCVAFlag
= GL_FALSE
;
4851 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
4853 ctx
->CurrentDispatch
= ctx
->Save
;
4854 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4860 * End definition of current display list.
4863 _mesa_EndList( void )
4865 GET_CURRENT_CONTEXT(ctx
);
4866 if (MESA_VERBOSE
&VERBOSE_API
)
4867 fprintf(stderr
, "glEndList\n");
4869 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
, "glEndList" );
4871 /* Check that a list is under construction */
4872 if (!ctx
->CurrentListPtr
) {
4873 gl_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
4877 (void) alloc_instruction( ctx
, OPCODE_END_OF_LIST
, 0 );
4879 /* Destroy old list, if any */
4880 gl_destroy_list(ctx
, ctx
->CurrentListNum
);
4881 /* Install the list */
4882 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
4885 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
4886 mesa_print_display_list(ctx
->CurrentListNum
);
4888 ctx
->CurrentListNum
= 0;
4889 ctx
->CurrentListPtr
= NULL
;
4890 ctx
->ExecuteFlag
= GL_TRUE
;
4891 ctx
->CompileFlag
= GL_FALSE
;
4892 /* ctx->CompileCVAFlag = ...; */
4894 /* KW: Put back the old input pointer.
4896 if (--ctx
->input
->ref_count
== 0)
4897 gl_immediate_free( ctx
->input
);
4899 SET_IMMEDIATE( ctx
, ctx
->VB
->IM
);
4900 gl_reset_input( ctx
);
4902 /* Haven't tracked down why this is needed.
4906 ctx
->CurrentDispatch
= ctx
->Exec
;
4907 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4913 _mesa_CallList( GLuint list
)
4915 GET_CURRENT_CONTEXT(ctx
);
4916 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
4917 /* execute the display list, and restore the CompileFlag. */
4918 GLboolean save_compile_flag
;
4920 if (MESA_VERBOSE
&VERBOSE_API
) {
4921 fprintf(stderr
, "glCallList %u\n", list
);
4922 mesa_print_display_list( list
);
4925 save_compile_flag
= ctx
->CompileFlag
;
4926 ctx
->CompileFlag
= GL_FALSE
;
4928 FLUSH_VB( ctx
, "call list" );
4929 execute_list( ctx
, list
);
4930 ctx
->CompileFlag
= save_compile_flag
;
4932 /* also restore API function pointers to point to "save" versions */
4933 if (save_compile_flag
) {
4934 ctx
->CurrentDispatch
= ctx
->Save
;
4935 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4942 * Execute glCallLists: call multiple display lists.
4945 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
4947 GET_CURRENT_CONTEXT(ctx
);
4950 GLboolean save_compile_flag
;
4952 /* Save the CompileFlag status, turn it off, execute display list,
4953 * and restore the CompileFlag.
4955 save_compile_flag
= ctx
->CompileFlag
;
4956 ctx
->CompileFlag
= GL_FALSE
;
4958 FLUSH_VB( ctx
, "call lists" );
4961 list
= translate_id( i
, type
, lists
);
4962 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
4965 ctx
->CompileFlag
= save_compile_flag
;
4967 /* also restore API function pointers to point to "save" versions */
4968 if (save_compile_flag
) {
4969 ctx
->CurrentDispatch
= ctx
->Save
;
4970 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4973 /* RESET_IMMEDIATE( ctx ); */
4979 * Set the offset added to list numbers in glCallLists.
4982 _mesa_ListBase( GLuint base
)
4984 GET_CURRENT_CONTEXT(ctx
);
4985 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glListBase");
4986 ctx
->List
.ListBase
= base
;
4993 * Assign all the pointers in <table> to point to Mesa's display list
4994 * building functions.
4997 _mesa_init_dlist_table( struct _glapi_table
*table
, GLuint tableSize
)
4999 _mesa_init_no_op_table(table
, tableSize
);
5002 table
->Accum
= save_Accum
;
5003 table
->AlphaFunc
= save_AlphaFunc
;
5004 table
->Begin
= save_Begin
;
5005 table
->Bitmap
= save_Bitmap
;
5006 table
->BlendFunc
= save_BlendFunc
;
5007 table
->CallList
= save_CallList
;
5008 table
->CallLists
= save_CallLists
;
5009 table
->Clear
= save_Clear
;
5010 table
->ClearAccum
= save_ClearAccum
;
5011 table
->ClearColor
= save_ClearColor
;
5012 table
->ClearDepth
= save_ClearDepth
;
5013 table
->ClearIndex
= save_ClearIndex
;
5014 table
->ClearStencil
= save_ClearStencil
;
5015 table
->ClipPlane
= save_ClipPlane
;
5016 table
->Color3b
= _mesa_Color3b
;
5017 table
->Color3bv
= _mesa_Color3bv
;
5018 table
->Color3d
= _mesa_Color3d
;
5019 table
->Color3dv
= _mesa_Color3dv
;
5020 table
->Color3f
= _mesa_Color3f
;
5021 table
->Color3fv
= _mesa_Color3fv
;
5022 table
->Color3i
= _mesa_Color3i
;
5023 table
->Color3iv
= _mesa_Color3iv
;
5024 table
->Color3s
= _mesa_Color3s
;
5025 table
->Color3sv
= _mesa_Color3sv
;
5026 table
->Color3ub
= _mesa_Color3ub
;
5027 table
->Color3ubv
= _mesa_Color3ubv
;
5028 table
->Color3ui
= _mesa_Color3ui
;
5029 table
->Color3uiv
= _mesa_Color3uiv
;
5030 table
->Color3us
= _mesa_Color3us
;
5031 table
->Color3usv
= _mesa_Color3usv
;
5032 table
->Color4b
= _mesa_Color4b
;
5033 table
->Color4bv
= _mesa_Color4bv
;
5034 table
->Color4d
= _mesa_Color4d
;
5035 table
->Color4dv
= _mesa_Color4dv
;
5036 table
->Color4f
= _mesa_Color4f
;
5037 table
->Color4fv
= _mesa_Color4fv
;
5038 table
->Color4i
= _mesa_Color4i
;
5039 table
->Color4iv
= _mesa_Color4iv
;
5040 table
->Color4s
= _mesa_Color4s
;
5041 table
->Color4sv
= _mesa_Color4sv
;
5042 table
->Color4ub
= _mesa_Color4ub
;
5043 table
->Color4ubv
= _mesa_Color4ubv
;
5044 table
->Color4ui
= _mesa_Color4ui
;
5045 table
->Color4uiv
= _mesa_Color4uiv
;
5046 table
->Color4us
= _mesa_Color4us
;
5047 table
->Color4usv
= _mesa_Color4usv
;
5048 table
->ColorMask
= save_ColorMask
;
5049 table
->ColorMaterial
= save_ColorMaterial
;
5050 table
->CopyPixels
= save_CopyPixels
;
5051 table
->CullFace
= save_CullFace
;
5052 table
->DeleteLists
= _mesa_DeleteLists
;
5053 table
->DepthFunc
= save_DepthFunc
;
5054 table
->DepthMask
= save_DepthMask
;
5055 table
->DepthRange
= save_DepthRange
;
5056 table
->Disable
= save_Disable
;
5057 table
->DrawBuffer
= save_DrawBuffer
;
5058 table
->DrawPixels
= save_DrawPixels
;
5059 table
->EdgeFlag
= _mesa_EdgeFlag
;
5060 table
->EdgeFlagv
= _mesa_EdgeFlagv
;
5061 table
->Enable
= save_Enable
;
5062 table
->End
= _mesa_End
;
5063 table
->EndList
= _mesa_EndList
;
5064 table
->EvalCoord1d
= _mesa_EvalCoord1d
;
5065 table
->EvalCoord1dv
= _mesa_EvalCoord1dv
;
5066 table
->EvalCoord1f
= _mesa_EvalCoord1f
;
5067 table
->EvalCoord1fv
= _mesa_EvalCoord1fv
;
5068 table
->EvalCoord2d
= _mesa_EvalCoord2d
;
5069 table
->EvalCoord2dv
= _mesa_EvalCoord2dv
;
5070 table
->EvalCoord2f
= _mesa_EvalCoord2f
;
5071 table
->EvalCoord2fv
= _mesa_EvalCoord2fv
;
5072 table
->EvalMesh1
= save_EvalMesh1
;
5073 table
->EvalMesh2
= save_EvalMesh2
;
5074 table
->EvalPoint1
= _mesa_EvalPoint1
;
5075 table
->EvalPoint2
= _mesa_EvalPoint2
;
5076 table
->FeedbackBuffer
= _mesa_FeedbackBuffer
;
5077 table
->Finish
= _mesa_Finish
;
5078 table
->Flush
= _mesa_Flush
;
5079 table
->Fogf
= save_Fogf
;
5080 table
->Fogfv
= save_Fogfv
;
5081 table
->Fogi
= save_Fogi
;
5082 table
->Fogiv
= save_Fogiv
;
5083 table
->FrontFace
= save_FrontFace
;
5084 table
->Frustum
= save_Frustum
;
5085 table
->GenLists
= _mesa_GenLists
;
5086 table
->GetBooleanv
= _mesa_GetBooleanv
;
5087 table
->GetClipPlane
= _mesa_GetClipPlane
;
5088 table
->GetDoublev
= _mesa_GetDoublev
;
5089 table
->GetError
= _mesa_GetError
;
5090 table
->GetFloatv
= _mesa_GetFloatv
;
5091 table
->GetIntegerv
= _mesa_GetIntegerv
;
5092 table
->GetLightfv
= _mesa_GetLightfv
;
5093 table
->GetLightiv
= _mesa_GetLightiv
;
5094 table
->GetMapdv
= _mesa_GetMapdv
;
5095 table
->GetMapfv
= _mesa_GetMapfv
;
5096 table
->GetMapiv
= _mesa_GetMapiv
;
5097 table
->GetMaterialfv
= _mesa_GetMaterialfv
;
5098 table
->GetMaterialiv
= _mesa_GetMaterialiv
;
5099 table
->GetPixelMapfv
= _mesa_GetPixelMapfv
;
5100 table
->GetPixelMapuiv
= _mesa_GetPixelMapuiv
;
5101 table
->GetPixelMapusv
= _mesa_GetPixelMapusv
;
5102 table
->GetPolygonStipple
= _mesa_GetPolygonStipple
;
5103 table
->GetString
= _mesa_GetString
;
5104 table
->GetTexEnvfv
= _mesa_GetTexEnvfv
;
5105 table
->GetTexEnviv
= _mesa_GetTexEnviv
;
5106 table
->GetTexGendv
= _mesa_GetTexGendv
;
5107 table
->GetTexGenfv
= _mesa_GetTexGenfv
;
5108 table
->GetTexGeniv
= _mesa_GetTexGeniv
;
5109 table
->GetTexImage
= _mesa_GetTexImage
;
5110 table
->GetTexLevelParameterfv
= _mesa_GetTexLevelParameterfv
;
5111 table
->GetTexLevelParameteriv
= _mesa_GetTexLevelParameteriv
;
5112 table
->GetTexParameterfv
= _mesa_GetTexParameterfv
;
5113 table
->GetTexParameteriv
= _mesa_GetTexParameteriv
;
5114 table
->Hint
= save_Hint
;
5115 table
->IndexMask
= save_IndexMask
;
5116 table
->Indexd
= _mesa_Indexd
;
5117 table
->Indexdv
= _mesa_Indexdv
;
5118 table
->Indexf
= _mesa_Indexf
;
5119 table
->Indexfv
= _mesa_Indexfv
;
5120 table
->Indexi
= _mesa_Indexi
;
5121 table
->Indexiv
= _mesa_Indexiv
;
5122 table
->Indexs
= _mesa_Indexs
;
5123 table
->Indexsv
= _mesa_Indexsv
;
5124 table
->InitNames
= save_InitNames
;
5125 table
->IsEnabled
= _mesa_IsEnabled
;
5126 table
->IsList
= _mesa_IsList
;
5127 table
->LightModelf
= save_LightModelf
;
5128 table
->LightModelfv
= save_LightModelfv
;
5129 table
->LightModeli
= save_LightModeli
;
5130 table
->LightModeliv
= save_LightModeliv
;
5131 table
->Lightf
= save_Lightf
;
5132 table
->Lightfv
= save_Lightfv
;
5133 table
->Lighti
= save_Lighti
;
5134 table
->Lightiv
= save_Lightiv
;
5135 table
->LineStipple
= save_LineStipple
;
5136 table
->LineWidth
= save_LineWidth
;
5137 table
->ListBase
= save_ListBase
;
5138 table
->LoadIdentity
= save_LoadIdentity
;
5139 table
->LoadMatrixd
= save_LoadMatrixd
;
5140 table
->LoadMatrixf
= save_LoadMatrixf
;
5141 table
->LoadName
= save_LoadName
;
5142 table
->LogicOp
= save_LogicOp
;
5143 table
->Map1d
= save_Map1d
;
5144 table
->Map1f
= save_Map1f
;
5145 table
->Map2d
= save_Map2d
;
5146 table
->Map2f
= save_Map2f
;
5147 table
->MapGrid1d
= save_MapGrid1d
;
5148 table
->MapGrid1f
= save_MapGrid1f
;
5149 table
->MapGrid2d
= save_MapGrid2d
;
5150 table
->MapGrid2f
= save_MapGrid2f
;
5151 table
->Materialf
= _mesa_Materialf
;
5152 table
->Materialfv
= _mesa_Materialfv
;
5153 table
->Materiali
= _mesa_Materiali
;
5154 table
->Materialiv
= _mesa_Materialiv
;
5155 table
->MatrixMode
= save_MatrixMode
;
5156 table
->MultMatrixd
= save_MultMatrixd
;
5157 table
->MultMatrixf
= save_MultMatrixf
;
5158 table
->NewList
= save_NewList
;
5159 table
->Normal3b
= _mesa_Normal3b
;
5160 table
->Normal3bv
= _mesa_Normal3bv
;
5161 table
->Normal3d
= _mesa_Normal3d
;
5162 table
->Normal3dv
= _mesa_Normal3dv
;
5163 table
->Normal3f
= _mesa_Normal3f
;
5164 table
->Normal3fv
= _mesa_Normal3fv
;
5165 table
->Normal3i
= _mesa_Normal3i
;
5166 table
->Normal3iv
= _mesa_Normal3iv
;
5167 table
->Normal3s
= _mesa_Normal3s
;
5168 table
->Normal3sv
= _mesa_Normal3sv
;
5169 table
->Ortho
= save_Ortho
;
5170 table
->PassThrough
= save_PassThrough
;
5171 table
->PixelMapfv
= save_PixelMapfv
;
5172 table
->PixelMapuiv
= save_PixelMapuiv
;
5173 table
->PixelMapusv
= save_PixelMapusv
;
5174 table
->PixelStoref
= _mesa_PixelStoref
;
5175 table
->PixelStorei
= _mesa_PixelStorei
;
5176 table
->PixelTransferf
= save_PixelTransferf
;
5177 table
->PixelTransferi
= save_PixelTransferi
;
5178 table
->PixelZoom
= save_PixelZoom
;
5179 table
->PointSize
= save_PointSize
;
5180 table
->PolygonMode
= save_PolygonMode
;
5181 table
->PolygonOffset
= save_PolygonOffset
;
5182 table
->PolygonStipple
= save_PolygonStipple
;
5183 table
->PopAttrib
= save_PopAttrib
;
5184 table
->PopMatrix
= save_PopMatrix
;
5185 table
->PopName
= save_PopName
;
5186 table
->PushAttrib
= save_PushAttrib
;
5187 table
->PushMatrix
= save_PushMatrix
;
5188 table
->PushName
= save_PushName
;
5189 table
->RasterPos2d
= save_RasterPos2d
;
5190 table
->RasterPos2dv
= save_RasterPos2dv
;
5191 table
->RasterPos2f
= save_RasterPos2f
;
5192 table
->RasterPos2fv
= save_RasterPos2fv
;
5193 table
->RasterPos2i
= save_RasterPos2i
;
5194 table
->RasterPos2iv
= save_RasterPos2iv
;
5195 table
->RasterPos2s
= save_RasterPos2s
;
5196 table
->RasterPos2sv
= save_RasterPos2sv
;
5197 table
->RasterPos3d
= save_RasterPos3d
;
5198 table
->RasterPos3dv
= save_RasterPos3dv
;
5199 table
->RasterPos3f
= save_RasterPos3f
;
5200 table
->RasterPos3fv
= save_RasterPos3fv
;
5201 table
->RasterPos3i
= save_RasterPos3i
;
5202 table
->RasterPos3iv
= save_RasterPos3iv
;
5203 table
->RasterPos3s
= save_RasterPos3s
;
5204 table
->RasterPos3sv
= save_RasterPos3sv
;
5205 table
->RasterPos4d
= save_RasterPos4d
;
5206 table
->RasterPos4dv
= save_RasterPos4dv
;
5207 table
->RasterPos4f
= save_RasterPos4f
;
5208 table
->RasterPos4fv
= save_RasterPos4fv
;
5209 table
->RasterPos4i
= save_RasterPos4i
;
5210 table
->RasterPos4iv
= save_RasterPos4iv
;
5211 table
->RasterPos4s
= save_RasterPos4s
;
5212 table
->RasterPos4sv
= save_RasterPos4sv
;
5213 table
->ReadBuffer
= save_ReadBuffer
;
5214 table
->ReadPixels
= _mesa_ReadPixels
;
5215 table
->Rectd
= save_Rectd
;
5216 table
->Rectdv
= save_Rectdv
;
5217 table
->Rectf
= save_Rectf
;
5218 table
->Rectfv
= save_Rectfv
;
5219 table
->Recti
= save_Recti
;
5220 table
->Rectiv
= save_Rectiv
;
5221 table
->Rects
= save_Rects
;
5222 table
->Rectsv
= save_Rectsv
;
5223 table
->RenderMode
= _mesa_RenderMode
;
5224 table
->Rotated
= save_Rotated
;
5225 table
->Rotatef
= save_Rotatef
;
5226 table
->Scaled
= save_Scaled
;
5227 table
->Scalef
= save_Scalef
;
5228 table
->Scissor
= save_Scissor
;
5229 table
->SelectBuffer
= _mesa_SelectBuffer
;
5230 table
->ShadeModel
= save_ShadeModel
;
5231 table
->StencilFunc
= save_StencilFunc
;
5232 table
->StencilMask
= save_StencilMask
;
5233 table
->StencilOp
= save_StencilOp
;
5234 table
->TexCoord1d
= _mesa_TexCoord1d
;
5235 table
->TexCoord1dv
= _mesa_TexCoord1dv
;
5236 table
->TexCoord1f
= _mesa_TexCoord1f
;
5237 table
->TexCoord1fv
= _mesa_TexCoord1fv
;
5238 table
->TexCoord1i
= _mesa_TexCoord1i
;
5239 table
->TexCoord1iv
= _mesa_TexCoord1iv
;
5240 table
->TexCoord1s
= _mesa_TexCoord1s
;
5241 table
->TexCoord1sv
= _mesa_TexCoord1sv
;
5242 table
->TexCoord2d
= _mesa_TexCoord2d
;
5243 table
->TexCoord2dv
= _mesa_TexCoord2dv
;
5244 table
->TexCoord2f
= _mesa_TexCoord2f
;
5245 table
->TexCoord2fv
= _mesa_TexCoord2fv
;
5246 table
->TexCoord2i
= _mesa_TexCoord2i
;
5247 table
->TexCoord2iv
= _mesa_TexCoord2iv
;
5248 table
->TexCoord2s
= _mesa_TexCoord2s
;
5249 table
->TexCoord2sv
= _mesa_TexCoord2sv
;
5250 table
->TexCoord3d
= _mesa_TexCoord3d
;
5251 table
->TexCoord3dv
= _mesa_TexCoord3dv
;
5252 table
->TexCoord3f
= _mesa_TexCoord3f
;
5253 table
->TexCoord3fv
= _mesa_TexCoord3fv
;
5254 table
->TexCoord3i
= _mesa_TexCoord3i
;
5255 table
->TexCoord3iv
= _mesa_TexCoord3iv
;
5256 table
->TexCoord3s
= _mesa_TexCoord3s
;
5257 table
->TexCoord3sv
= _mesa_TexCoord3sv
;
5258 table
->TexCoord4d
= _mesa_TexCoord4d
;
5259 table
->TexCoord4dv
= _mesa_TexCoord4dv
;
5260 table
->TexCoord4f
= _mesa_TexCoord4f
;
5261 table
->TexCoord4fv
= _mesa_TexCoord4fv
;
5262 table
->TexCoord4i
= _mesa_TexCoord4i
;
5263 table
->TexCoord4iv
= _mesa_TexCoord4iv
;
5264 table
->TexCoord4s
= _mesa_TexCoord4s
;
5265 table
->TexCoord4sv
= _mesa_TexCoord4sv
;
5266 table
->TexEnvf
= save_TexEnvf
;
5267 table
->TexEnvfv
= save_TexEnvfv
;
5268 table
->TexEnvi
= save_TexEnvi
;
5269 table
->TexEnviv
= save_TexEnviv
;
5270 table
->TexGend
= save_TexGend
;
5271 table
->TexGendv
= save_TexGendv
;
5272 table
->TexGenf
= save_TexGenf
;
5273 table
->TexGenfv
= save_TexGenfv
;
5274 table
->TexGeni
= save_TexGeni
;
5275 table
->TexGeniv
= save_TexGeniv
;
5276 table
->TexImage1D
= save_TexImage1D
;
5277 table
->TexImage2D
= save_TexImage2D
;
5278 table
->TexParameterf
= save_TexParameterf
;
5279 table
->TexParameterfv
= save_TexParameterfv
;
5280 table
->TexParameteri
= save_TexParameteri
;
5281 table
->TexParameteriv
= save_TexParameteriv
;
5282 table
->Translated
= save_Translated
;
5283 table
->Translatef
= save_Translatef
;
5284 table
->Vertex2d
= _mesa_Vertex2d
;
5285 table
->Vertex2dv
= _mesa_Vertex2dv
;
5286 table
->Vertex2f
= _mesa_Vertex2f
;
5287 table
->Vertex2fv
= _mesa_Vertex2fv
;
5288 table
->Vertex2i
= _mesa_Vertex2i
;
5289 table
->Vertex2iv
= _mesa_Vertex2iv
;
5290 table
->Vertex2s
= _mesa_Vertex2s
;
5291 table
->Vertex2sv
= _mesa_Vertex2sv
;
5292 table
->Vertex3d
= _mesa_Vertex3d
;
5293 table
->Vertex3dv
= _mesa_Vertex3dv
;
5294 table
->Vertex3f
= _mesa_Vertex3f
;
5295 table
->Vertex3fv
= _mesa_Vertex3fv
;
5296 table
->Vertex3i
= _mesa_Vertex3i
;
5297 table
->Vertex3iv
= _mesa_Vertex3iv
;
5298 table
->Vertex3s
= _mesa_Vertex3s
;
5299 table
->Vertex3sv
= _mesa_Vertex3sv
;
5300 table
->Vertex4d
= _mesa_Vertex4d
;
5301 table
->Vertex4dv
= _mesa_Vertex4dv
;
5302 table
->Vertex4f
= _mesa_Vertex4f
;
5303 table
->Vertex4fv
= _mesa_Vertex4fv
;
5304 table
->Vertex4i
= _mesa_Vertex4i
;
5305 table
->Vertex4iv
= _mesa_Vertex4iv
;
5306 table
->Vertex4s
= _mesa_Vertex4s
;
5307 table
->Vertex4sv
= _mesa_Vertex4sv
;
5308 table
->Viewport
= save_Viewport
;
5311 table
->AreTexturesResident
= _mesa_AreTexturesResident
;
5312 table
->ArrayElement
= _mesa_ArrayElement
;
5313 table
->BindTexture
= save_BindTexture
;
5314 table
->ColorPointer
= _mesa_ColorPointer
;
5315 table
->CopyTexImage1D
= save_CopyTexImage1D
;
5316 table
->CopyTexImage2D
= save_CopyTexImage2D
;
5317 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
5318 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
5319 table
->DeleteTextures
= _mesa_DeleteTextures
;
5320 table
->DisableClientState
= _mesa_DisableClientState
;
5321 table
->DrawArrays
= _mesa_DrawArrays
;
5322 table
->DrawElements
= _mesa_DrawElements
;
5323 table
->EdgeFlagPointer
= _mesa_EdgeFlagPointer
;
5324 table
->EnableClientState
= _mesa_EnableClientState
;
5325 table
->GenTextures
= _mesa_GenTextures
;
5326 table
->GetPointerv
= _mesa_GetPointerv
;
5327 table
->IndexPointer
= _mesa_IndexPointer
;
5328 table
->Indexub
= _mesa_Indexub
;
5329 table
->Indexubv
= _mesa_Indexubv
;
5330 table
->InterleavedArrays
= _mesa_InterleavedArrays
;
5331 table
->IsTexture
= _mesa_IsTexture
;
5332 table
->NormalPointer
= _mesa_NormalPointer
;
5333 table
->PopClientAttrib
= _mesa_PopClientAttrib
;
5334 table
->PrioritizeTextures
= save_PrioritizeTextures
;
5335 table
->PushClientAttrib
= _mesa_PushClientAttrib
;
5336 table
->TexCoordPointer
= _mesa_TexCoordPointer
;
5337 table
->TexSubImage1D
= save_TexSubImage1D
;
5338 table
->TexSubImage2D
= save_TexSubImage2D
;
5339 table
->VertexPointer
= _mesa_VertexPointer
;
5342 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
5343 table
->DrawRangeElements
= _mesa_DrawRangeElements
;
5344 table
->TexImage3D
= save_TexImage3D
;
5345 table
->TexSubImage3D
= save_TexSubImage3D
;
5347 /* GL_ARB_imaging */
5348 /* Not all are supported */
5349 table
->BlendColor
= save_BlendColor
;
5350 table
->BlendEquation
= save_BlendEquation
;
5351 table
->ColorSubTable
= save_ColorSubTable
;
5352 table
->ColorTable
= save_ColorTable
;
5353 table
->ColorTableParameterfv
= save_ColorTableParameterfv
;
5354 table
->ColorTableParameteriv
= save_ColorTableParameteriv
;
5355 table
->ConvolutionFilter1D
= save_ConvolutionFilter1D
;
5356 table
->ConvolutionFilter2D
= save_ConvolutionFilter2D
;
5357 table
->ConvolutionParameterf
= save_ConvolutionParameterf
;
5358 table
->ConvolutionParameterfv
= save_ConvolutionParameterfv
;
5359 table
->ConvolutionParameteri
= save_ConvolutionParameteri
;
5360 table
->ConvolutionParameteriv
= save_ConvolutionParameteriv
;
5361 table
->CopyColorSubTable
= save_CopyColorSubTable
;
5362 table
->CopyColorTable
= save_CopyColorTable
;
5363 table
->CopyConvolutionFilter1D
= _mesa_CopyConvolutionFilter1D
;
5364 table
->CopyConvolutionFilter2D
= _mesa_CopyConvolutionFilter2D
;
5365 table
->GetColorTable
= _mesa_GetColorTable
;
5366 table
->GetColorTableParameterfv
= _mesa_GetColorTableParameterfv
;
5367 table
->GetColorTableParameteriv
= _mesa_GetColorTableParameteriv
;
5368 table
->GetConvolutionFilter
= _mesa_GetConvolutionFilter
;
5369 table
->GetConvolutionParameterfv
= _mesa_GetConvolutionParameterfv
;
5370 table
->GetConvolutionParameteriv
= _mesa_GetConvolutionParameteriv
;
5371 table
->GetHistogram
= _mesa_GetHistogram
;
5372 table
->GetHistogramParameterfv
= _mesa_GetHistogramParameterfv
;
5373 table
->GetHistogramParameteriv
= _mesa_GetHistogramParameteriv
;
5374 table
->GetMinmax
= _mesa_GetMinmax
;
5375 table
->GetMinmaxParameterfv
= _mesa_GetMinmaxParameterfv
;
5376 table
->GetMinmaxParameteriv
= _mesa_GetMinmaxParameteriv
;
5377 table
->GetSeparableFilter
= _mesa_GetSeparableFilter
;
5378 table
->Histogram
= save_Histogram
;
5379 table
->Minmax
= save_Minmax
;
5380 table
->ResetHistogram
= save_ResetHistogram
;
5381 table
->ResetMinmax
= save_ResetMinmax
;
5382 table
->SeparableFilter2D
= _mesa_SeparableFilter2D
;
5384 /* GL_EXT_texture3d */
5386 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
5387 table
->TexImage3DEXT
= save_TexImage3DEXT
;
5388 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
5391 /* GL_EXT_paletted_texture */
5393 table
->ColorTableEXT
= save_ColorTable
;
5394 table
->ColorSubTableEXT
= save_ColorSubTable
;
5396 table
->GetColorTableEXT
= _mesa_GetColorTable
;
5397 table
->GetColorTableParameterfvEXT
= _mesa_GetColorTableParameterfv
;
5398 table
->GetColorTableParameterivEXT
= _mesa_GetColorTableParameteriv
;
5400 /* 15. GL_SGIX_pixel_texture */
5401 table
->PixelTexGenSGIX
= save_PixelTexGenSGIX
;
5403 /* 15. GL_SGIS_pixel_texture */
5404 table
->PixelTexGenParameteriSGIS
= save_PixelTexGenParameteriSGIS
;
5405 table
->PixelTexGenParameterfSGIS
= save_PixelTexGenParameterfSGIS
;
5406 table
->PixelTexGenParameterivSGIS
= save_PixelTexGenParameterivSGIS
;
5407 table
->PixelTexGenParameterfvSGIS
= save_PixelTexGenParameterfvSGIS
;
5408 table
->GetPixelTexGenParameterivSGIS
= _mesa_GetPixelTexGenParameterivSGIS
;
5409 table
->GetPixelTexGenParameterfvSGIS
= _mesa_GetPixelTexGenParameterfvSGIS
;
5411 /* GL_EXT_compiled_vertex_array */
5412 table
->LockArraysEXT
= _mesa_LockArraysEXT
;
5413 table
->UnlockArraysEXT
= _mesa_UnlockArraysEXT
;
5415 /* GL_EXT_point_parameters */
5416 table
->PointParameterfEXT
= save_PointParameterfEXT
;
5417 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
5419 /* GL_PGI_misc_hints */
5420 table
->HintPGI
= save_HintPGI
;
5422 /* GL_EXT_polygon_offset */
5423 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
5425 /* GL_EXT_blend_minmax */
5427 table
->BlendEquationEXT
= save_BlendEquationEXT
;
5430 /* GL_EXT_blend_color */
5432 table
->BlendColorEXT
= save_BlendColorEXT
;
5435 /* GL_ARB_multitexture */
5436 table
->ActiveTextureARB
= save_ActiveTextureARB
;
5437 table
->ClientActiveTextureARB
= save_ClientActiveTextureARB
;
5438 table
->MultiTexCoord1dARB
= _mesa_MultiTexCoord1dARB
;
5439 table
->MultiTexCoord1dvARB
= _mesa_MultiTexCoord1dvARB
;
5440 table
->MultiTexCoord1fARB
= _mesa_MultiTexCoord1fARB
;
5441 table
->MultiTexCoord1fvARB
= _mesa_MultiTexCoord1fvARB
;
5442 table
->MultiTexCoord1iARB
= _mesa_MultiTexCoord1iARB
;
5443 table
->MultiTexCoord1ivARB
= _mesa_MultiTexCoord1ivARB
;
5444 table
->MultiTexCoord1sARB
= _mesa_MultiTexCoord1sARB
;
5445 table
->MultiTexCoord1svARB
= _mesa_MultiTexCoord1svARB
;
5446 table
->MultiTexCoord2dARB
= _mesa_MultiTexCoord2dARB
;
5447 table
->MultiTexCoord2dvARB
= _mesa_MultiTexCoord2dvARB
;
5448 table
->MultiTexCoord2fARB
= _mesa_MultiTexCoord2fARB
;
5449 table
->MultiTexCoord2fvARB
= _mesa_MultiTexCoord2fvARB
;
5450 table
->MultiTexCoord2iARB
= _mesa_MultiTexCoord2iARB
;
5451 table
->MultiTexCoord2ivARB
= _mesa_MultiTexCoord2ivARB
;
5452 table
->MultiTexCoord2sARB
= _mesa_MultiTexCoord2sARB
;
5453 table
->MultiTexCoord2svARB
= _mesa_MultiTexCoord2svARB
;
5454 table
->MultiTexCoord3dARB
= _mesa_MultiTexCoord3dARB
;
5455 table
->MultiTexCoord3dvARB
= _mesa_MultiTexCoord3dvARB
;
5456 table
->MultiTexCoord3fARB
= _mesa_MultiTexCoord3fARB
;
5457 table
->MultiTexCoord3fvARB
= _mesa_MultiTexCoord3fvARB
;
5458 table
->MultiTexCoord3iARB
= _mesa_MultiTexCoord3iARB
;
5459 table
->MultiTexCoord3ivARB
= _mesa_MultiTexCoord3ivARB
;
5460 table
->MultiTexCoord3sARB
= _mesa_MultiTexCoord3sARB
;
5461 table
->MultiTexCoord3svARB
= _mesa_MultiTexCoord3svARB
;
5462 table
->MultiTexCoord4dARB
= _mesa_MultiTexCoord4dARB
;
5463 table
->MultiTexCoord4dvARB
= _mesa_MultiTexCoord4dvARB
;
5464 table
->MultiTexCoord4fARB
= _mesa_MultiTexCoord4fARB
;
5465 table
->MultiTexCoord4fvARB
= _mesa_MultiTexCoord4fvARB
;
5466 table
->MultiTexCoord4iARB
= _mesa_MultiTexCoord4iARB
;
5467 table
->MultiTexCoord4ivARB
= _mesa_MultiTexCoord4ivARB
;
5468 table
->MultiTexCoord4sARB
= _mesa_MultiTexCoord4sARB
;
5469 table
->MultiTexCoord4svARB
= _mesa_MultiTexCoord4svARB
;
5471 /* GL_EXT_blend_func_separate */
5472 table
->BlendFuncSeparateEXT
= save_BlendFuncSeparateEXT
;
5474 /* GL_MESA_window_pos */
5475 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
5476 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
5477 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
5478 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
5479 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
5480 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
5481 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
5482 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
5483 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
5484 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
5485 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
5486 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
5487 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
5488 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
5489 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
5490 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
5491 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
5492 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
5493 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
5494 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
5495 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
5496 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
5497 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
5498 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
5500 /* GL_MESA_resize_buffers */
5501 table
->ResizeBuffersMESA
= _mesa_ResizeBuffersMESA
;
5503 /* GL_ARB_transpose_matrix */
5504 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
5505 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
5506 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
5507 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
5509 /* ARB 12. GL_ARB_texture_compression */
5510 table
->CompressedTexImage3DARB
= save_CompressedTexImage3DARB
;
5511 table
->CompressedTexImage2DARB
= save_CompressedTexImage2DARB
;
5512 table
->CompressedTexImage1DARB
= save_CompressedTexImage1DARB
;
5513 table
->CompressedTexSubImage3DARB
= save_CompressedTexSubImage3DARB
;
5514 table
->CompressedTexSubImage2DARB
= save_CompressedTexSubImage2DARB
;
5515 table
->CompressedTexSubImage1DARB
= save_CompressedTexSubImage1DARB
;
5516 table
->GetCompressedTexImageARB
= _mesa_GetCompressedTexImageARB
;
5524 static const char *enum_string( GLenum k
)
5526 return gl_lookup_enum_by_nr( k
);
5531 * Print the commands in a display list. For debugging only.
5532 * TODO: many commands aren't handled yet.
5534 static void print_list( GLcontext
*ctx
, FILE *f
, GLuint list
)
5540 if (!glIsList(list
)) {
5541 fprintf(f
,"%u is not a display list ID\n",list
);
5545 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
5547 fprintf( f
, "START-LIST %u, address %p\n", list
, (void*)n
);
5549 done
= n
? GL_FALSE
: GL_TRUE
;
5551 opcode
= n
[0].opcode
;
5555 fprintf(f
,"accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
5558 fprintf(f
,"Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
5559 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
5561 case OPCODE_CALL_LIST
:
5562 fprintf(f
,"CallList %d\n", (int) n
[1].ui
);
5564 case OPCODE_CALL_LIST_OFFSET
:
5565 fprintf(f
,"CallList %d + offset %u = %u\n", (int) n
[1].ui
,
5566 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
5568 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5569 fprintf(f
,"ColorTableParameterfv %s %s %f %f %f %f\n",
5570 enum_string(n
[1].e
), enum_string(n
[2].e
),
5571 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5573 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5574 fprintf(f
,"ColorTableParameteriv %s %s %d %d %d %d\n",
5575 enum_string(n
[1].e
), enum_string(n
[2].e
),
5576 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
5578 case OPCODE_DISABLE
:
5579 fprintf(f
,"Disable %s\n", enum_string(n
[1].e
));
5582 fprintf(f
,"Enable %s\n", enum_string(n
[1].e
));
5584 case OPCODE_FRUSTUM
:
5585 fprintf(f
,"Frustum %g %g %g %g %g %g\n",
5586 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5588 case OPCODE_LINE_STIPPLE
:
5589 fprintf(f
,"LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
5591 case OPCODE_LOAD_IDENTITY
:
5592 fprintf(f
,"LoadIdentity\n");
5594 case OPCODE_LOAD_MATRIX
:
5595 fprintf(f
,"LoadMatrix\n");
5596 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
5597 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
5598 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
5599 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
5601 case OPCODE_MULT_MATRIX
:
5602 fprintf(f
,"MultMatrix (or Rotate)\n");
5603 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
5604 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
5605 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
5606 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
5609 fprintf(f
,"Ortho %g %g %g %g %g %g\n",
5610 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5612 case OPCODE_POP_ATTRIB
:
5613 fprintf(f
,"PopAttrib\n");
5615 case OPCODE_POP_MATRIX
:
5616 fprintf(f
,"PopMatrix\n");
5618 case OPCODE_POP_NAME
:
5619 fprintf(f
,"PopName\n");
5621 case OPCODE_PUSH_ATTRIB
:
5622 fprintf(f
,"PushAttrib %x\n", n
[1].bf
);
5624 case OPCODE_PUSH_MATRIX
:
5625 fprintf(f
,"PushMatrix\n");
5627 case OPCODE_PUSH_NAME
:
5628 fprintf(f
,"PushName %d\n", (int) n
[1].ui
);
5630 case OPCODE_RASTER_POS
:
5631 fprintf(f
,"RasterPos %g %g %g %g\n", n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
5634 fprintf( f
, "Rectf %g %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
5637 fprintf(f
,"Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
5639 case OPCODE_TRANSLATE
:
5640 fprintf(f
,"Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
5642 case OPCODE_BIND_TEXTURE
:
5643 fprintf(f
,"BindTexture %s %d\n", gl_lookup_enum_by_nr(n
[1].ui
),
5646 case OPCODE_SHADE_MODEL
:
5647 fprintf(f
,"ShadeModel %s\n", gl_lookup_enum_by_nr(n
[1].ui
));
5651 * meta opcodes/commands
5654 fprintf(f
,"Error: %s %s\n", enum_string(n
[1].e
), (const char *)n
[2].data
);
5656 case OPCODE_VERTEX_CASSETTE
:
5657 fprintf(f
,"VERTEX-CASSETTE, id %u, rows %u..%u\n",
5658 ((struct immediate
*) n
[1].data
)->id
,
5661 gl_print_cassette( (struct immediate
*) n
[1].data
);
5663 case OPCODE_CONTINUE
:
5664 fprintf(f
,"DISPLAY-LIST-CONTINUE\n");
5665 n
= (Node
*) n
[1].next
;
5667 case OPCODE_END_OF_LIST
:
5668 fprintf(f
,"END-LIST %u\n", list
);
5672 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
5673 fprintf(f
,"ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
5678 fprintf(f
,"command %d, %u operands\n",opcode
,InstSize
[opcode
]);
5682 /* increment n to point to next compiled command */
5683 if (opcode
!=OPCODE_CONTINUE
) {
5684 n
+= InstSize
[opcode
];
5692 * Clients may call this function to help debug display list problems.
5693 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
5694 * changed, or break in the future without notice.
5696 void mesa_print_display_list( GLuint list
)
5698 GET_CURRENT_CONTEXT(ctx
);
5699 print_list( ctx
, stderr
, list
);