1 /* $Id: dlist.c,v 1.54 2000/11/24 15:21:59 keithw 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.
33 #include "api_loopback.h"
48 #include "extensions.h"
53 #include "histogram.h"
73 #include "math/m_matrix.h"
74 #include "math/m_xform.h"
81 Functions which aren't compiled but executed immediately:
96 Functions which cause errors if called while compiling a display list:
103 * Display list instructions are stored as sequences of "nodes". Nodes
104 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
105 * are linked together with a pointer.
109 /* How many nodes to allocate at a time:
110 * - reduced now that we hold vertices etc. elsewhere.
112 #define BLOCK_SIZE 64
116 * Display list opcodes.
118 * The fact that these identifiers are assigned consecutive
119 * integer values starting at 0 is very important, see InstSize array usage)
128 OPCODE_BLEND_EQUATION
,
130 OPCODE_BLEND_FUNC_SEPARATE
,
132 OPCODE_CALL_LIST_OFFSET
,
138 OPCODE_CLEAR_STENCIL
,
141 OPCODE_COLOR_MATERIAL
,
143 OPCODE_COLOR_TABLE_PARAMETER_FV
,
144 OPCODE_COLOR_TABLE_PARAMETER_IV
,
145 OPCODE_COLOR_SUB_TABLE
,
146 OPCODE_CONVOLUTION_FILTER_1D
,
147 OPCODE_CONVOLUTION_FILTER_2D
,
148 OPCODE_CONVOLUTION_PARAMETER_I
,
149 OPCODE_CONVOLUTION_PARAMETER_IV
,
150 OPCODE_CONVOLUTION_PARAMETER_F
,
151 OPCODE_CONVOLUTION_PARAMETER_FV
,
152 OPCODE_COPY_COLOR_SUB_TABLE
,
153 OPCODE_COPY_COLOR_TABLE
,
155 OPCODE_COPY_TEX_IMAGE1D
,
156 OPCODE_COPY_TEX_IMAGE2D
,
157 OPCODE_COPY_TEX_SUB_IMAGE1D
,
158 OPCODE_COPY_TEX_SUB_IMAGE2D
,
159 OPCODE_COPY_TEX_SUB_IMAGE3D
,
187 OPCODE_LOAD_IDENTITY
,
201 OPCODE_PIXEL_TRANSFER
,
204 OPCODE_POINT_PARAMETERS
,
206 OPCODE_POLYGON_STIPPLE
,
207 OPCODE_POLYGON_OFFSET
,
211 OPCODE_PRIORITIZE_TEXTURE
,
217 OPCODE_RESET_HISTOGRAM
,
218 OPCODE_RESET_MIN_MAX
,
222 OPCODE_SELECT_TEXTURE_SGIS
,
223 OPCODE_SELECT_TEXTURE_COORD_SET
,
234 OPCODE_TEX_SUB_IMAGE1D
,
235 OPCODE_TEX_SUB_IMAGE2D
,
236 OPCODE_TEX_SUB_IMAGE3D
,
240 /* GL_ARB_multitexture */
241 OPCODE_ACTIVE_TEXTURE
,
242 OPCODE_CLIENT_ACTIVE_TEXTURE
,
243 /* GL_SGIX/SGIS_pixel_texture */
244 OPCODE_PIXEL_TEXGEN_SGIX
,
245 OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
,
246 /* GL_ARB_texture_compression */
247 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
248 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
249 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
250 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
251 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
252 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
253 /* The following three are meta instructions */
254 OPCODE_ERROR
, /* raise compiled-in error */
262 * Each instruction in the display list is stored as a sequence of
263 * contiguous nodes in memory.
264 * Each node is the union of a variety of datatypes.
278 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
283 /* Number of nodes of storage needed for each instruction. Sizes for
284 * dynamically allocated opcodes are stored in the context struct.
286 static GLuint InstSize
[ OPCODE_END_OF_LIST
+1 ];
288 void mesa_print_display_list( GLuint list
);
291 /**********************************************************************/
292 /***** Private *****/
293 /**********************************************************************/
300 * Make an empty display list. This is used by glGenLists() to
301 * reserver display list IDs.
303 static Node
*make_empty_list( void )
305 Node
*n
= (Node
*) MALLOC( sizeof(Node
) );
306 n
[0].opcode
= OPCODE_END_OF_LIST
;
313 * Destroy all nodes in a display list.
314 * Input: list - display list number
316 void gl_destroy_list( GLcontext
*ctx
, GLuint list
)
324 block
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
327 done
= block
? GL_FALSE
: GL_TRUE
;
330 /* check for extension opcodes first */
332 int i
= (int)n
[0].opcode
- (int)OPCODE_DRV_0
;
333 if (i
>= 0 && i
< ctx
->listext
.nr_opcodes
) {
334 ctx
->listext
.opcode
[i
].destroy(ctx
, &n
[1]);
335 n
+= ctx
->listext
.opcode
[i
].size
;
338 switch (n
[0].opcode
) {
341 n
+= InstSize
[n
[0].opcode
];
345 n
+= InstSize
[n
[0].opcode
];
347 case OPCODE_DRAW_PIXELS
:
349 n
+= InstSize
[n
[0].opcode
];
353 n
+= InstSize
[n
[0].opcode
];
355 case OPCODE_COLOR_TABLE
:
357 n
+= InstSize
[n
[0].opcode
];
359 case OPCODE_COLOR_SUB_TABLE
:
361 n
+= InstSize
[n
[0].opcode
];
363 case OPCODE_CONVOLUTION_FILTER_1D
:
365 n
+= InstSize
[n
[0].opcode
];
367 case OPCODE_CONVOLUTION_FILTER_2D
:
369 n
+= InstSize
[n
[0].opcode
];
371 case OPCODE_POLYGON_STIPPLE
:
373 n
+= InstSize
[n
[0].opcode
];
375 case OPCODE_TEX_IMAGE1D
:
377 n
+= InstSize
[n
[0].opcode
];
379 case OPCODE_TEX_IMAGE2D
:
381 n
+= InstSize
[n
[0].opcode
];
383 case OPCODE_TEX_IMAGE3D
:
385 n
+= InstSize
[n
[0].opcode
];
387 case OPCODE_TEX_SUB_IMAGE1D
:
389 n
+= InstSize
[n
[0].opcode
];
391 case OPCODE_TEX_SUB_IMAGE2D
:
393 n
+= InstSize
[n
[0].opcode
];
395 case OPCODE_TEX_SUB_IMAGE3D
:
397 n
+= InstSize
[n
[0].opcode
];
399 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
401 n
+= InstSize
[n
[0].opcode
];
403 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
405 n
+= InstSize
[n
[0].opcode
];
407 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
409 n
+= InstSize
[n
[0].opcode
];
411 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
413 n
+= InstSize
[n
[0].opcode
];
415 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
417 n
+= InstSize
[n
[0].opcode
];
419 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
421 n
+= InstSize
[n
[0].opcode
];
423 case OPCODE_CONTINUE
:
424 n
= (Node
*) n
[1].next
;
428 case OPCODE_END_OF_LIST
:
433 /* Most frequent case */
434 n
+= InstSize
[n
[0].opcode
];
440 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
446 * Translate the nth element of list from type to GLuint.
448 static GLuint
translate_id( GLsizei n
, GLenum type
, const GLvoid
*list
)
460 bptr
= (GLbyte
*) list
;
461 return (GLuint
) *(bptr
+n
);
462 case GL_UNSIGNED_BYTE
:
463 ubptr
= (GLubyte
*) list
;
464 return (GLuint
) *(ubptr
+n
);
466 sptr
= (GLshort
*) list
;
467 return (GLuint
) *(sptr
+n
);
468 case GL_UNSIGNED_SHORT
:
469 usptr
= (GLushort
*) list
;
470 return (GLuint
) *(usptr
+n
);
472 iptr
= (GLint
*) list
;
473 return (GLuint
) *(iptr
+n
);
474 case GL_UNSIGNED_INT
:
475 uiptr
= (GLuint
*) list
;
476 return (GLuint
) *(uiptr
+n
);
478 fptr
= (GLfloat
*) list
;
479 return (GLuint
) *(fptr
+n
);
481 ubptr
= ((GLubyte
*) list
) + 2*n
;
482 return (GLuint
) *ubptr
* 256 + (GLuint
) *(ubptr
+1);
484 ubptr
= ((GLubyte
*) list
) + 3*n
;
485 return (GLuint
) *ubptr
* 65536
486 + (GLuint
) *(ubptr
+1) * 256
487 + (GLuint
) *(ubptr
+2);
489 ubptr
= ((GLubyte
*) list
) + 4*n
;
490 return (GLuint
) *ubptr
* 16777216
491 + (GLuint
) *(ubptr
+1) * 65536
492 + (GLuint
) *(ubptr
+2) * 256
493 + (GLuint
) *(ubptr
+3);
502 /**********************************************************************/
504 /**********************************************************************/
506 void gl_init_lists( void )
508 static int init_flag
= 0;
511 InstSize
[OPCODE_ACCUM
] = 3;
512 InstSize
[OPCODE_ALPHA_FUNC
] = 3;
513 InstSize
[OPCODE_BIND_TEXTURE
] = 3;
514 InstSize
[OPCODE_BITMAP
] = 8;
515 InstSize
[OPCODE_BLEND_COLOR
] = 5;
516 InstSize
[OPCODE_BLEND_EQUATION
] = 2;
517 InstSize
[OPCODE_BLEND_FUNC
] = 3;
518 InstSize
[OPCODE_BLEND_FUNC_SEPARATE
] = 5;
519 InstSize
[OPCODE_CALL_LIST
] = 2;
520 InstSize
[OPCODE_CALL_LIST_OFFSET
] = 2;
521 InstSize
[OPCODE_CLEAR
] = 2;
522 InstSize
[OPCODE_CLEAR_ACCUM
] = 5;
523 InstSize
[OPCODE_CLEAR_COLOR
] = 5;
524 InstSize
[OPCODE_CLEAR_DEPTH
] = 2;
525 InstSize
[OPCODE_CLEAR_INDEX
] = 2;
526 InstSize
[OPCODE_CLEAR_STENCIL
] = 2;
527 InstSize
[OPCODE_CLIP_PLANE
] = 6;
528 InstSize
[OPCODE_COLOR_MASK
] = 5;
529 InstSize
[OPCODE_COLOR_MATERIAL
] = 3;
530 InstSize
[OPCODE_COLOR_TABLE
] = 7;
531 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_FV
] = 7;
532 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_IV
] = 7;
533 InstSize
[OPCODE_COLOR_SUB_TABLE
] = 7;
534 InstSize
[OPCODE_CONVOLUTION_FILTER_1D
] = 7;
535 InstSize
[OPCODE_CONVOLUTION_FILTER_2D
] = 8;
536 InstSize
[OPCODE_CONVOLUTION_PARAMETER_I
] = 4;
537 InstSize
[OPCODE_CONVOLUTION_PARAMETER_IV
] = 7;
538 InstSize
[OPCODE_CONVOLUTION_PARAMETER_F
] = 4;
539 InstSize
[OPCODE_CONVOLUTION_PARAMETER_FV
] = 7;
540 InstSize
[OPCODE_COPY_PIXELS
] = 6;
541 InstSize
[OPCODE_COPY_COLOR_SUB_TABLE
] = 6;
542 InstSize
[OPCODE_COPY_COLOR_TABLE
] = 6;
543 InstSize
[OPCODE_COPY_TEX_IMAGE1D
] = 8;
544 InstSize
[OPCODE_COPY_TEX_IMAGE2D
] = 9;
545 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE1D
] = 7;
546 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE2D
] = 9;
547 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE3D
] = 10;
548 InstSize
[OPCODE_CULL_FACE
] = 2;
549 InstSize
[OPCODE_DEPTH_FUNC
] = 2;
550 InstSize
[OPCODE_DEPTH_MASK
] = 2;
551 InstSize
[OPCODE_DEPTH_RANGE
] = 3;
552 InstSize
[OPCODE_DISABLE
] = 2;
553 InstSize
[OPCODE_DRAW_BUFFER
] = 2;
554 InstSize
[OPCODE_DRAW_PIXELS
] = 6;
555 InstSize
[OPCODE_ENABLE
] = 2;
556 InstSize
[OPCODE_EVALCOORD1
] = 2;
557 InstSize
[OPCODE_EVALCOORD2
] = 3;
558 InstSize
[OPCODE_EVALMESH1
] = 4;
559 InstSize
[OPCODE_EVALMESH2
] = 6;
560 InstSize
[OPCODE_EVALPOINT1
] = 2;
561 InstSize
[OPCODE_EVALPOINT2
] = 3;
562 InstSize
[OPCODE_FOG
] = 6;
563 InstSize
[OPCODE_FRONT_FACE
] = 2;
564 InstSize
[OPCODE_FRUSTUM
] = 7;
565 InstSize
[OPCODE_HINT
] = 3;
566 InstSize
[OPCODE_HINT_PGI
] = 3;
567 InstSize
[OPCODE_HISTOGRAM
] = 5;
568 InstSize
[OPCODE_INDEX_MASK
] = 2;
569 InstSize
[OPCODE_INIT_NAMES
] = 1;
570 InstSize
[OPCODE_LIGHT
] = 7;
571 InstSize
[OPCODE_LIGHT_MODEL
] = 6;
572 InstSize
[OPCODE_LINE_STIPPLE
] = 3;
573 InstSize
[OPCODE_LINE_WIDTH
] = 2;
574 InstSize
[OPCODE_LIST_BASE
] = 2;
575 InstSize
[OPCODE_LOAD_IDENTITY
] = 1;
576 InstSize
[OPCODE_LOAD_MATRIX
] = 17;
577 InstSize
[OPCODE_LOAD_NAME
] = 2;
578 InstSize
[OPCODE_LOGIC_OP
] = 2;
579 InstSize
[OPCODE_MAP1
] = 7;
580 InstSize
[OPCODE_MAP2
] = 11;
581 InstSize
[OPCODE_MAPGRID1
] = 4;
582 InstSize
[OPCODE_MAPGRID2
] = 7;
583 InstSize
[OPCODE_MATRIX_MODE
] = 2;
584 InstSize
[OPCODE_MIN_MAX
] = 4;
585 InstSize
[OPCODE_MULT_MATRIX
] = 17;
586 InstSize
[OPCODE_ORTHO
] = 7;
587 InstSize
[OPCODE_PASSTHROUGH
] = 2;
588 InstSize
[OPCODE_PIXEL_MAP
] = 4;
589 InstSize
[OPCODE_PIXEL_TRANSFER
] = 3;
590 InstSize
[OPCODE_PIXEL_ZOOM
] = 3;
591 InstSize
[OPCODE_POINT_SIZE
] = 2;
592 InstSize
[OPCODE_POINT_PARAMETERS
] = 5;
593 InstSize
[OPCODE_POLYGON_MODE
] = 3;
594 InstSize
[OPCODE_POLYGON_STIPPLE
] = 2;
595 InstSize
[OPCODE_POLYGON_OFFSET
] = 3;
596 InstSize
[OPCODE_POP_ATTRIB
] = 1;
597 InstSize
[OPCODE_POP_MATRIX
] = 1;
598 InstSize
[OPCODE_POP_NAME
] = 1;
599 InstSize
[OPCODE_PRIORITIZE_TEXTURE
] = 3;
600 InstSize
[OPCODE_PUSH_ATTRIB
] = 2;
601 InstSize
[OPCODE_PUSH_MATRIX
] = 1;
602 InstSize
[OPCODE_PUSH_NAME
] = 2;
603 InstSize
[OPCODE_RASTER_POS
] = 5;
604 InstSize
[OPCODE_READ_BUFFER
] = 2;
605 InstSize
[OPCODE_RESET_HISTOGRAM
] = 2;
606 InstSize
[OPCODE_RESET_MIN_MAX
] = 2;
607 InstSize
[OPCODE_ROTATE
] = 5;
608 InstSize
[OPCODE_SCALE
] = 4;
609 InstSize
[OPCODE_SCISSOR
] = 5;
610 InstSize
[OPCODE_STENCIL_FUNC
] = 4;
611 InstSize
[OPCODE_STENCIL_MASK
] = 2;
612 InstSize
[OPCODE_STENCIL_OP
] = 4;
613 InstSize
[OPCODE_SHADE_MODEL
] = 2;
614 InstSize
[OPCODE_TEXENV
] = 7;
615 InstSize
[OPCODE_TEXGEN
] = 7;
616 InstSize
[OPCODE_TEXPARAMETER
] = 7;
617 InstSize
[OPCODE_TEX_IMAGE1D
] = 9;
618 InstSize
[OPCODE_TEX_IMAGE2D
] = 10;
619 InstSize
[OPCODE_TEX_IMAGE3D
] = 11;
620 InstSize
[OPCODE_TEX_SUB_IMAGE1D
] = 8;
621 InstSize
[OPCODE_TEX_SUB_IMAGE2D
] = 10;
622 InstSize
[OPCODE_TEX_SUB_IMAGE3D
] = 12;
623 InstSize
[OPCODE_TRANSLATE
] = 4;
624 InstSize
[OPCODE_VIEWPORT
] = 5;
625 InstSize
[OPCODE_WINDOW_POS
] = 5;
626 InstSize
[OPCODE_CONTINUE
] = 2;
627 InstSize
[OPCODE_ERROR
] = 3;
628 InstSize
[OPCODE_END_OF_LIST
] = 1;
629 /* GL_SGIX/SGIS_pixel_texture */
630 InstSize
[OPCODE_PIXEL_TEXGEN_SGIX
] = 2;
631 InstSize
[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
] = 3;
632 /* GL_ARB_texture_compression */
633 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_1D
] = 8;
634 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_2D
] = 9;
635 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_3D
] = 10;
636 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
] = 8;
637 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
] = 10;
638 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
] = 12;
639 /* GL_ARB_multitexture */
640 InstSize
[OPCODE_ACTIVE_TEXTURE
] = 2;
641 InstSize
[OPCODE_CLIENT_ACTIVE_TEXTURE
] = 2;
648 * Allocate space for a display list instruction.
649 * Input: opcode - type of instruction
650 * argcount - size in bytes of data required.
651 * Return: pointer to the usable data area (not including the internal
655 _mesa_alloc_instruction( GLcontext
*ctx
, int opcode
, GLint sz
)
658 GLuint count
= 1 + (sz
+ sizeof(Node
) - 1) / sizeof(Node
);
661 if (opcode
< (int) OPCODE_DRV_0
) {
662 assert( (GLint
) count
== InstSize
[opcode
] );
666 if (ctx
->CurrentPos
+ count
+ 2 > BLOCK_SIZE
) {
667 /* This block is full. Allocate a new block and chain to it */
668 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
669 n
[0].opcode
= OPCODE_CONTINUE
;
670 newblock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
672 gl_error( ctx
, GL_OUT_OF_MEMORY
, "Building display list" );
675 n
[1].next
= (Node
*) newblock
;
676 ctx
->CurrentBlock
= newblock
;
680 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
681 ctx
->CurrentPos
+= count
;
683 n
[0].opcode
= (OpCode
) opcode
;
685 return (void *)&n
[1];
689 /* Allow modules and drivers to get their own opcodes.
692 _mesa_alloc_opcode( GLcontext
*ctx
,
694 void (*execute
)( GLcontext
*, void * ),
695 void (*destroy
)( GLcontext
*, void * ),
696 void (*print
)( GLcontext
*, void * ) )
698 if (ctx
->listext
.nr_opcodes
< GL_MAX_EXT_OPCODES
) {
699 GLuint i
= ctx
->listext
.nr_opcodes
++;
700 ctx
->listext
.opcode
[i
].size
= 1 + (sz
+ sizeof(Node
) - 1)/sizeof(Node
);
701 ctx
->listext
.opcode
[i
].execute
= execute
;
702 ctx
->listext
.opcode
[i
].destroy
= destroy
;
703 ctx
->listext
.opcode
[i
].print
= print
;
704 return i
+ OPCODE_DRV_0
;
711 /* Mimic the old behaviour of alloc_instruction:
712 * - sz is in units of sizeof(Node)
713 * - return value a pointer to sizeof(Node) before the actual
716 #define ALLOC_INSTRUCTION(ctx, opcode, sz) \
717 ((Node *)_mesa_alloc_instruction(ctx, opcode, sz*sizeof(Node)) - 1)
722 * Display List compilation functions
724 static void save_Accum( GLenum op
, GLfloat value
)
726 GET_CURRENT_CONTEXT(ctx
);
728 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
729 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACCUM
, 2 );
734 if (ctx
->ExecuteFlag
) {
735 (*ctx
->Exec
->Accum
)( op
, value
);
740 static void save_AlphaFunc( GLenum func
, GLclampf ref
)
742 GET_CURRENT_CONTEXT(ctx
);
744 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
745 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ALPHA_FUNC
, 2 );
748 n
[2].f
= (GLfloat
) ref
;
750 if (ctx
->ExecuteFlag
) {
751 (*ctx
->Exec
->AlphaFunc
)( func
, ref
);
756 static void save_BindTexture( GLenum target
, GLuint texture
)
758 GET_CURRENT_CONTEXT(ctx
);
760 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
761 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_TEXTURE
, 2 );
766 if (ctx
->ExecuteFlag
) {
767 (*ctx
->Exec
->BindTexture
)( target
, texture
);
772 static void save_Bitmap( GLsizei width
, GLsizei height
,
773 GLfloat xorig
, GLfloat yorig
,
774 GLfloat xmove
, GLfloat ymove
,
775 const GLubyte
*pixels
)
777 GET_CURRENT_CONTEXT(ctx
);
778 GLvoid
*image
= _mesa_unpack_bitmap( width
, height
, pixels
, &ctx
->Unpack
);
780 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
781 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BITMAP
, 7 );
783 n
[1].i
= (GLint
) width
;
784 n
[2].i
= (GLint
) height
;
794 if (ctx
->ExecuteFlag
) {
795 (*ctx
->Exec
->Bitmap
)( width
, height
,
796 xorig
, yorig
, xmove
, ymove
, pixels
);
801 static void save_BlendEquation( GLenum mode
)
803 GET_CURRENT_CONTEXT(ctx
);
805 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
806 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_EQUATION
, 1 );
810 if (ctx
->ExecuteFlag
) {
811 (*ctx
->Exec
->BlendEquation
)( mode
);
816 static void save_BlendFunc( GLenum sfactor
, GLenum dfactor
)
818 GET_CURRENT_CONTEXT(ctx
);
820 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
821 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_FUNC
, 2 );
826 if (ctx
->ExecuteFlag
) {
827 (*ctx
->Exec
->BlendFunc
)( sfactor
, dfactor
);
832 static void save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
833 GLenum sfactorA
, GLenum dfactorA
)
835 GET_CURRENT_CONTEXT(ctx
);
837 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
838 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4 );
845 if (ctx
->ExecuteFlag
) {
846 (*ctx
->Exec
->BlendFuncSeparateEXT
)( sfactorRGB
, dfactorRGB
,
852 static void save_BlendColor( GLfloat red
, GLfloat green
,
853 GLfloat blue
, GLfloat alpha
)
855 GET_CURRENT_CONTEXT(ctx
);
857 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
858 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_COLOR
, 4 );
865 if (ctx
->ExecuteFlag
) {
866 (*ctx
->Exec
->BlendColor
)( red
, green
, blue
, alpha
);
871 static void save_CallList( GLuint list
)
873 GET_CURRENT_CONTEXT(ctx
);
875 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
876 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CALL_LIST
, 1 );
880 if (ctx
->ExecuteFlag
) {
881 (*ctx
->Exec
->CallList
)( list
);
886 static void save_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
888 GET_CURRENT_CONTEXT(ctx
);
890 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
893 GLuint list
= translate_id( i
, type
, lists
);
894 Node
*n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CALL_LIST_OFFSET
, 1 );
899 if (ctx
->ExecuteFlag
) {
900 (*ctx
->Exec
->CallLists
)( n
, type
, lists
);
905 static void save_Clear( GLbitfield mask
)
907 GET_CURRENT_CONTEXT(ctx
);
909 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
910 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR
, 1 );
914 if (ctx
->ExecuteFlag
) {
915 (*ctx
->Exec
->Clear
)( mask
);
920 static void save_ClearAccum( GLfloat red
, GLfloat green
,
921 GLfloat blue
, GLfloat alpha
)
923 GET_CURRENT_CONTEXT(ctx
);
925 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
926 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_ACCUM
, 4 );
933 if (ctx
->ExecuteFlag
) {
934 (*ctx
->Exec
->ClearAccum
)( red
, green
, blue
, alpha
);
939 static void save_ClearColor( GLclampf red
, GLclampf green
,
940 GLclampf blue
, GLclampf alpha
)
942 GET_CURRENT_CONTEXT(ctx
);
944 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
945 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_COLOR
, 4 );
952 if (ctx
->ExecuteFlag
) {
953 (*ctx
->Exec
->ClearColor
)( red
, green
, blue
, alpha
);
958 static void save_ClearDepth( GLclampd depth
)
960 GET_CURRENT_CONTEXT(ctx
);
962 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
963 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_DEPTH
, 1 );
965 n
[1].f
= (GLfloat
) depth
;
967 if (ctx
->ExecuteFlag
) {
968 (*ctx
->Exec
->ClearDepth
)( depth
);
973 static void save_ClearIndex( GLfloat c
)
975 GET_CURRENT_CONTEXT(ctx
);
977 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
978 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_INDEX
, 1 );
982 if (ctx
->ExecuteFlag
) {
983 (*ctx
->Exec
->ClearIndex
)( c
);
988 static void save_ClearStencil( GLint s
)
990 GET_CURRENT_CONTEXT(ctx
);
992 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
993 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_STENCIL
, 1 );
997 if (ctx
->ExecuteFlag
) {
998 (*ctx
->Exec
->ClearStencil
)( s
);
1003 static void save_ClipPlane( GLenum plane
, const GLdouble
*equ
)
1005 GET_CURRENT_CONTEXT(ctx
);
1007 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1008 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLIP_PLANE
, 5 );
1016 if (ctx
->ExecuteFlag
) {
1017 (*ctx
->Exec
->ClipPlane
)( plane
, equ
);
1023 static void save_ColorMask( GLboolean red
, GLboolean green
,
1024 GLboolean blue
, GLboolean alpha
)
1026 GET_CURRENT_CONTEXT(ctx
);
1028 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1029 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_MASK
, 4 );
1036 if (ctx
->ExecuteFlag
) {
1037 (*ctx
->Exec
->ColorMask
)( red
, green
, blue
, alpha
);
1042 static void save_ColorMaterial( GLenum face
, GLenum mode
)
1044 GET_CURRENT_CONTEXT(ctx
);
1046 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1047 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_MATERIAL
, 2 );
1052 if (ctx
->ExecuteFlag
) {
1053 (*ctx
->Exec
->ColorMaterial
)( face
, mode
);
1058 static void save_ColorTable( GLenum target
, GLenum internalFormat
,
1059 GLsizei width
, GLenum format
, GLenum type
,
1060 const GLvoid
*table
)
1062 GET_CURRENT_CONTEXT(ctx
);
1063 if (target
== GL_PROXY_TEXTURE_1D
||
1064 target
== GL_PROXY_TEXTURE_2D
||
1065 target
== GL_PROXY_TEXTURE_3D
) {
1066 /* execute immediately */
1067 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1068 format
, type
, table
);
1071 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, table
,
1074 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1075 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE
, 6 );
1078 n
[2].e
= internalFormat
;
1087 if (ctx
->ExecuteFlag
) {
1088 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1089 format
, type
, table
);
1097 save_ColorTableParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1099 GET_CURRENT_CONTEXT(ctx
);
1102 ASSERT_OUTSIDE_BEGIN_END(ctx
, "glColorTableParameterfv");
1103 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1105 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6 );
1110 if (pname
== GL_COLOR_TABLE_SGI
||
1111 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1112 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
) {
1119 if (ctx
->ExecuteFlag
) {
1120 (*ctx
->Exec
->ColorTableParameterfv
)( target
, pname
, params
);
1126 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1128 GET_CURRENT_CONTEXT(ctx
);
1131 ASSERT_OUTSIDE_BEGIN_END(ctx
, "glColorTableParameterfv");
1132 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1134 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6 );
1139 if (pname
== GL_COLOR_TABLE_SGI
||
1140 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1141 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
) {
1148 if (ctx
->ExecuteFlag
) {
1149 (*ctx
->Exec
->ColorTableParameteriv
)( target
, pname
, params
);
1155 static void save_ColorSubTable( GLenum target
, GLsizei start
, GLsizei count
,
1156 GLenum format
, GLenum type
,
1157 const GLvoid
*table
)
1159 GET_CURRENT_CONTEXT(ctx
);
1160 GLvoid
*image
= _mesa_unpack_image(count
, 1, 1, format
, type
, table
,
1163 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1164 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_SUB_TABLE
, 6 );
1176 if (ctx
->ExecuteFlag
) {
1177 (*ctx
->Exec
->ColorSubTable
)(target
, start
, count
, format
, type
, table
);
1183 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1184 GLint x
, GLint y
, GLsizei width
)
1186 GET_CURRENT_CONTEXT(ctx
);
1189 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1190 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 6 );
1198 if (ctx
->ExecuteFlag
) {
1199 (*ctx
->Exec
->CopyColorSubTable
)(target
, start
, x
, y
, width
);
1205 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1206 GLint x
, GLint y
, GLsizei width
)
1208 GET_CURRENT_CONTEXT(ctx
);
1211 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1212 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_TABLE
, 6 );
1215 n
[2].e
= internalformat
;
1220 if (ctx
->ExecuteFlag
) {
1221 (*ctx
->Exec
->CopyColorTable
)(target
, internalformat
, x
, y
, width
);
1227 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1228 GLenum format
, GLenum type
, const GLvoid
*filter
)
1230 GET_CURRENT_CONTEXT(ctx
);
1231 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, filter
,
1234 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1235 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6 );
1238 n
[2].e
= internalFormat
;
1247 if (ctx
->ExecuteFlag
) {
1248 (*ctx
->Exec
->ConvolutionFilter1D
)( target
, internalFormat
, width
,
1249 format
, type
, filter
);
1255 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1256 GLsizei width
, GLsizei height
, GLenum format
,
1257 GLenum type
, const GLvoid
*filter
)
1259 GET_CURRENT_CONTEXT(ctx
);
1260 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
, filter
,
1263 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1264 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7 );
1267 n
[2].e
= internalFormat
;
1277 if (ctx
->ExecuteFlag
) {
1278 (*ctx
->Exec
->ConvolutionFilter2D
)( target
, internalFormat
, width
, height
,
1279 format
, type
, filter
);
1285 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1287 GET_CURRENT_CONTEXT(ctx
);
1289 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1290 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3 );
1296 if (ctx
->ExecuteFlag
) {
1297 (*ctx
->Exec
->ConvolutionParameteri
)( target
, pname
, param
);
1303 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1305 GET_CURRENT_CONTEXT(ctx
);
1307 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1308 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6 );
1313 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1314 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1315 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1321 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1324 if (ctx
->ExecuteFlag
) {
1325 (*ctx
->Exec
->ConvolutionParameteriv
)( target
, pname
, params
);
1331 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1333 GET_CURRENT_CONTEXT(ctx
);
1335 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1336 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3 );
1342 if (ctx
->ExecuteFlag
) {
1343 (*ctx
->Exec
->ConvolutionParameterf
)( target
, pname
, param
);
1349 save_ConvolutionParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1351 GET_CURRENT_CONTEXT(ctx
);
1353 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1354 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6 );
1359 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1360 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1361 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1367 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1370 if (ctx
->ExecuteFlag
) {
1371 (*ctx
->Exec
->ConvolutionParameterfv
)( target
, pname
, params
);
1376 static void save_CopyPixels( GLint x
, GLint y
,
1377 GLsizei width
, GLsizei height
, GLenum type
)
1379 GET_CURRENT_CONTEXT(ctx
);
1381 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1382 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_PIXELS
, 5 );
1386 n
[3].i
= (GLint
) width
;
1387 n
[4].i
= (GLint
) height
;
1390 if (ctx
->ExecuteFlag
) {
1391 (*ctx
->Exec
->CopyPixels
)( x
, y
, width
, height
, type
);
1398 save_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
1399 GLint x
, GLint y
, GLsizei width
, GLint border
)
1401 GET_CURRENT_CONTEXT(ctx
);
1403 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1404 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7 );
1408 n
[3].e
= internalformat
;
1414 if (ctx
->ExecuteFlag
) {
1415 (*ctx
->Exec
->CopyTexImage1D
)( target
, level
, internalformat
,
1416 x
, y
, width
, border
);
1422 save_CopyTexImage2D( GLenum target
, GLint level
,
1423 GLenum internalformat
,
1424 GLint x
, GLint y
, GLsizei width
,
1425 GLsizei height
, GLint border
)
1427 GET_CURRENT_CONTEXT(ctx
);
1429 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1430 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8 );
1434 n
[3].e
= internalformat
;
1441 if (ctx
->ExecuteFlag
) {
1442 (*ctx
->Exec
->CopyTexImage2D
)( target
, level
, internalformat
,
1443 x
, y
, width
, height
, border
);
1450 save_CopyTexSubImage1D( GLenum target
, GLint level
,
1451 GLint xoffset
, GLint x
, GLint y
,
1454 GET_CURRENT_CONTEXT(ctx
);
1456 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1457 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6 );
1466 if (ctx
->ExecuteFlag
) {
1467 (*ctx
->Exec
->CopyTexSubImage1D
)( target
, level
, xoffset
, x
, y
, width
);
1473 save_CopyTexSubImage2D( GLenum target
, GLint level
,
1474 GLint xoffset
, GLint yoffset
,
1476 GLsizei width
, GLint height
)
1478 GET_CURRENT_CONTEXT(ctx
);
1480 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1481 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8 );
1492 if (ctx
->ExecuteFlag
) {
1493 (*ctx
->Exec
->CopyTexSubImage2D
)( target
, level
, xoffset
, yoffset
,
1494 x
, y
, width
, height
);
1500 save_CopyTexSubImage3D( GLenum target
, GLint level
,
1501 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1503 GLsizei width
, GLint height
)
1505 GET_CURRENT_CONTEXT(ctx
);
1507 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1508 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9 );
1520 if (ctx
->ExecuteFlag
) {
1521 (*ctx
->Exec
->CopyTexSubImage3D
)( target
, level
,
1522 xoffset
, yoffset
, zoffset
,
1523 x
, y
, width
, height
);
1528 static void save_CullFace( GLenum mode
)
1530 GET_CURRENT_CONTEXT(ctx
);
1532 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1533 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CULL_FACE
, 1 );
1537 if (ctx
->ExecuteFlag
) {
1538 (*ctx
->Exec
->CullFace
)( mode
);
1543 static void save_DepthFunc( GLenum func
)
1545 GET_CURRENT_CONTEXT(ctx
);
1547 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1548 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_FUNC
, 1 );
1552 if (ctx
->ExecuteFlag
) {
1553 (*ctx
->Exec
->DepthFunc
)( func
);
1558 static void save_DepthMask( GLboolean mask
)
1560 GET_CURRENT_CONTEXT(ctx
);
1562 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1563 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_MASK
, 1 );
1567 if (ctx
->ExecuteFlag
) {
1568 (*ctx
->Exec
->DepthMask
)( mask
);
1573 static void save_DepthRange( GLclampd nearval
, GLclampd farval
)
1575 GET_CURRENT_CONTEXT(ctx
);
1577 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1578 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_RANGE
, 2 );
1580 n
[1].f
= (GLfloat
) nearval
;
1581 n
[2].f
= (GLfloat
) farval
;
1583 if (ctx
->ExecuteFlag
) {
1584 (*ctx
->Exec
->DepthRange
)( nearval
, farval
);
1589 static void save_Disable( GLenum cap
)
1591 GET_CURRENT_CONTEXT(ctx
);
1593 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1594 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DISABLE
, 1 );
1598 if (ctx
->ExecuteFlag
) {
1599 (*ctx
->Exec
->Disable
)( cap
);
1604 static void save_DrawBuffer( GLenum mode
)
1606 GET_CURRENT_CONTEXT(ctx
);
1608 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1609 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_BUFFER
, 1 );
1613 if (ctx
->ExecuteFlag
) {
1614 (*ctx
->Exec
->DrawBuffer
)( mode
);
1619 static void save_DrawPixels( GLsizei width
, GLsizei height
,
1620 GLenum format
, GLenum type
,
1621 const GLvoid
*pixels
)
1623 GET_CURRENT_CONTEXT(ctx
);
1624 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
1625 pixels
, &ctx
->Unpack
);
1627 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1628 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_PIXELS
, 5 );
1639 if (ctx
->ExecuteFlag
) {
1640 (*ctx
->Exec
->DrawPixels
)( width
, height
, format
, type
, pixels
);
1646 static void save_Enable( GLenum cap
)
1648 GET_CURRENT_CONTEXT(ctx
);
1650 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1651 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ENABLE
, 1 );
1655 if (ctx
->ExecuteFlag
) {
1656 (*ctx
->Exec
->Enable
)( cap
);
1662 void _mesa_save_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
1664 GET_CURRENT_CONTEXT(ctx
);
1666 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1667 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH1
, 3 );
1673 if (ctx
->ExecuteFlag
) {
1674 (*ctx
->Exec
->EvalMesh1
)( mode
, i1
, i2
);
1679 void _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1681 GET_CURRENT_CONTEXT(ctx
);
1683 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1684 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH2
, 5 );
1692 if (ctx
->ExecuteFlag
) {
1693 (*ctx
->Exec
->EvalMesh2
)( mode
, i1
, i2
, j1
, j2
);
1700 static void save_Fogfv( GLenum pname
, const GLfloat
*params
)
1702 GET_CURRENT_CONTEXT(ctx
);
1704 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1705 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FOG
, 5 );
1713 if (ctx
->ExecuteFlag
) {
1714 (*ctx
->Exec
->Fogfv
)( pname
, params
);
1719 static void save_Fogf( GLenum pname
, GLfloat param
)
1721 save_Fogfv(pname
, ¶m
);
1725 static void save_Fogiv(GLenum pname
, const GLint
*params
)
1730 case GL_FOG_DENSITY
:
1734 p
[0] = (GLfloat
) *params
;
1737 p
[0] = INT_TO_FLOAT( params
[0] );
1738 p
[1] = INT_TO_FLOAT( params
[1] );
1739 p
[2] = INT_TO_FLOAT( params
[2] );
1740 p
[3] = INT_TO_FLOAT( params
[3] );
1743 /* Error will be caught later in gl_Fogfv */
1746 save_Fogfv(pname
, p
);
1750 static void save_Fogi(GLenum pname
, GLint param
)
1752 save_Fogiv(pname
, ¶m
);
1756 static void save_FrontFace( GLenum mode
)
1758 GET_CURRENT_CONTEXT(ctx
);
1760 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1761 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRONT_FACE
, 1 );
1765 if (ctx
->ExecuteFlag
) {
1766 (*ctx
->Exec
->FrontFace
)( mode
);
1771 static void save_Frustum( GLdouble left
, GLdouble right
,
1772 GLdouble bottom
, GLdouble top
,
1773 GLdouble nearval
, GLdouble farval
)
1775 GET_CURRENT_CONTEXT(ctx
);
1777 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1778 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRUSTUM
, 6 );
1787 if (ctx
->ExecuteFlag
) {
1788 (*ctx
->Exec
->Frustum
)( left
, right
, bottom
, top
, nearval
, farval
);
1793 static void save_Hint( GLenum target
, GLenum mode
)
1795 GET_CURRENT_CONTEXT(ctx
);
1797 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1798 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HINT
, 2 );
1803 if (ctx
->ExecuteFlag
) {
1804 (*ctx
->Exec
->Hint
)( target
, mode
);
1809 /* GL_PGI_misc_hints*/
1810 static void save_HintPGI( GLenum target
, GLint mode
)
1812 GET_CURRENT_CONTEXT(ctx
);
1814 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1815 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HINT_PGI
, 2 );
1820 if (ctx
->ExecuteFlag
) {
1821 (*ctx
->Exec
->HintPGI
)( target
, mode
);
1827 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
, GLboolean sink
)
1829 GET_CURRENT_CONTEXT(ctx
);
1832 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1833 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HISTOGRAM
, 4 );
1837 n
[3].e
= internalFormat
;
1840 if (ctx
->ExecuteFlag
) {
1841 (*ctx
->Exec
->Histogram
)( target
, width
, internalFormat
, sink
);
1846 static void save_IndexMask( GLuint mask
)
1848 GET_CURRENT_CONTEXT(ctx
);
1850 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1851 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_INDEX_MASK
, 1 );
1855 if (ctx
->ExecuteFlag
) {
1856 (*ctx
->Exec
->IndexMask
)( mask
);
1861 static void save_InitNames( void )
1863 GET_CURRENT_CONTEXT(ctx
);
1864 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1865 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_INIT_NAMES
, 0 );
1866 if (ctx
->ExecuteFlag
) {
1867 (*ctx
->Exec
->InitNames
)();
1872 static void save_Lightfv( GLenum light
, GLenum pname
, const GLfloat
*params
)
1874 GET_CURRENT_CONTEXT(ctx
);
1876 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1877 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT
, 6 );
1895 case GL_SPOT_DIRECTION
:
1898 case GL_SPOT_EXPONENT
:
1901 case GL_SPOT_CUTOFF
:
1904 case GL_CONSTANT_ATTENUATION
:
1907 case GL_LINEAR_ATTENUATION
:
1910 case GL_QUADRATIC_ATTENUATION
:
1916 for (i
= 0; i
< nParams
; i
++) {
1917 n
[3+i
].f
= params
[i
];
1920 if (ctx
->ExecuteFlag
) {
1921 (*ctx
->Exec
->Lightfv
)( light
, pname
, params
);
1926 static void save_Lightf( GLenum light
, GLenum pname
, GLfloat params
)
1928 save_Lightfv(light
, pname
, ¶ms
);
1932 static void save_Lightiv( GLenum light
, GLenum pname
, const GLint
*params
)
1939 fparam
[0] = INT_TO_FLOAT( params
[0] );
1940 fparam
[1] = INT_TO_FLOAT( params
[1] );
1941 fparam
[2] = INT_TO_FLOAT( params
[2] );
1942 fparam
[3] = INT_TO_FLOAT( params
[3] );
1945 fparam
[0] = (GLfloat
) params
[0];
1946 fparam
[1] = (GLfloat
) params
[1];
1947 fparam
[2] = (GLfloat
) params
[2];
1948 fparam
[3] = (GLfloat
) params
[3];
1950 case GL_SPOT_DIRECTION
:
1951 fparam
[0] = (GLfloat
) params
[0];
1952 fparam
[1] = (GLfloat
) params
[1];
1953 fparam
[2] = (GLfloat
) params
[2];
1955 case GL_SPOT_EXPONENT
:
1956 case GL_SPOT_CUTOFF
:
1957 case GL_CONSTANT_ATTENUATION
:
1958 case GL_LINEAR_ATTENUATION
:
1959 case GL_QUADRATIC_ATTENUATION
:
1960 fparam
[0] = (GLfloat
) params
[0];
1963 /* error will be caught later in gl_Lightfv */
1966 save_Lightfv( light
, pname
, fparam
);
1970 static void save_Lighti( GLenum light
, GLenum pname
, GLint param
)
1972 save_Lightiv( light
, pname
, ¶m
);
1976 static void save_LightModelfv( GLenum pname
, const GLfloat
*params
)
1978 GET_CURRENT_CONTEXT(ctx
);
1980 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
1981 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT_MODEL
, 5 );
1989 if (ctx
->ExecuteFlag
) {
1990 (*ctx
->Exec
->LightModelfv
)( pname
, params
);
1995 static void save_LightModelf( GLenum pname
, GLfloat param
)
1997 save_LightModelfv(pname
, ¶m
);
2001 static void save_LightModeliv( GLenum pname
, const GLint
*params
)
2005 case GL_LIGHT_MODEL_AMBIENT
:
2006 fparam
[0] = INT_TO_FLOAT( params
[0] );
2007 fparam
[1] = INT_TO_FLOAT( params
[1] );
2008 fparam
[2] = INT_TO_FLOAT( params
[2] );
2009 fparam
[3] = INT_TO_FLOAT( params
[3] );
2011 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2012 case GL_LIGHT_MODEL_TWO_SIDE
:
2013 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2014 fparam
[0] = (GLfloat
) params
[0];
2017 /* Error will be caught later in gl_LightModelfv */
2020 save_LightModelfv(pname
, fparam
);
2024 static void save_LightModeli( GLenum pname
, GLint param
)
2026 save_LightModeliv(pname
, ¶m
);
2030 static void save_LineStipple( GLint factor
, GLushort pattern
)
2032 GET_CURRENT_CONTEXT(ctx
);
2034 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2035 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_STIPPLE
, 2 );
2040 if (ctx
->ExecuteFlag
) {
2041 (*ctx
->Exec
->LineStipple
)( factor
, pattern
);
2046 static void save_LineWidth( GLfloat width
)
2048 GET_CURRENT_CONTEXT(ctx
);
2050 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2051 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_WIDTH
, 1 );
2055 if (ctx
->ExecuteFlag
) {
2056 (*ctx
->Exec
->LineWidth
)( width
);
2061 static void save_ListBase( GLuint base
)
2063 GET_CURRENT_CONTEXT(ctx
);
2065 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2066 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIST_BASE
, 1 );
2070 if (ctx
->ExecuteFlag
) {
2071 (*ctx
->Exec
->ListBase
)( base
);
2076 static void save_LoadIdentity( void )
2078 GET_CURRENT_CONTEXT(ctx
);
2079 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2080 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_IDENTITY
, 0 );
2081 if (ctx
->ExecuteFlag
) {
2082 (*ctx
->Exec
->LoadIdentity
)();
2087 static void save_LoadMatrixf( const GLfloat
*m
)
2089 GET_CURRENT_CONTEXT(ctx
);
2091 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2092 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_MATRIX
, 16 );
2095 for (i
=0;i
<16;i
++) {
2099 if (ctx
->ExecuteFlag
) {
2100 (*ctx
->Exec
->LoadMatrixf
)( m
);
2105 static void save_LoadMatrixd( const GLdouble
*m
)
2109 for (i
= 0; i
< 16; i
++) {
2112 save_LoadMatrixf(f
);
2116 static void save_LoadName( GLuint name
)
2118 GET_CURRENT_CONTEXT(ctx
);
2120 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2121 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_NAME
, 1 );
2125 if (ctx
->ExecuteFlag
) {
2126 (*ctx
->Exec
->LoadName
)( name
);
2131 static void save_LogicOp( GLenum opcode
)
2133 GET_CURRENT_CONTEXT(ctx
);
2135 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2136 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOGIC_OP
, 1 );
2140 if (ctx
->ExecuteFlag
) {
2141 (*ctx
->Exec
->LogicOp
)( opcode
);
2146 static void save_Map1d( GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2147 GLint order
, const GLdouble
*points
)
2149 GET_CURRENT_CONTEXT(ctx
);
2151 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2152 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2154 GLfloat
*pnts
= gl_copy_map_points1d( target
, stride
, order
, points
);
2158 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2160 n
[6].data
= (void *) pnts
;
2162 if (ctx
->ExecuteFlag
) {
2163 (*ctx
->Exec
->Map1d
)( target
, u1
, u2
, stride
, order
, points
);
2167 static void save_Map1f( GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2168 GLint order
, const GLfloat
*points
)
2170 GET_CURRENT_CONTEXT(ctx
);
2172 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2173 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2175 GLfloat
*pnts
= gl_copy_map_points1f( target
, stride
, order
, points
);
2179 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2181 n
[6].data
= (void *) pnts
;
2183 if (ctx
->ExecuteFlag
) {
2184 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, stride
, order
, points
);
2189 static void save_Map2d( GLenum target
,
2190 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2191 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2192 const GLdouble
*points
)
2194 GET_CURRENT_CONTEXT(ctx
);
2196 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2197 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2199 GLfloat
*pnts
= gl_copy_map_points2d( target
, ustride
, uorder
,
2200 vstride
, vorder
, points
);
2206 /* XXX verify these strides are correct */
2207 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2208 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2211 n
[10].data
= (void *) pnts
;
2213 if (ctx
->ExecuteFlag
) {
2214 (*ctx
->Exec
->Map2d
)( target
,
2215 u1
, u2
, ustride
, uorder
,
2216 v1
, v2
, vstride
, vorder
, points
);
2221 static void save_Map2f( GLenum target
,
2222 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2223 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2224 const GLfloat
*points
)
2226 GET_CURRENT_CONTEXT(ctx
);
2228 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2229 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2231 GLfloat
*pnts
= gl_copy_map_points2f( target
, ustride
, uorder
,
2232 vstride
, vorder
, points
);
2238 /* XXX verify these strides are correct */
2239 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2240 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2243 n
[10].data
= (void *) pnts
;
2245 if (ctx
->ExecuteFlag
) {
2246 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
2247 v1
, v2
, vstride
, vorder
, points
);
2252 static void save_MapGrid1f( GLint un
, GLfloat u1
, GLfloat u2
)
2254 GET_CURRENT_CONTEXT(ctx
);
2256 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2257 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID1
, 3 );
2263 if (ctx
->ExecuteFlag
) {
2264 (*ctx
->Exec
->MapGrid1f
)( un
, u1
, u2
);
2269 static void save_MapGrid1d( GLint un
, GLdouble u1
, GLdouble u2
)
2271 save_MapGrid1f(un
, u1
, u2
);
2275 static void save_MapGrid2f( GLint un
, GLfloat u1
, GLfloat u2
,
2276 GLint vn
, GLfloat v1
, GLfloat v2
)
2278 GET_CURRENT_CONTEXT(ctx
);
2280 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2281 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID2
, 6 );
2290 if (ctx
->ExecuteFlag
) {
2291 (*ctx
->Exec
->MapGrid2f
)( un
, u1
, u2
, vn
, v1
, v2
);
2297 static void save_MapGrid2d( GLint un
, GLdouble u1
, GLdouble u2
,
2298 GLint vn
, GLdouble v1
, GLdouble v2
)
2300 save_MapGrid2f(un
, u1
, u2
, vn
, v1
, v2
);
2304 static void save_MatrixMode( GLenum mode
)
2306 GET_CURRENT_CONTEXT(ctx
);
2308 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2309 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MATRIX_MODE
, 1 );
2313 if (ctx
->ExecuteFlag
) {
2314 (*ctx
->Exec
->MatrixMode
)( mode
);
2320 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2322 GET_CURRENT_CONTEXT(ctx
);
2325 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2326 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MIN_MAX
, 3 );
2329 n
[2].e
= internalFormat
;
2332 if (ctx
->ExecuteFlag
) {
2333 (*ctx
->Exec
->Minmax
)( target
, internalFormat
, sink
);
2338 static void save_MultMatrixf( const GLfloat
*m
)
2340 GET_CURRENT_CONTEXT(ctx
);
2342 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2343 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MULT_MATRIX
, 16 );
2346 for (i
=0;i
<16;i
++) {
2350 if (ctx
->ExecuteFlag
) {
2351 (*ctx
->Exec
->MultMatrixf
)( m
);
2356 static void save_MultMatrixd( const GLdouble
*m
)
2360 for (i
= 0; i
< 16; i
++) {
2363 save_MultMatrixf(f
);
2367 static void save_NewList( GLuint list
, GLenum mode
)
2369 GET_CURRENT_CONTEXT(ctx
);
2370 /* It's an error to call this function while building a display list */
2371 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
2378 static void save_Ortho( GLdouble left
, GLdouble right
,
2379 GLdouble bottom
, GLdouble top
,
2380 GLdouble nearval
, GLdouble farval
)
2382 GET_CURRENT_CONTEXT(ctx
);
2384 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2385 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ORTHO
, 6 );
2394 if (ctx
->ExecuteFlag
) {
2395 (*ctx
->Exec
->Ortho
)( left
, right
, bottom
, top
, nearval
, farval
);
2400 static void save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
2402 GET_CURRENT_CONTEXT(ctx
);
2404 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2405 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_MAP
, 3 );
2409 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
2410 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
2412 if (ctx
->ExecuteFlag
) {
2413 (*ctx
->Exec
->PixelMapfv
)( map
, mapsize
, values
);
2418 static void save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2420 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2422 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2423 for (i
=0;i
<mapsize
;i
++) {
2424 fvalues
[i
] = (GLfloat
) values
[i
];
2428 for (i
=0;i
<mapsize
;i
++) {
2429 fvalues
[i
] = UINT_TO_FLOAT( values
[i
] );
2432 save_PixelMapfv(map
, mapsize
, fvalues
);
2436 static void save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2438 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2440 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2441 for (i
=0;i
<mapsize
;i
++) {
2442 fvalues
[i
] = (GLfloat
) values
[i
];
2446 for (i
=0;i
<mapsize
;i
++) {
2447 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2450 save_PixelMapfv(map
, mapsize
, fvalues
);
2454 static void save_PixelTransferf( GLenum pname
, GLfloat param
)
2456 GET_CURRENT_CONTEXT(ctx
);
2458 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2459 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2464 if (ctx
->ExecuteFlag
) {
2465 (*ctx
->Exec
->PixelTransferf
)( pname
, param
);
2470 static void save_PixelTransferi( GLenum pname
, GLint param
)
2472 save_PixelTransferf( pname
, (GLfloat
) param
);
2476 static void save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2478 GET_CURRENT_CONTEXT(ctx
);
2480 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2481 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2486 if (ctx
->ExecuteFlag
) {
2487 (*ctx
->Exec
->PixelZoom
)( xfactor
, yfactor
);
2492 static void save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2494 GET_CURRENT_CONTEXT(ctx
);
2496 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2497 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2504 if (ctx
->ExecuteFlag
) {
2505 (*ctx
->Exec
->PointParameterfvEXT
)( pname
, params
);
2510 static void save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2512 save_PointParameterfvEXT(pname
, ¶m
);
2516 static void save_PointSize( GLfloat size
)
2518 GET_CURRENT_CONTEXT(ctx
);
2520 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2521 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_SIZE
, 1 );
2525 if (ctx
->ExecuteFlag
) {
2526 (*ctx
->Exec
->PointSize
)( size
);
2531 static void save_PolygonMode( GLenum face
, GLenum mode
)
2533 GET_CURRENT_CONTEXT(ctx
);
2535 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2536 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_MODE
, 2 );
2541 if (ctx
->ExecuteFlag
) {
2542 (*ctx
->Exec
->PolygonMode
)( face
, mode
);
2548 * Polygon stipple must have been upacked already!
2550 static void save_PolygonStipple( const GLubyte
*pattern
)
2552 GET_CURRENT_CONTEXT(ctx
);
2554 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2555 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2558 n
[1].data
= MALLOC( 32 * 4 );
2559 data
= n
[1].data
; /* This needed for Acorn compiler */
2560 MEMCPY( data
, pattern
, 32 * 4 );
2562 if (ctx
->ExecuteFlag
) {
2563 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) pattern
);
2568 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2570 GET_CURRENT_CONTEXT(ctx
);
2572 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2573 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2578 if (ctx
->ExecuteFlag
) {
2579 (*ctx
->Exec
->PolygonOffset
)( factor
, units
);
2584 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2586 GET_CURRENT_CONTEXT(ctx
);
2587 save_PolygonOffset(factor
, ctx
->Visual
.DepthMaxF
* bias
);
2591 static void save_PopAttrib( void )
2593 GET_CURRENT_CONTEXT(ctx
);
2594 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2595 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_ATTRIB
, 0 );
2596 if (ctx
->ExecuteFlag
) {
2597 (*ctx
->Exec
->PopAttrib
)();
2602 static void save_PopMatrix( void )
2604 GET_CURRENT_CONTEXT(ctx
);
2605 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2606 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_MATRIX
, 0 );
2607 if (ctx
->ExecuteFlag
) {
2608 (*ctx
->Exec
->PopMatrix
)();
2613 static void save_PopName( void )
2615 GET_CURRENT_CONTEXT(ctx
);
2616 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2617 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_NAME
, 0 );
2618 if (ctx
->ExecuteFlag
) {
2619 (*ctx
->Exec
->PopName
)();
2624 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2625 const GLclampf
*priorities
)
2627 GET_CURRENT_CONTEXT(ctx
);
2629 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2631 for (i
=0;i
<num
;i
++) {
2633 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2635 n
[1].ui
= textures
[i
];
2636 n
[2].f
= priorities
[i
];
2639 if (ctx
->ExecuteFlag
) {
2640 (*ctx
->Exec
->PrioritizeTextures
)( num
, textures
, priorities
);
2645 static void save_PushAttrib( GLbitfield mask
)
2647 GET_CURRENT_CONTEXT(ctx
);
2649 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2650 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2654 if (ctx
->ExecuteFlag
) {
2655 (*ctx
->Exec
->PushAttrib
)( mask
);
2660 static void save_PushMatrix( void )
2662 GET_CURRENT_CONTEXT(ctx
);
2663 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2664 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2665 if (ctx
->ExecuteFlag
) {
2666 (*ctx
->Exec
->PushMatrix
)();
2671 static void save_PushName( GLuint name
)
2673 GET_CURRENT_CONTEXT(ctx
);
2675 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2676 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_NAME
, 1 );
2680 if (ctx
->ExecuteFlag
) {
2681 (*ctx
->Exec
->PushName
)( name
);
2686 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2688 GET_CURRENT_CONTEXT(ctx
);
2690 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2691 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RASTER_POS
, 4 );
2698 if (ctx
->ExecuteFlag
) {
2699 (*ctx
->Exec
->RasterPos4f
)( x
, y
, z
, w
);
2703 static void save_RasterPos2d(GLdouble x
, GLdouble y
)
2705 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2708 static void save_RasterPos2f(GLfloat x
, GLfloat y
)
2710 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2713 static void save_RasterPos2i(GLint x
, GLint y
)
2715 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2718 static void save_RasterPos2s(GLshort x
, GLshort y
)
2720 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2723 static void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2725 save_RasterPos4f(x
, y
, z
, 1.0F
);
2728 static void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2730 save_RasterPos4f(x
, y
, z
, 1.0F
);
2733 static void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2735 save_RasterPos4f(x
, y
, z
, 1.0F
);
2738 static void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2740 save_RasterPos4f(x
, y
, z
, 1.0F
);
2743 static void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2745 save_RasterPos4f(x
, y
, z
, w
);
2748 static void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2750 save_RasterPos4f(x
, y
, z
, w
);
2753 static void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2755 save_RasterPos4f(x
, y
, z
, w
);
2758 static void save_RasterPos2dv(const GLdouble
*v
)
2760 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2763 static void save_RasterPos2fv(const GLfloat
*v
)
2765 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2768 static void save_RasterPos2iv(const GLint
*v
)
2770 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2773 static void save_RasterPos2sv(const GLshort
*v
)
2775 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2778 static void save_RasterPos3dv(const GLdouble
*v
)
2780 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2783 static void save_RasterPos3fv(const GLfloat
*v
)
2785 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2788 static void save_RasterPos3iv(const GLint
*v
)
2790 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2793 static void save_RasterPos3sv(const GLshort
*v
)
2795 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2798 static void save_RasterPos4dv(const GLdouble
*v
)
2800 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2803 static void save_RasterPos4fv(const GLfloat
*v
)
2805 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2808 static void save_RasterPos4iv(const GLint
*v
)
2810 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2813 static void save_RasterPos4sv(const GLshort
*v
)
2815 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2819 static void save_PassThrough( GLfloat token
)
2821 GET_CURRENT_CONTEXT(ctx
);
2823 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2824 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PASSTHROUGH
, 1 );
2828 if (ctx
->ExecuteFlag
) {
2829 (*ctx
->Exec
->PassThrough
)( token
);
2834 static void save_ReadBuffer( GLenum mode
)
2836 GET_CURRENT_CONTEXT(ctx
);
2838 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2839 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_READ_BUFFER
, 1 );
2843 if (ctx
->ExecuteFlag
) {
2844 (*ctx
->Exec
->ReadBuffer
)( mode
);
2850 save_ResetHistogram(GLenum target
)
2852 GET_CURRENT_CONTEXT(ctx
);
2854 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2855 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_HISTOGRAM
, 1 );
2859 if (ctx
->ExecuteFlag
) {
2860 (*ctx
->Exec
->ResetHistogram
)( target
);
2866 save_ResetMinmax(GLenum target
)
2868 GET_CURRENT_CONTEXT(ctx
);
2870 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2871 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_MIN_MAX
, 1 );
2875 if (ctx
->ExecuteFlag
) {
2876 (*ctx
->Exec
->ResetMinmax
)( target
);
2881 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2883 GET_CURRENT_CONTEXT(ctx
);
2885 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2886 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ROTATE
, 4 );
2893 if (ctx
->ExecuteFlag
) {
2894 (*ctx
->Exec
->Rotatef
)( angle
, x
, y
, z
);
2899 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2901 save_Rotatef(angle
, x
, y
, z
);
2905 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2907 GET_CURRENT_CONTEXT(ctx
);
2909 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2910 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCALE
, 3 );
2916 if (ctx
->ExecuteFlag
) {
2917 (*ctx
->Exec
->Scalef
)( x
, y
, z
);
2922 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
2924 save_Scalef(x
, y
, z
);
2928 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
2930 GET_CURRENT_CONTEXT(ctx
);
2932 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2933 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCISSOR
, 4 );
2940 if (ctx
->ExecuteFlag
) {
2941 (*ctx
->Exec
->Scissor
)( x
, y
, width
, height
);
2946 static void save_ShadeModel( GLenum mode
)
2948 GET_CURRENT_CONTEXT(ctx
);
2950 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2951 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SHADE_MODEL
, 1 );
2955 if (ctx
->ExecuteFlag
) {
2956 (*ctx
->Exec
->ShadeModel
)( mode
);
2961 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
2963 GET_CURRENT_CONTEXT(ctx
);
2965 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2966 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_FUNC
, 3 );
2972 if (ctx
->ExecuteFlag
) {
2973 (*ctx
->Exec
->StencilFunc
)( func
, ref
, mask
);
2978 static void save_StencilMask( GLuint mask
)
2980 GET_CURRENT_CONTEXT(ctx
);
2982 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2983 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_MASK
, 1 );
2987 if (ctx
->ExecuteFlag
) {
2988 (*ctx
->Exec
->StencilMask
)( mask
);
2993 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
2995 GET_CURRENT_CONTEXT(ctx
);
2997 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
2998 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_OP
, 3 );
3004 if (ctx
->ExecuteFlag
) {
3005 (*ctx
->Exec
->StencilOp
)( fail
, zfail
, zpass
);
3010 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
3012 GET_CURRENT_CONTEXT(ctx
);
3014 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3015 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXENV
, 6 );
3024 if (ctx
->ExecuteFlag
) {
3025 (*ctx
->Exec
->TexEnvfv
)( target
, pname
, params
);
3030 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
3032 save_TexEnvfv( target
, pname
, ¶m
);
3036 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
3039 p
[0] = (GLfloat
) param
;
3040 p
[1] = p
[2] = p
[3] = 0.0;
3041 save_TexEnvfv( target
, pname
, p
);
3045 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
3048 p
[0] = INT_TO_FLOAT( param
[0] );
3049 p
[1] = INT_TO_FLOAT( param
[1] );
3050 p
[2] = INT_TO_FLOAT( param
[2] );
3051 p
[3] = INT_TO_FLOAT( param
[3] );
3052 save_TexEnvfv( target
, pname
, p
);
3056 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
3058 GET_CURRENT_CONTEXT(ctx
);
3060 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3061 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXGEN
, 6 );
3070 if (ctx
->ExecuteFlag
) {
3071 (*ctx
->Exec
->TexGenfv
)( coord
, pname
, params
);
3076 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3083 save_TexGenfv(coord
, pname
, p
);
3087 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3089 GLfloat p
= (GLfloat
) param
;
3090 save_TexGenfv( coord
, pname
, &p
);
3094 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3101 save_TexGenfv( coord
, pname
, p
);
3105 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
3107 save_TexGenfv(coord
, pname
, ¶m
);
3111 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
3113 save_TexGeniv( coord
, pname
, ¶m
);
3117 static void save_TexParameterfv( GLenum target
,
3118 GLenum pname
, const GLfloat
*params
)
3120 GET_CURRENT_CONTEXT(ctx
);
3122 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3123 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXPARAMETER
, 6 );
3132 if (ctx
->ExecuteFlag
) {
3133 (*ctx
->Exec
->TexParameterfv
)( target
, pname
, params
);
3138 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
3140 save_TexParameterfv(target
, pname
, ¶m
);
3144 static void save_TexParameteri( GLenum target
, GLenum pname
, const GLint param
)
3147 fparam
[0] = (GLfloat
) param
;
3148 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3149 save_TexParameterfv(target
, pname
, fparam
);
3153 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
3156 fparam
[0] = (GLfloat
) params
[0];
3157 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3158 save_TexParameterfv(target
, pname
, fparam
);
3162 static void save_TexImage1D( GLenum target
,
3163 GLint level
, GLint components
,
3164 GLsizei width
, GLint border
,
3165 GLenum format
, GLenum type
,
3166 const GLvoid
*pixels
)
3168 GET_CURRENT_CONTEXT(ctx
);
3169 if (target
== GL_PROXY_TEXTURE_1D
) {
3170 /* don't compile, execute immediately */
3171 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3172 border
, format
, type
, pixels
);
3175 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3176 pixels
, &ctx
->Unpack
);
3178 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3179 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
3183 n
[3].i
= components
;
3184 n
[4].i
= (GLint
) width
;
3193 if (ctx
->ExecuteFlag
) {
3194 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3195 border
, format
, type
, pixels
);
3201 static void save_TexImage2D( GLenum target
,
3202 GLint level
, GLint components
,
3203 GLsizei width
, GLsizei height
, GLint border
,
3204 GLenum format
, GLenum type
,
3205 const GLvoid
*pixels
)
3207 GET_CURRENT_CONTEXT(ctx
);
3208 if (target
== GL_PROXY_TEXTURE_2D
) {
3209 /* don't compile, execute immediately */
3210 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3211 height
, border
, format
, type
, pixels
);
3214 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3215 pixels
, &ctx
->Unpack
);
3217 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3218 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
3222 n
[3].i
= components
;
3223 n
[4].i
= (GLint
) width
;
3224 n
[5].i
= (GLint
) height
;
3233 if (ctx
->ExecuteFlag
) {
3234 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3235 height
, border
, format
, type
, pixels
);
3241 static void save_TexImage3D( GLenum target
,
3242 GLint level
, GLint internalFormat
,
3243 GLsizei width
, GLsizei height
, GLsizei depth
,
3245 GLenum format
, GLenum type
,
3246 const GLvoid
*pixels
)
3248 GET_CURRENT_CONTEXT(ctx
);
3249 if (target
== GL_PROXY_TEXTURE_3D
) {
3250 /* don't compile, execute immediately */
3251 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3252 height
, depth
, border
, format
, type
, pixels
);
3256 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3257 pixels
, &ctx
->Unpack
);
3258 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3259 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
3263 n
[3].i
= internalFormat
;
3264 n
[4].i
= (GLint
) width
;
3265 n
[5].i
= (GLint
) height
;
3266 n
[6].i
= (GLint
) depth
;
3275 if (ctx
->ExecuteFlag
) {
3276 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3277 height
, depth
, border
, format
, type
, pixels
);
3283 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
3284 GLsizei width
, GLenum format
, GLenum type
,
3285 const GLvoid
*pixels
)
3287 GET_CURRENT_CONTEXT(ctx
);
3289 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3290 pixels
, &ctx
->Unpack
);
3291 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3292 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
3297 n
[4].i
= (GLint
) width
;
3305 if (ctx
->ExecuteFlag
) {
3306 (*ctx
->Exec
->TexSubImage1D
)( target
, level
, xoffset
, width
,
3307 format
, type
, pixels
);
3312 static void save_TexSubImage2D( GLenum target
, GLint level
,
3313 GLint xoffset
, GLint yoffset
,
3314 GLsizei width
, GLsizei height
,
3315 GLenum format
, GLenum type
,
3316 const GLvoid
*pixels
)
3318 GET_CURRENT_CONTEXT(ctx
);
3320 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3321 pixels
, &ctx
->Unpack
);
3322 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3323 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
3329 n
[5].i
= (GLint
) width
;
3330 n
[6].i
= (GLint
) height
;
3338 if (ctx
->ExecuteFlag
) {
3339 (*ctx
->Exec
->TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
3340 width
, height
, format
, type
, pixels
);
3345 static void save_TexSubImage3D( GLenum target
, GLint level
,
3346 GLint xoffset
, GLint yoffset
,GLint zoffset
,
3347 GLsizei width
, GLsizei height
, GLsizei depth
,
3348 GLenum format
, GLenum type
,
3349 const GLvoid
*pixels
)
3351 GET_CURRENT_CONTEXT(ctx
);
3353 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3354 pixels
, &ctx
->Unpack
);
3355 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3356 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
3363 n
[6].i
= (GLint
) width
;
3364 n
[7].i
= (GLint
) height
;
3365 n
[8].i
= (GLint
) depth
;
3373 if (ctx
->ExecuteFlag
) {
3374 (*ctx
->Exec
->TexSubImage3D
)( target
, level
,
3375 xoffset
, yoffset
, zoffset
,
3376 width
, height
, depth
, format
, type
, pixels
);
3381 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
3383 GET_CURRENT_CONTEXT(ctx
);
3385 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3386 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRANSLATE
, 3 );
3392 if (ctx
->ExecuteFlag
) {
3393 (*ctx
->Exec
->Translatef
)( x
, y
, z
);
3398 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3400 save_Translatef(x
, y
, z
);
3405 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3407 GET_CURRENT_CONTEXT(ctx
);
3409 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3410 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_VIEWPORT
, 4 );
3414 n
[3].i
= (GLint
) width
;
3415 n
[4].i
= (GLint
) height
;
3417 if (ctx
->ExecuteFlag
) {
3418 (*ctx
->Exec
->Viewport
)( x
, y
, width
, height
);
3423 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3425 GET_CURRENT_CONTEXT(ctx
);
3427 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3428 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_WINDOW_POS
, 4 );
3435 if (ctx
->ExecuteFlag
) {
3436 (*ctx
->Exec
->WindowPos4fMESA
)( x
, y
, z
, w
);
3440 static void save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3442 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3445 static void save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3447 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3450 static void save_WindowPos2iMESA(GLint x
, GLint y
)
3452 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3455 static void save_WindowPos2sMESA(GLshort x
, GLshort y
)
3457 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3460 static void save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3462 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3465 static void save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3467 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3470 static void save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3472 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3475 static void save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3477 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3480 static void save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3482 save_WindowPos4fMESA(x
, y
, z
, w
);
3485 static void save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3487 save_WindowPos4fMESA(x
, y
, z
, w
);
3490 static void save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3492 save_WindowPos4fMESA(x
, y
, z
, w
);
3495 static void save_WindowPos2dvMESA(const GLdouble
*v
)
3497 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3500 static void save_WindowPos2fvMESA(const GLfloat
*v
)
3502 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3505 static void save_WindowPos2ivMESA(const GLint
*v
)
3507 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3510 static void save_WindowPos2svMESA(const GLshort
*v
)
3512 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3515 static void save_WindowPos3dvMESA(const GLdouble
*v
)
3517 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3520 static void save_WindowPos3fvMESA(const GLfloat
*v
)
3522 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3525 static void save_WindowPos3ivMESA(const GLint
*v
)
3527 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3530 static void save_WindowPos3svMESA(const GLshort
*v
)
3532 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3535 static void save_WindowPos4dvMESA(const GLdouble
*v
)
3537 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3540 static void save_WindowPos4fvMESA(const GLfloat
*v
)
3542 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3545 static void save_WindowPos4ivMESA(const GLint
*v
)
3547 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3550 static void save_WindowPos4svMESA(const GLshort
*v
)
3552 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3557 /* GL_ARB_multitexture */
3558 static void save_ActiveTextureARB( GLenum target
)
3560 GET_CURRENT_CONTEXT(ctx
);
3562 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3563 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3567 if (ctx
->ExecuteFlag
) {
3568 (*ctx
->Exec
->ActiveTextureARB
)( target
);
3573 /* GL_ARB_multitexture */
3574 static void save_ClientActiveTextureARB( GLenum target
)
3576 GET_CURRENT_CONTEXT(ctx
);
3578 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3579 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLIENT_ACTIVE_TEXTURE
, 1 );
3583 if (ctx
->ExecuteFlag
) {
3584 (*ctx
->Exec
->ClientActiveTextureARB
)( target
);
3590 /* GL_ARB_transpose_matrix */
3592 static void save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3595 _math_transposefd(tm
, m
);
3596 save_LoadMatrixf(tm
);
3600 static void save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3603 _math_transposef(tm
, m
);
3604 save_LoadMatrixf(tm
);
3608 static void save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3611 _math_transposefd(tm
, m
);
3612 save_MultMatrixf(tm
);
3616 static void save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3619 _math_transposef(tm
, m
);
3620 save_MultMatrixf(tm
);
3624 static void save_PixelTexGenSGIX(GLenum mode
)
3626 GET_CURRENT_CONTEXT(ctx
);
3628 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3629 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_SGIX
, 1 );
3633 if (ctx
->ExecuteFlag
) {
3634 (*ctx
->Exec
->PixelTexGenSGIX
)( mode
);
3639 /* GL_ARB_texture_compression */
3641 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3642 GLenum internalFormat
, GLsizei width
,
3643 GLint border
, GLsizei imageSize
,
3646 GET_CURRENT_CONTEXT(ctx
);
3647 if (target
== GL_PROXY_TEXTURE_1D
) {
3648 /* don't compile, execute immediately */
3649 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3650 width
, border
, imageSize
, data
);
3655 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3656 /* make copy of image */
3657 image
= MALLOC(imageSize
);
3659 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3662 MEMCPY(image
, data
, imageSize
);
3663 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 8 );
3667 n
[3].e
= internalFormat
;
3668 n
[4].i
= (GLint
) width
;
3676 if (ctx
->ExecuteFlag
) {
3677 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3678 width
, border
, imageSize
, data
);
3685 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
3686 GLenum internalFormat
, GLsizei width
,
3687 GLsizei height
, GLint border
, GLsizei imageSize
,
3690 GET_CURRENT_CONTEXT(ctx
);
3691 if (target
== GL_PROXY_TEXTURE_2D
) {
3692 /* don't compile, execute immediately */
3693 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3694 width
, height
, border
, imageSize
, data
);
3699 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3700 /* make copy of image */
3701 image
= MALLOC(imageSize
);
3703 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
3706 MEMCPY(image
, data
, imageSize
);
3707 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 9 );
3711 n
[3].e
= internalFormat
;
3712 n
[4].i
= (GLint
) width
;
3713 n
[5].i
= (GLint
) height
;
3721 if (ctx
->ExecuteFlag
) {
3722 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3723 width
, height
, border
, imageSize
, data
);
3730 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
3731 GLenum internalFormat
, GLsizei width
,
3732 GLsizei height
, GLsizei depth
, GLint border
,
3733 GLsizei imageSize
, const GLvoid
*data
)
3735 GET_CURRENT_CONTEXT(ctx
);
3736 if (target
== GL_PROXY_TEXTURE_3D
) {
3737 /* don't compile, execute immediately */
3738 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3739 width
, height
, depth
, border
, imageSize
, data
);
3744 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3745 /* make copy of image */
3746 image
= MALLOC(imageSize
);
3748 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
3751 MEMCPY(image
, data
, imageSize
);
3752 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 10 );
3756 n
[3].e
= internalFormat
;
3757 n
[4].i
= (GLint
) width
;
3758 n
[5].i
= (GLint
) height
;
3759 n
[6].i
= (GLint
) depth
;
3767 if (ctx
->ExecuteFlag
) {
3768 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3769 width
, height
, depth
, border
, imageSize
, data
);
3776 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
3777 GLsizei width
, GLenum format
,
3778 GLsizei imageSize
, const GLvoid
*data
)
3783 GET_CURRENT_CONTEXT(ctx
);
3784 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3786 /* make copy of image */
3787 image
= MALLOC(imageSize
);
3789 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
3792 MEMCPY(image
, data
, imageSize
);
3793 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 8 );
3798 n
[4].i
= (GLint
) width
;
3806 if (ctx
->ExecuteFlag
) {
3807 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(target
, level
, xoffset
,
3808 width
, format
, imageSize
, data
);
3814 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
3815 GLint yoffset
, GLsizei width
, GLsizei height
,
3816 GLenum format
, GLsizei imageSize
,
3822 GET_CURRENT_CONTEXT(ctx
);
3823 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3825 /* make copy of image */
3826 image
= MALLOC(imageSize
);
3828 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
3831 MEMCPY(image
, data
, imageSize
);
3832 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 10 );
3838 n
[5].i
= (GLint
) width
;
3839 n
[6].i
= (GLint
) height
;
3847 if (ctx
->ExecuteFlag
) {
3848 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(target
, level
, xoffset
, yoffset
,
3849 width
, height
, format
, imageSize
, data
);
3855 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
3856 GLint yoffset
, GLint zoffset
, GLsizei width
,
3857 GLsizei height
, GLsizei depth
, GLenum format
,
3858 GLsizei imageSize
, const GLvoid
*data
)
3863 GET_CURRENT_CONTEXT(ctx
);
3864 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3866 /* make copy of image */
3867 image
= MALLOC(imageSize
);
3869 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
3872 MEMCPY(image
, data
, imageSize
);
3873 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 12 );
3880 n
[6].i
= (GLint
) width
;
3881 n
[7].i
= (GLint
) height
;
3882 n
[8].i
= (GLint
) depth
;
3884 n
[10].i
= imageSize
;
3890 if (ctx
->ExecuteFlag
) {
3891 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(target
, level
, xoffset
, yoffset
,
3892 zoffset
, width
, height
, depth
, format
, imageSize
, data
);
3897 /* GL_SGIS_pixel_texture */
3899 static void save_PixelTexGenParameteriSGIS(GLenum target
, GLint value
)
3901 GET_CURRENT_CONTEXT(ctx
);
3903 FLUSH_TNL( ctx
, FLUSH_STORED_VERTICES
);
3904 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
, 2 );
3909 if (ctx
->ExecuteFlag
) {
3910 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( target
, value
);
3915 static void save_PixelTexGenParameterfSGIS(GLenum target
, GLfloat value
)
3917 save_PixelTexGenParameteriSGIS(target
, (GLint
) value
);
3921 static void save_PixelTexGenParameterivSGIS(GLenum target
, const GLint
*value
)
3923 save_PixelTexGenParameteriSGIS(target
, *value
);
3927 static void save_PixelTexGenParameterfvSGIS(GLenum target
, const GLfloat
*value
)
3929 save_PixelTexGenParameteriSGIS(target
, (GLint
) *value
);
3933 /* KW: Compile commands
3935 * Will appear in the list before the vertex buffer containing the
3936 * command that provoked the error. I don't see this as a problem.
3938 void gl_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
3941 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ERROR
, 2 );
3944 n
[2].data
= (void *) s
;
3946 /* execute already done */
3951 islist(GLcontext
*ctx
, GLuint list
)
3953 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
3963 /**********************************************************************/
3964 /* Display list execution */
3965 /**********************************************************************/
3969 * Execute a display list. Note that the ListBase offset must have already
3970 * been added before calling this function. I.e. the list argument is
3971 * the absolute list number, not relative to ListBase.
3972 * Input: list - display list number
3974 static void execute_list( GLcontext
*ctx
, GLuint list
)
3979 if (!islist(ctx
,list
))
3982 /* mesa_print_display_list( list ); */
3986 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
3990 OpCode opcode
= n
[0].opcode
;
3991 int i
= (int)n
[0].opcode
- (int)OPCODE_DRV_0
;
3993 if (i
>= 0 && i
< ctx
->listext
.nr_opcodes
) {
3994 ctx
->listext
.opcode
[i
].execute(ctx
, &n
[1]);
3995 n
+= ctx
->listext
.opcode
[i
].size
;
4000 gl_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
4003 (*ctx
->Exec
->Accum
)( n
[1].e
, n
[2].f
);
4005 case OPCODE_ALPHA_FUNC
:
4006 (*ctx
->Exec
->AlphaFunc
)( n
[1].e
, n
[2].f
);
4008 case OPCODE_BIND_TEXTURE
:
4009 (*ctx
->Exec
->BindTexture
)( n
[1].e
, n
[2].ui
);
4013 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4014 ctx
->Unpack
= _mesa_native_packing
;
4015 (*ctx
->Exec
->Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
4016 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (const GLubyte
*) n
[7].data
);
4017 ctx
->Unpack
= save
; /* restore */
4020 case OPCODE_BLEND_COLOR
:
4021 (*ctx
->Exec
->BlendColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4023 case OPCODE_BLEND_EQUATION
:
4024 (*ctx
->Exec
->BlendEquation
)( n
[1].e
);
4026 case OPCODE_BLEND_FUNC
:
4027 (*ctx
->Exec
->BlendFunc
)( n
[1].e
, n
[2].e
);
4029 case OPCODE_BLEND_FUNC_SEPARATE
:
4030 (*ctx
->Exec
->BlendFuncSeparateEXT
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
4032 case OPCODE_CALL_LIST
:
4033 /* Generated by glCallList(), don't add ListBase */
4034 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4035 execute_list( ctx
, n
[1].ui
);
4038 case OPCODE_CALL_LIST_OFFSET
:
4039 /* Generated by glCallLists() so we must add ListBase */
4040 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4041 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
4045 (*ctx
->Exec
->Clear
)( n
[1].bf
);
4047 case OPCODE_CLEAR_COLOR
:
4048 (*ctx
->Exec
->ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4050 case OPCODE_CLEAR_ACCUM
:
4051 (*ctx
->Exec
->ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4053 case OPCODE_CLEAR_DEPTH
:
4054 (*ctx
->Exec
->ClearDepth
)( (GLclampd
) n
[1].f
);
4056 case OPCODE_CLEAR_INDEX
:
4057 (*ctx
->Exec
->ClearIndex
)( n
[1].ui
);
4059 case OPCODE_CLEAR_STENCIL
:
4060 (*ctx
->Exec
->ClearStencil
)( n
[1].i
);
4062 case OPCODE_CLIP_PLANE
:
4069 (*ctx
->Exec
->ClipPlane
)( n
[1].e
, eq
);
4072 case OPCODE_COLOR_MASK
:
4073 (*ctx
->Exec
->ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
4075 case OPCODE_COLOR_MATERIAL
:
4076 (*ctx
->Exec
->ColorMaterial
)( n
[1].e
, n
[2].e
);
4078 case OPCODE_COLOR_TABLE
:
4080 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4081 ctx
->Unpack
= _mesa_native_packing
;
4082 (*ctx
->Exec
->ColorTable
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
4083 n
[5].e
, n
[6].data
);
4084 ctx
->Unpack
= save
; /* restore */
4087 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
4094 (*ctx
->Exec
->ColorTableParameterfv
)( n
[1].e
, n
[2].e
, params
);
4097 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
4104 (*ctx
->Exec
->ColorTableParameteriv
)( n
[1].e
, n
[2].e
, params
);
4107 case OPCODE_COLOR_SUB_TABLE
:
4109 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4110 ctx
->Unpack
= _mesa_native_packing
;
4111 (*ctx
->Exec
->ColorSubTable
)( n
[1].e
, n
[2].i
, n
[3].i
,
4112 n
[4].e
, n
[5].e
, n
[6].data
);
4113 ctx
->Unpack
= save
; /* restore */
4116 case OPCODE_CONVOLUTION_FILTER_1D
:
4118 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4119 ctx
->Unpack
= _mesa_native_packing
;
4120 (*ctx
->Exec
->ConvolutionFilter1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4121 n
[4].e
, n
[5].e
, n
[6].data
);
4122 ctx
->Unpack
= save
; /* restore */
4125 case OPCODE_CONVOLUTION_FILTER_2D
:
4127 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4128 ctx
->Unpack
= _mesa_native_packing
;
4129 (*ctx
->Exec
->ConvolutionFilter2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4130 n
[4].i
, n
[5].e
, n
[6].e
, n
[7].data
);
4131 ctx
->Unpack
= save
; /* restore */
4134 case OPCODE_CONVOLUTION_PARAMETER_I
:
4135 (*ctx
->Exec
->ConvolutionParameteri
)( n
[1].e
, n
[2].e
, n
[3].i
);
4137 case OPCODE_CONVOLUTION_PARAMETER_IV
:
4144 (*ctx
->Exec
->ConvolutionParameteriv
)( n
[1].e
, n
[2].e
, params
);
4147 case OPCODE_CONVOLUTION_PARAMETER_F
:
4148 (*ctx
->Exec
->ConvolutionParameterf
)( n
[1].e
, n
[2].e
, n
[3].f
);
4150 case OPCODE_CONVOLUTION_PARAMETER_FV
:
4157 (*ctx
->Exec
->ConvolutionParameterfv
)( n
[1].e
, n
[2].e
, params
);
4160 case OPCODE_COPY_COLOR_SUB_TABLE
:
4161 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4162 n
[3].i
, n
[4].i
, n
[5].i
);
4164 case OPCODE_COPY_COLOR_TABLE
:
4165 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4166 n
[3].i
, n
[4].i
, n
[5].i
);
4168 case OPCODE_COPY_PIXELS
:
4169 (*ctx
->Exec
->CopyPixels
)( n
[1].i
, n
[2].i
,
4170 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
4172 case OPCODE_COPY_TEX_IMAGE1D
:
4173 (*ctx
->Exec
->CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4174 n
[5].i
, n
[6].i
, n
[7].i
);
4176 case OPCODE_COPY_TEX_IMAGE2D
:
4177 (*ctx
->Exec
->CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4178 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4180 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
4181 (*ctx
->Exec
->CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4182 n
[4].i
, n
[5].i
, n
[6].i
);
4184 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
4185 (*ctx
->Exec
->CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4186 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4188 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
4189 (*ctx
->Exec
->CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4190 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
4192 case OPCODE_CULL_FACE
:
4193 (*ctx
->Exec
->CullFace
)( n
[1].e
);
4195 case OPCODE_DEPTH_FUNC
:
4196 (*ctx
->Exec
->DepthFunc
)( n
[1].e
);
4198 case OPCODE_DEPTH_MASK
:
4199 (*ctx
->Exec
->DepthMask
)( n
[1].b
);
4201 case OPCODE_DEPTH_RANGE
:
4202 (*ctx
->Exec
->DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
4204 case OPCODE_DISABLE
:
4205 (*ctx
->Exec
->Disable
)( n
[1].e
);
4207 case OPCODE_DRAW_BUFFER
:
4208 (*ctx
->Exec
->DrawBuffer
)( n
[1].e
);
4210 case OPCODE_DRAW_PIXELS
:
4212 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4213 ctx
->Unpack
= _mesa_native_packing
;
4214 (*ctx
->Exec
->DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
4216 ctx
->Unpack
= save
; /* restore */
4220 (*ctx
->Exec
->Enable
)( n
[1].e
);
4222 case OPCODE_EVALMESH1
:
4223 (*ctx
->Exec
->EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
4225 case OPCODE_EVALMESH2
:
4226 (*ctx
->Exec
->EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
4235 (*ctx
->Exec
->Fogfv
)( n
[1].e
, p
);
4238 case OPCODE_FRONT_FACE
:
4239 (*ctx
->Exec
->FrontFace
)( n
[1].e
);
4241 case OPCODE_FRUSTUM
:
4242 (*ctx
->Exec
->Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4245 (*ctx
->Exec
->Hint
)( n
[1].e
, n
[2].e
);
4247 case OPCODE_HINT_PGI
:
4248 (*ctx
->Exec
->HintPGI
)( n
[1].e
, n
[2].i
);
4250 case OPCODE_HISTOGRAM
:
4251 (*ctx
->Exec
->Histogram
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
);
4253 case OPCODE_INDEX_MASK
:
4254 (*ctx
->Exec
->IndexMask
)( n
[1].ui
);
4256 case OPCODE_INIT_NAMES
:
4257 (*ctx
->Exec
->InitNames
)();
4266 (*ctx
->Exec
->Lightfv
)( n
[1].e
, n
[2].e
, p
);
4269 case OPCODE_LIGHT_MODEL
:
4276 (*ctx
->Exec
->LightModelfv
)( n
[1].e
, p
);
4279 case OPCODE_LINE_STIPPLE
:
4280 (*ctx
->Exec
->LineStipple
)( n
[1].i
, n
[2].us
);
4282 case OPCODE_LINE_WIDTH
:
4283 (*ctx
->Exec
->LineWidth
)( n
[1].f
);
4285 case OPCODE_LIST_BASE
:
4286 (*ctx
->Exec
->ListBase
)( n
[1].ui
);
4288 case OPCODE_LOAD_IDENTITY
:
4289 (*ctx
->Exec
->LoadIdentity
)();
4291 case OPCODE_LOAD_MATRIX
:
4292 if (sizeof(Node
)==sizeof(GLfloat
)) {
4293 (*ctx
->Exec
->LoadMatrixf
)( &n
[1].f
);
4298 for (i
=0;i
<16;i
++) {
4301 (*ctx
->Exec
->LoadMatrixf
)( m
);
4304 case OPCODE_LOAD_NAME
:
4305 (*ctx
->Exec
->LoadName
)( n
[1].ui
);
4307 case OPCODE_LOGIC_OP
:
4308 (*ctx
->Exec
->LogicOp
)( n
[1].e
);
4312 GLenum target
= n
[1].e
;
4313 GLint ustride
= _mesa_evaluator_components(target
);
4314 GLint uorder
= n
[5].i
;
4315 GLfloat u1
= n
[2].f
;
4316 GLfloat u2
= n
[3].f
;
4317 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, ustride
, uorder
,
4318 (GLfloat
*) n
[6].data
);
4323 GLenum target
= n
[1].e
;
4324 GLfloat u1
= n
[2].f
;
4325 GLfloat u2
= n
[3].f
;
4326 GLfloat v1
= n
[4].f
;
4327 GLfloat v2
= n
[5].f
;
4328 GLint ustride
= n
[6].i
;
4329 GLint vstride
= n
[7].i
;
4330 GLint uorder
= n
[8].i
;
4331 GLint vorder
= n
[9].i
;
4332 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
4333 v1
, v2
, vstride
, vorder
,
4334 (GLfloat
*) n
[10].data
);
4337 case OPCODE_MAPGRID1
:
4338 (*ctx
->Exec
->MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
4340 case OPCODE_MAPGRID2
:
4341 (*ctx
->Exec
->MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
4343 case OPCODE_MATRIX_MODE
:
4344 (*ctx
->Exec
->MatrixMode
)( n
[1].e
);
4346 case OPCODE_MIN_MAX
:
4347 (*ctx
->Exec
->Minmax
)(n
[1].e
, n
[2].e
, n
[3].b
);
4349 case OPCODE_MULT_MATRIX
:
4350 if (sizeof(Node
)==sizeof(GLfloat
)) {
4351 (*ctx
->Exec
->MultMatrixf
)( &n
[1].f
);
4356 for (i
=0;i
<16;i
++) {
4359 (*ctx
->Exec
->MultMatrixf
)( m
);
4363 (*ctx
->Exec
->Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4365 case OPCODE_PASSTHROUGH
:
4366 (*ctx
->Exec
->PassThrough
)( n
[1].f
);
4368 case OPCODE_PIXEL_MAP
:
4369 (*ctx
->Exec
->PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
4371 case OPCODE_PIXEL_TRANSFER
:
4372 (*ctx
->Exec
->PixelTransferf
)( n
[1].e
, n
[2].f
);
4374 case OPCODE_PIXEL_ZOOM
:
4375 (*ctx
->Exec
->PixelZoom
)( n
[1].f
, n
[2].f
);
4377 case OPCODE_POINT_SIZE
:
4378 (*ctx
->Exec
->PointSize
)( n
[1].f
);
4380 case OPCODE_POINT_PARAMETERS
:
4386 (*ctx
->Exec
->PointParameterfvEXT
)( n
[1].e
, params
);
4389 case OPCODE_POLYGON_MODE
:
4390 (*ctx
->Exec
->PolygonMode
)( n
[1].e
, n
[2].e
);
4392 case OPCODE_POLYGON_STIPPLE
:
4393 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) n
[1].data
);
4395 case OPCODE_POLYGON_OFFSET
:
4396 (*ctx
->Exec
->PolygonOffset
)( n
[1].f
, n
[2].f
);
4398 case OPCODE_POP_ATTRIB
:
4399 (*ctx
->Exec
->PopAttrib
)();
4401 case OPCODE_POP_MATRIX
:
4402 (*ctx
->Exec
->PopMatrix
)();
4404 case OPCODE_POP_NAME
:
4405 (*ctx
->Exec
->PopName
)();
4407 case OPCODE_PRIORITIZE_TEXTURE
:
4408 (*ctx
->Exec
->PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
4410 case OPCODE_PUSH_ATTRIB
:
4411 (*ctx
->Exec
->PushAttrib
)( n
[1].bf
);
4413 case OPCODE_PUSH_MATRIX
:
4414 (*ctx
->Exec
->PushMatrix
)();
4416 case OPCODE_PUSH_NAME
:
4417 (*ctx
->Exec
->PushName
)( n
[1].ui
);
4419 case OPCODE_RASTER_POS
:
4420 (*ctx
->Exec
->RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4422 case OPCODE_READ_BUFFER
:
4423 (*ctx
->Exec
->ReadBuffer
)( n
[1].e
);
4425 case OPCODE_RESET_HISTOGRAM
:
4426 (*ctx
->Exec
->ResetHistogram
)( n
[1].e
);
4428 case OPCODE_RESET_MIN_MAX
:
4429 (*ctx
->Exec
->ResetMinmax
)( n
[1].e
);
4432 (*ctx
->Exec
->Rotatef
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4435 (*ctx
->Exec
->Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4437 case OPCODE_SCISSOR
:
4438 (*ctx
->Exec
->Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
4440 case OPCODE_SHADE_MODEL
:
4441 (*ctx
->Exec
->ShadeModel
)( n
[1].e
);
4443 case OPCODE_STENCIL_FUNC
:
4444 (*ctx
->Exec
->StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
4446 case OPCODE_STENCIL_MASK
:
4447 (*ctx
->Exec
->StencilMask
)( n
[1].ui
);
4449 case OPCODE_STENCIL_OP
:
4450 (*ctx
->Exec
->StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
4459 (*ctx
->Exec
->TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
4469 (*ctx
->Exec
->TexGenfv
)( n
[1].e
, n
[2].e
, params
);
4472 case OPCODE_TEXPARAMETER
:
4479 (*ctx
->Exec
->TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
4482 case OPCODE_TEX_IMAGE1D
:
4484 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4485 ctx
->Unpack
= _mesa_native_packing
;
4486 (*ctx
->Exec
->TexImage1D
)(
4487 n
[1].e
, /* target */
4489 n
[3].i
, /* components */
4491 n
[5].e
, /* border */
4492 n
[6].e
, /* format */
4495 ctx
->Unpack
= save
; /* restore */
4498 case OPCODE_TEX_IMAGE2D
:
4500 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4501 ctx
->Unpack
= _mesa_native_packing
;
4502 (*ctx
->Exec
->TexImage2D
)(
4503 n
[1].e
, /* target */
4505 n
[3].i
, /* components */
4507 n
[5].i
, /* height */
4508 n
[6].e
, /* border */
4509 n
[7].e
, /* format */
4512 ctx
->Unpack
= save
; /* restore */
4515 case OPCODE_TEX_IMAGE3D
:
4517 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4518 ctx
->Unpack
= _mesa_native_packing
;
4519 (*ctx
->Exec
->TexImage3D
)(
4520 n
[1].e
, /* target */
4522 n
[3].i
, /* components */
4524 n
[5].i
, /* height */
4526 n
[7].e
, /* border */
4527 n
[8].e
, /* format */
4530 ctx
->Unpack
= save
; /* restore */
4533 case OPCODE_TEX_SUB_IMAGE1D
:
4535 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4536 ctx
->Unpack
= _mesa_native_packing
;
4537 (*ctx
->Exec
->TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4539 n
[6].e
, n
[7].data
);
4540 ctx
->Unpack
= save
; /* restore */
4543 case OPCODE_TEX_SUB_IMAGE2D
:
4545 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4546 ctx
->Unpack
= _mesa_native_packing
;
4547 (*ctx
->Exec
->TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4549 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
4550 ctx
->Unpack
= save
; /* restore */
4553 case OPCODE_TEX_SUB_IMAGE3D
:
4555 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4556 ctx
->Unpack
= _mesa_native_packing
;
4557 (*ctx
->Exec
->TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4558 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
4559 n
[8].i
, n
[9].e
, n
[10].e
,
4561 ctx
->Unpack
= save
; /* restore */
4564 case OPCODE_TRANSLATE
:
4565 (*ctx
->Exec
->Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4567 case OPCODE_VIEWPORT
:
4568 (*ctx
->Exec
->Viewport
)(n
[1].i
, n
[2].i
,
4569 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
4571 case OPCODE_WINDOW_POS
:
4572 (*ctx
->Exec
->WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4574 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
4575 (*ctx
->Exec
->ActiveTextureARB
)( n
[1].e
);
4577 case OPCODE_CLIENT_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
4578 (*ctx
->Exec
->ClientActiveTextureARB
)( n
[1].e
);
4580 case OPCODE_PIXEL_TEXGEN_SGIX
: /* GL_SGIX_pixel_texture */
4581 (*ctx
->Exec
->PixelTexGenSGIX
)( n
[1].e
);
4583 case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
: /* GL_SGIS_pixel_texture */
4584 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( n
[1].e
, n
[2].i
);
4586 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
4587 (*ctx
->Exec
->CompressedTexImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4588 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].data
);
4590 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
4591 (*ctx
->Exec
->CompressedTexImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4592 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].data
);
4594 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
4595 (*ctx
->Exec
->CompressedTexImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4596 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].data
);
4598 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
4599 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4600 n
[4].i
, n
[5].e
, n
[6].i
, n
[7].data
);
4602 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
4603 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4604 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
, n
[9].data
);
4606 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
4607 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4608 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
4609 n
[9].e
, n
[10].i
, n
[11].data
);
4611 case OPCODE_CONTINUE
:
4612 n
= (Node
*) n
[1].next
;
4614 case OPCODE_END_OF_LIST
:
4620 sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
4621 gl_problem( ctx
, msg
);
4626 /* increment n to point to next compiled command */
4627 if (opcode
!=OPCODE_CONTINUE
) {
4628 n
+= InstSize
[opcode
];
4639 /**********************************************************************/
4641 /**********************************************************************/
4647 * Test if a display list number is valid.
4650 _mesa_IsList( GLuint list
)
4652 GET_CURRENT_CONTEXT(ctx
);
4653 return islist(ctx
, list
);
4658 * Delete a sequence of consecutive display lists.
4661 _mesa_DeleteLists( GLuint list
, GLsizei range
)
4663 GET_CURRENT_CONTEXT(ctx
);
4666 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glDeleteLists");
4668 gl_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
4671 for (i
=list
;i
<list
+range
;i
++) {
4672 gl_destroy_list( ctx
, i
);
4679 * Return a display list number, n, such that lists n through n+range-1
4683 _mesa_GenLists(GLsizei range
)
4685 GET_CURRENT_CONTEXT(ctx
);
4688 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx
, "glGenLists", 0);
4690 gl_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
4698 * Make this an atomic operation
4700 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
4702 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
4704 /* reserve the list IDs by with empty/dummy lists */
4706 for (i
=0; i
<range
; i
++) {
4707 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
4711 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
4719 * Begin a new display list.
4722 _mesa_NewList( GLuint list
, GLenum mode
)
4724 GET_CURRENT_CONTEXT(ctx
);
4725 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glNewList");
4726 FLUSH_TNL( ctx
, FLUSH_UPDATE_CURRENT
);
4728 if (MESA_VERBOSE
&VERBOSE_API
)
4729 fprintf(stderr
, "glNewList %u %s\n", list
, gl_lookup_enum_by_nr(mode
));
4732 gl_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
4736 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
4737 gl_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
4741 if (ctx
->CurrentListPtr
) {
4742 /* already compiling a display list */
4743 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
4747 /* Allocate new display list */
4748 ctx
->CurrentListNum
= list
;
4749 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
4750 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
4751 ctx
->CurrentPos
= 0;
4752 ctx
->CompileFlag
= GL_TRUE
;
4753 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
4755 ctx
->Driver
.NewList( ctx
, list
, mode
);
4757 ctx
->CurrentDispatch
= ctx
->Save
;
4758 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4764 * End definition of current display list. Is the current
4765 * ASSERT_OUTSIDE_BEGIN_END strong enough to really guarentee that
4766 * we are outside begin/end calls?
4769 _mesa_EndList( void )
4771 GET_CURRENT_CONTEXT(ctx
);
4772 if (MESA_VERBOSE
&VERBOSE_API
)
4773 fprintf(stderr
, "glEndList\n");
4775 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
, "glEndList" );
4776 FLUSH_TNL( ctx
, FLUSH_UPDATE_CURRENT
);
4779 /* Check that a list is under construction */
4780 if (!ctx
->CurrentListPtr
) {
4781 gl_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
4785 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_END_OF_LIST
, 0 );
4787 /* Destroy old list, if any */
4788 gl_destroy_list(ctx
, ctx
->CurrentListNum
);
4789 /* Install the list */
4790 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
4793 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
4794 mesa_print_display_list(ctx
->CurrentListNum
);
4796 ctx
->CurrentListNum
= 0;
4797 ctx
->CurrentListPtr
= NULL
;
4798 ctx
->ExecuteFlag
= GL_TRUE
;
4799 ctx
->CompileFlag
= GL_FALSE
;
4801 ctx
->Driver
.EndList( ctx
);
4803 /* Haven't tracked down why this is needed.
4807 ctx
->CurrentDispatch
= ctx
->Exec
;
4808 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4814 _mesa_CallList( GLuint list
)
4816 GET_CURRENT_CONTEXT(ctx
);
4817 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
4818 /* execute the display list, and restore the CompileFlag. */
4819 GLboolean save_compile_flag
;
4821 if (MESA_VERBOSE
&VERBOSE_API
) {
4822 fprintf(stderr
, "glCallList %u\n", list
);
4823 mesa_print_display_list( list
);
4826 save_compile_flag
= ctx
->CompileFlag
;
4827 ctx
->CompileFlag
= GL_FALSE
;
4829 FLUSH_TNL( ctx
, (FLUSH_STORED_VERTICES
| FLUSH_UPDATE_CURRENT
) );
4830 execute_list( ctx
, list
);
4831 ctx
->CompileFlag
= save_compile_flag
;
4833 /* also restore API function pointers to point to "save" versions */
4834 if (save_compile_flag
) {
4835 ctx
->CurrentDispatch
= ctx
->Save
;
4836 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4843 * Execute glCallLists: call multiple display lists.
4846 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
4848 GET_CURRENT_CONTEXT(ctx
);
4851 GLboolean save_compile_flag
;
4853 /* Save the CompileFlag status, turn it off, execute display list,
4854 * and restore the CompileFlag.
4856 save_compile_flag
= ctx
->CompileFlag
;
4857 ctx
->CompileFlag
= GL_FALSE
;
4859 FLUSH_TNL( ctx
, (FLUSH_STORED_VERTICES
| FLUSH_UPDATE_CURRENT
) );
4862 list
= translate_id( i
, type
, lists
);
4863 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
4866 ctx
->CompileFlag
= save_compile_flag
;
4868 /* also restore API function pointers to point to "save" versions */
4869 if (save_compile_flag
) {
4870 ctx
->CurrentDispatch
= ctx
->Save
;
4871 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4878 * Set the offset added to list numbers in glCallLists.
4881 _mesa_ListBase( GLuint base
)
4883 GET_CURRENT_CONTEXT(ctx
);
4884 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glListBase");
4885 ctx
->List
.ListBase
= base
;
4892 * Assign all the pointers in <table> to point to Mesa's display list
4893 * building functions.
4895 * This does not include any of the tnl functions - they are
4896 * initialized from _mesa_init_api_defaults and from the active vtxfmt
4900 _mesa_init_dlist_table( struct _glapi_table
*table
, GLuint tableSize
)
4902 _mesa_init_no_op_table(table
, tableSize
);
4904 _mesa_loopback_init_api_table( table
, GL_FALSE
);
4907 table
->Accum
= save_Accum
;
4908 table
->AlphaFunc
= save_AlphaFunc
;
4909 table
->Bitmap
= save_Bitmap
;
4910 table
->BlendFunc
= save_BlendFunc
;
4911 table
->CallList
= save_CallList
;
4912 table
->CallLists
= save_CallLists
;
4913 table
->Clear
= save_Clear
;
4914 table
->ClearAccum
= save_ClearAccum
;
4915 table
->ClearColor
= save_ClearColor
;
4916 table
->ClearDepth
= save_ClearDepth
;
4917 table
->ClearIndex
= save_ClearIndex
;
4918 table
->ClearStencil
= save_ClearStencil
;
4919 table
->ClipPlane
= save_ClipPlane
;
4920 table
->ColorMask
= save_ColorMask
;
4921 table
->ColorMaterial
= save_ColorMaterial
;
4922 table
->CopyPixels
= save_CopyPixels
;
4923 table
->CullFace
= save_CullFace
;
4924 table
->DeleteLists
= _mesa_DeleteLists
;
4925 table
->DepthFunc
= save_DepthFunc
;
4926 table
->DepthMask
= save_DepthMask
;
4927 table
->DepthRange
= save_DepthRange
;
4928 table
->Disable
= save_Disable
;
4929 table
->DrawBuffer
= save_DrawBuffer
;
4930 table
->DrawPixels
= save_DrawPixels
;
4931 table
->Enable
= save_Enable
;
4932 table
->EndList
= _mesa_EndList
;
4933 table
->EvalMesh1
= _mesa_save_EvalMesh1
;
4934 table
->EvalMesh2
= _mesa_save_EvalMesh2
;
4935 table
->Finish
= _mesa_Finish
;
4936 table
->Flush
= _mesa_Flush
;
4937 table
->Fogf
= save_Fogf
;
4938 table
->Fogfv
= save_Fogfv
;
4939 table
->Fogi
= save_Fogi
;
4940 table
->Fogiv
= save_Fogiv
;
4941 table
->FrontFace
= save_FrontFace
;
4942 table
->Frustum
= save_Frustum
;
4943 table
->GenLists
= _mesa_GenLists
;
4944 table
->GetBooleanv
= _mesa_GetBooleanv
;
4945 table
->GetClipPlane
= _mesa_GetClipPlane
;
4946 table
->GetDoublev
= _mesa_GetDoublev
;
4947 table
->GetError
= _mesa_GetError
;
4948 table
->GetFloatv
= _mesa_GetFloatv
;
4949 table
->GetIntegerv
= _mesa_GetIntegerv
;
4950 table
->GetLightfv
= _mesa_GetLightfv
;
4951 table
->GetLightiv
= _mesa_GetLightiv
;
4952 table
->GetMapdv
= _mesa_GetMapdv
;
4953 table
->GetMapfv
= _mesa_GetMapfv
;
4954 table
->GetMapiv
= _mesa_GetMapiv
;
4955 table
->GetMaterialfv
= _mesa_GetMaterialfv
;
4956 table
->GetMaterialiv
= _mesa_GetMaterialiv
;
4957 table
->GetPixelMapfv
= _mesa_GetPixelMapfv
;
4958 table
->GetPixelMapuiv
= _mesa_GetPixelMapuiv
;
4959 table
->GetPixelMapusv
= _mesa_GetPixelMapusv
;
4960 table
->GetPolygonStipple
= _mesa_GetPolygonStipple
;
4961 table
->GetString
= _mesa_GetString
;
4962 table
->GetTexEnvfv
= _mesa_GetTexEnvfv
;
4963 table
->GetTexEnviv
= _mesa_GetTexEnviv
;
4964 table
->GetTexGendv
= _mesa_GetTexGendv
;
4965 table
->GetTexGenfv
= _mesa_GetTexGenfv
;
4966 table
->GetTexGeniv
= _mesa_GetTexGeniv
;
4967 table
->GetTexImage
= _mesa_GetTexImage
;
4968 table
->GetTexLevelParameterfv
= _mesa_GetTexLevelParameterfv
;
4969 table
->GetTexLevelParameteriv
= _mesa_GetTexLevelParameteriv
;
4970 table
->GetTexParameterfv
= _mesa_GetTexParameterfv
;
4971 table
->GetTexParameteriv
= _mesa_GetTexParameteriv
;
4972 table
->Hint
= save_Hint
;
4973 table
->IndexMask
= save_IndexMask
;
4974 table
->InitNames
= save_InitNames
;
4975 table
->IsEnabled
= _mesa_IsEnabled
;
4976 table
->IsList
= _mesa_IsList
;
4977 table
->LightModelf
= save_LightModelf
;
4978 table
->LightModelfv
= save_LightModelfv
;
4979 table
->LightModeli
= save_LightModeli
;
4980 table
->LightModeliv
= save_LightModeliv
;
4981 table
->Lightf
= save_Lightf
;
4982 table
->Lightfv
= save_Lightfv
;
4983 table
->Lighti
= save_Lighti
;
4984 table
->Lightiv
= save_Lightiv
;
4985 table
->LineStipple
= save_LineStipple
;
4986 table
->LineWidth
= save_LineWidth
;
4987 table
->ListBase
= save_ListBase
;
4988 table
->LoadIdentity
= save_LoadIdentity
;
4989 table
->LoadMatrixd
= save_LoadMatrixd
;
4990 table
->LoadMatrixf
= save_LoadMatrixf
;
4991 table
->LoadName
= save_LoadName
;
4992 table
->LogicOp
= save_LogicOp
;
4993 table
->Map1d
= save_Map1d
;
4994 table
->Map1f
= save_Map1f
;
4995 table
->Map2d
= save_Map2d
;
4996 table
->Map2f
= save_Map2f
;
4997 table
->MapGrid1d
= save_MapGrid1d
;
4998 table
->MapGrid1f
= save_MapGrid1f
;
4999 table
->MapGrid2d
= save_MapGrid2d
;
5000 table
->MapGrid2f
= save_MapGrid2f
;
5001 table
->MatrixMode
= save_MatrixMode
;
5002 table
->MultMatrixd
= save_MultMatrixd
;
5003 table
->MultMatrixf
= save_MultMatrixf
;
5004 table
->NewList
= save_NewList
;
5005 table
->Ortho
= save_Ortho
;
5006 table
->PassThrough
= save_PassThrough
;
5007 table
->PixelMapfv
= save_PixelMapfv
;
5008 table
->PixelMapuiv
= save_PixelMapuiv
;
5009 table
->PixelMapusv
= save_PixelMapusv
;
5010 table
->PixelStoref
= _mesa_PixelStoref
;
5011 table
->PixelStorei
= _mesa_PixelStorei
;
5012 table
->PixelTransferf
= save_PixelTransferf
;
5013 table
->PixelTransferi
= save_PixelTransferi
;
5014 table
->PixelZoom
= save_PixelZoom
;
5015 table
->PointSize
= save_PointSize
;
5016 table
->PolygonMode
= save_PolygonMode
;
5017 table
->PolygonOffset
= save_PolygonOffset
;
5018 table
->PolygonStipple
= save_PolygonStipple
;
5019 table
->PopAttrib
= save_PopAttrib
;
5020 table
->PopMatrix
= save_PopMatrix
;
5021 table
->PopName
= save_PopName
;
5022 table
->PushAttrib
= save_PushAttrib
;
5023 table
->PushMatrix
= save_PushMatrix
;
5024 table
->PushName
= save_PushName
;
5025 table
->RasterPos2d
= save_RasterPos2d
;
5026 table
->RasterPos2dv
= save_RasterPos2dv
;
5027 table
->RasterPos2f
= save_RasterPos2f
;
5028 table
->RasterPos2fv
= save_RasterPos2fv
;
5029 table
->RasterPos2i
= save_RasterPos2i
;
5030 table
->RasterPos2iv
= save_RasterPos2iv
;
5031 table
->RasterPos2s
= save_RasterPos2s
;
5032 table
->RasterPos2sv
= save_RasterPos2sv
;
5033 table
->RasterPos3d
= save_RasterPos3d
;
5034 table
->RasterPos3dv
= save_RasterPos3dv
;
5035 table
->RasterPos3f
= save_RasterPos3f
;
5036 table
->RasterPos3fv
= save_RasterPos3fv
;
5037 table
->RasterPos3i
= save_RasterPos3i
;
5038 table
->RasterPos3iv
= save_RasterPos3iv
;
5039 table
->RasterPos3s
= save_RasterPos3s
;
5040 table
->RasterPos3sv
= save_RasterPos3sv
;
5041 table
->RasterPos4d
= save_RasterPos4d
;
5042 table
->RasterPos4dv
= save_RasterPos4dv
;
5043 table
->RasterPos4f
= save_RasterPos4f
;
5044 table
->RasterPos4fv
= save_RasterPos4fv
;
5045 table
->RasterPos4i
= save_RasterPos4i
;
5046 table
->RasterPos4iv
= save_RasterPos4iv
;
5047 table
->RasterPos4s
= save_RasterPos4s
;
5048 table
->RasterPos4sv
= save_RasterPos4sv
;
5049 table
->ReadBuffer
= save_ReadBuffer
;
5050 table
->ReadPixels
= _mesa_ReadPixels
;
5051 table
->RenderMode
= _mesa_RenderMode
;
5052 table
->Rotated
= save_Rotated
;
5053 table
->Rotatef
= save_Rotatef
;
5054 table
->Scaled
= save_Scaled
;
5055 table
->Scalef
= save_Scalef
;
5056 table
->Scissor
= save_Scissor
;
5057 table
->FeedbackBuffer
= _mesa_FeedbackBuffer
;
5058 table
->SelectBuffer
= _mesa_SelectBuffer
;
5059 table
->ShadeModel
= save_ShadeModel
;
5060 table
->StencilFunc
= save_StencilFunc
;
5061 table
->StencilMask
= save_StencilMask
;
5062 table
->StencilOp
= save_StencilOp
;
5063 table
->TexEnvf
= save_TexEnvf
;
5064 table
->TexEnvfv
= save_TexEnvfv
;
5065 table
->TexEnvi
= save_TexEnvi
;
5066 table
->TexEnviv
= save_TexEnviv
;
5067 table
->TexGend
= save_TexGend
;
5068 table
->TexGendv
= save_TexGendv
;
5069 table
->TexGenf
= save_TexGenf
;
5070 table
->TexGenfv
= save_TexGenfv
;
5071 table
->TexGeni
= save_TexGeni
;
5072 table
->TexGeniv
= save_TexGeniv
;
5073 table
->TexImage1D
= save_TexImage1D
;
5074 table
->TexImage2D
= save_TexImage2D
;
5075 table
->TexParameterf
= save_TexParameterf
;
5076 table
->TexParameterfv
= save_TexParameterfv
;
5077 table
->TexParameteri
= save_TexParameteri
;
5078 table
->TexParameteriv
= save_TexParameteriv
;
5079 table
->Translated
= save_Translated
;
5080 table
->Translatef
= save_Translatef
;
5081 table
->Viewport
= save_Viewport
;
5084 table
->AreTexturesResident
= _mesa_AreTexturesResident
;
5085 table
->BindTexture
= save_BindTexture
;
5086 table
->ColorPointer
= _mesa_ColorPointer
;
5087 table
->CopyTexImage1D
= save_CopyTexImage1D
;
5088 table
->CopyTexImage2D
= save_CopyTexImage2D
;
5089 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
5090 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
5091 table
->DeleteTextures
= _mesa_DeleteTextures
;
5092 table
->DisableClientState
= _mesa_DisableClientState
;
5093 table
->EdgeFlagPointer
= _mesa_EdgeFlagPointer
;
5094 table
->EnableClientState
= _mesa_EnableClientState
;
5095 table
->GenTextures
= _mesa_GenTextures
;
5096 table
->GetPointerv
= _mesa_GetPointerv
;
5097 table
->IndexPointer
= _mesa_IndexPointer
;
5098 table
->InterleavedArrays
= _mesa_InterleavedArrays
;
5099 table
->IsTexture
= _mesa_IsTexture
;
5100 table
->NormalPointer
= _mesa_NormalPointer
;
5101 table
->PopClientAttrib
= _mesa_PopClientAttrib
;
5102 table
->PrioritizeTextures
= save_PrioritizeTextures
;
5103 table
->PushClientAttrib
= _mesa_PushClientAttrib
;
5104 table
->TexCoordPointer
= _mesa_TexCoordPointer
;
5105 table
->TexSubImage1D
= save_TexSubImage1D
;
5106 table
->TexSubImage2D
= save_TexSubImage2D
;
5107 table
->VertexPointer
= _mesa_VertexPointer
;
5110 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
5111 table
->TexImage3D
= save_TexImage3D
;
5112 table
->TexSubImage3D
= save_TexSubImage3D
;
5114 /* GL_ARB_imaging */
5115 /* Not all are supported */
5116 table
->BlendColor
= save_BlendColor
;
5117 table
->BlendEquation
= save_BlendEquation
;
5118 table
->ColorSubTable
= save_ColorSubTable
;
5119 table
->ColorTable
= save_ColorTable
;
5120 table
->ColorTableParameterfv
= save_ColorTableParameterfv
;
5121 table
->ColorTableParameteriv
= save_ColorTableParameteriv
;
5122 table
->ConvolutionFilter1D
= save_ConvolutionFilter1D
;
5123 table
->ConvolutionFilter2D
= save_ConvolutionFilter2D
;
5124 table
->ConvolutionParameterf
= save_ConvolutionParameterf
;
5125 table
->ConvolutionParameterfv
= save_ConvolutionParameterfv
;
5126 table
->ConvolutionParameteri
= save_ConvolutionParameteri
;
5127 table
->ConvolutionParameteriv
= save_ConvolutionParameteriv
;
5128 table
->CopyColorSubTable
= save_CopyColorSubTable
;
5129 table
->CopyColorTable
= save_CopyColorTable
;
5130 table
->CopyConvolutionFilter1D
= _mesa_CopyConvolutionFilter1D
;
5131 table
->CopyConvolutionFilter2D
= _mesa_CopyConvolutionFilter2D
;
5132 table
->GetColorTable
= _mesa_GetColorTable
;
5133 table
->GetColorTableParameterfv
= _mesa_GetColorTableParameterfv
;
5134 table
->GetColorTableParameteriv
= _mesa_GetColorTableParameteriv
;
5135 table
->GetConvolutionFilter
= _mesa_GetConvolutionFilter
;
5136 table
->GetConvolutionParameterfv
= _mesa_GetConvolutionParameterfv
;
5137 table
->GetConvolutionParameteriv
= _mesa_GetConvolutionParameteriv
;
5138 table
->GetHistogram
= _mesa_GetHistogram
;
5139 table
->GetHistogramParameterfv
= _mesa_GetHistogramParameterfv
;
5140 table
->GetHistogramParameteriv
= _mesa_GetHistogramParameteriv
;
5141 table
->GetMinmax
= _mesa_GetMinmax
;
5142 table
->GetMinmaxParameterfv
= _mesa_GetMinmaxParameterfv
;
5143 table
->GetMinmaxParameteriv
= _mesa_GetMinmaxParameteriv
;
5144 table
->GetSeparableFilter
= _mesa_GetSeparableFilter
;
5145 table
->Histogram
= save_Histogram
;
5146 table
->Minmax
= save_Minmax
;
5147 table
->ResetHistogram
= save_ResetHistogram
;
5148 table
->ResetMinmax
= save_ResetMinmax
;
5149 table
->SeparableFilter2D
= _mesa_SeparableFilter2D
;
5151 /* 2. GL_EXT_blend_color */
5153 table
->BlendColorEXT
= save_BlendColorEXT
;
5156 /* 3. GL_EXT_polygon_offset */
5157 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
5159 /* 6. GL_EXT_texture3d */
5161 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
5162 table
->TexImage3DEXT
= save_TexImage3DEXT
;
5163 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
5166 /* 15. GL_SGIX_pixel_texture */
5167 table
->PixelTexGenSGIX
= save_PixelTexGenSGIX
;
5169 /* 15. GL_SGIS_pixel_texture */
5170 table
->PixelTexGenParameteriSGIS
= save_PixelTexGenParameteriSGIS
;
5171 table
->PixelTexGenParameterfSGIS
= save_PixelTexGenParameterfSGIS
;
5172 table
->PixelTexGenParameterivSGIS
= save_PixelTexGenParameterivSGIS
;
5173 table
->PixelTexGenParameterfvSGIS
= save_PixelTexGenParameterfvSGIS
;
5174 table
->GetPixelTexGenParameterivSGIS
= _mesa_GetPixelTexGenParameterivSGIS
;
5175 table
->GetPixelTexGenParameterfvSGIS
= _mesa_GetPixelTexGenParameterfvSGIS
;
5177 /* 30. GL_EXT_vertex_array */
5178 table
->ColorPointerEXT
= _mesa_ColorPointerEXT
;
5179 table
->EdgeFlagPointerEXT
= _mesa_EdgeFlagPointerEXT
;
5180 table
->IndexPointerEXT
= _mesa_IndexPointerEXT
;
5181 table
->NormalPointerEXT
= _mesa_NormalPointerEXT
;
5182 table
->TexCoordPointerEXT
= _mesa_TexCoordPointerEXT
;
5183 table
->VertexPointerEXT
= _mesa_VertexPointerEXT
;
5185 /* 37. GL_EXT_blend_minmax */
5187 table
->BlendEquationEXT
= save_BlendEquationEXT
;
5190 /* 54. GL_EXT_point_parameters */
5191 table
->PointParameterfEXT
= save_PointParameterfEXT
;
5192 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
5194 /* 77. GL_PGI_misc_hints */
5195 table
->HintPGI
= save_HintPGI
;
5197 /* 78. GL_EXT_paletted_texture */
5199 table
->ColorTableEXT
= save_ColorTable
;
5200 table
->ColorSubTableEXT
= save_ColorSubTable
;
5202 table
->GetColorTableEXT
= _mesa_GetColorTable
;
5203 table
->GetColorTableParameterfvEXT
= _mesa_GetColorTableParameterfv
;
5204 table
->GetColorTableParameterivEXT
= _mesa_GetColorTableParameteriv
;
5206 /* 97. GL_EXT_compiled_vertex_array */
5207 table
->LockArraysEXT
= _mesa_LockArraysEXT
;
5208 table
->UnlockArraysEXT
= _mesa_UnlockArraysEXT
;
5210 /* GL_ARB_multitexture */
5211 table
->ActiveTextureARB
= save_ActiveTextureARB
;
5212 table
->ClientActiveTextureARB
= save_ClientActiveTextureARB
;
5214 /* GL_EXT_blend_func_separate */
5215 table
->BlendFuncSeparateEXT
= save_BlendFuncSeparateEXT
;
5217 /* GL_MESA_window_pos */
5218 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
5219 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
5220 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
5221 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
5222 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
5223 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
5224 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
5225 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
5226 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
5227 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
5228 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
5229 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
5230 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
5231 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
5232 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
5233 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
5234 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
5235 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
5236 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
5237 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
5238 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
5239 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
5240 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
5241 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
5243 /* GL_MESA_resize_buffers */
5244 table
->ResizeBuffersMESA
= _mesa_ResizeBuffersMESA
;
5246 /* GL_ARB_transpose_matrix */
5247 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
5248 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
5249 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
5250 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
5252 /* ARB 12. GL_ARB_texture_compression */
5253 table
->CompressedTexImage3DARB
= save_CompressedTexImage3DARB
;
5254 table
->CompressedTexImage2DARB
= save_CompressedTexImage2DARB
;
5255 table
->CompressedTexImage1DARB
= save_CompressedTexImage1DARB
;
5256 table
->CompressedTexSubImage3DARB
= save_CompressedTexSubImage3DARB
;
5257 table
->CompressedTexSubImage2DARB
= save_CompressedTexSubImage2DARB
;
5258 table
->CompressedTexSubImage1DARB
= save_CompressedTexSubImage1DARB
;
5259 table
->GetCompressedTexImageARB
= _mesa_GetCompressedTexImageARB
;
5261 /* GL_EXT_secondary_color */
5262 table
->SecondaryColorPointerEXT
= _mesa_SecondaryColorPointerEXT
;
5264 /* GL_EXT_fog_coord */
5265 table
->FogCoordPointerEXT
= _mesa_FogCoordPointerEXT
;
5273 static const char *enum_string( GLenum k
)
5275 return gl_lookup_enum_by_nr( k
);
5280 * Print the commands in a display list. For debugging only.
5281 * TODO: many commands aren't handled yet.
5283 static void print_list( GLcontext
*ctx
, FILE *f
, GLuint list
)
5288 if (!glIsList(list
)) {
5289 fprintf(f
,"%u is not a display list ID\n",list
);
5293 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
5295 fprintf( f
, "START-LIST %u, address %p\n", list
, (void*)n
);
5297 done
= n
? GL_FALSE
: GL_TRUE
;
5299 OpCode opcode
= n
[0].opcode
;
5300 int i
= (int)n
[0].opcode
- (int)OPCODE_DRV_0
;
5302 if (i
>= 0 && i
< ctx
->listext
.nr_opcodes
) {
5303 ctx
->listext
.opcode
[i
].print(ctx
, &n
[1]);
5304 n
+= ctx
->listext
.opcode
[i
].size
;
5308 fprintf(f
,"accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
5311 fprintf(f
,"Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
5312 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
5314 case OPCODE_CALL_LIST
:
5315 fprintf(f
,"CallList %d\n", (int) n
[1].ui
);
5317 case OPCODE_CALL_LIST_OFFSET
:
5318 fprintf(f
,"CallList %d + offset %u = %u\n", (int) n
[1].ui
,
5319 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
5321 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5322 fprintf(f
,"ColorTableParameterfv %s %s %f %f %f %f\n",
5323 enum_string(n
[1].e
), enum_string(n
[2].e
),
5324 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5326 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5327 fprintf(f
,"ColorTableParameteriv %s %s %d %d %d %d\n",
5328 enum_string(n
[1].e
), enum_string(n
[2].e
),
5329 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
5331 case OPCODE_DISABLE
:
5332 fprintf(f
,"Disable %s\n", enum_string(n
[1].e
));
5335 fprintf(f
,"Enable %s\n", enum_string(n
[1].e
));
5337 case OPCODE_FRUSTUM
:
5338 fprintf(f
,"Frustum %g %g %g %g %g %g\n",
5339 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5341 case OPCODE_LINE_STIPPLE
:
5342 fprintf(f
,"LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
5344 case OPCODE_LOAD_IDENTITY
:
5345 fprintf(f
,"LoadIdentity\n");
5347 case OPCODE_LOAD_MATRIX
:
5348 fprintf(f
,"LoadMatrix\n");
5349 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
5350 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
5351 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
5352 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
5354 case OPCODE_MULT_MATRIX
:
5355 fprintf(f
,"MultMatrix (or Rotate)\n");
5356 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
5357 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
5358 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
5359 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
5362 fprintf(f
,"Ortho %g %g %g %g %g %g\n",
5363 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5365 case OPCODE_POP_ATTRIB
:
5366 fprintf(f
,"PopAttrib\n");
5368 case OPCODE_POP_MATRIX
:
5369 fprintf(f
,"PopMatrix\n");
5371 case OPCODE_POP_NAME
:
5372 fprintf(f
,"PopName\n");
5374 case OPCODE_PUSH_ATTRIB
:
5375 fprintf(f
,"PushAttrib %x\n", n
[1].bf
);
5377 case OPCODE_PUSH_MATRIX
:
5378 fprintf(f
,"PushMatrix\n");
5380 case OPCODE_PUSH_NAME
:
5381 fprintf(f
,"PushName %d\n", (int) n
[1].ui
);
5383 case OPCODE_RASTER_POS
:
5384 fprintf(f
,"RasterPos %g %g %g %g\n", n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
5387 fprintf(f
,"Rotate %g %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
5390 fprintf(f
,"Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
5392 case OPCODE_TRANSLATE
:
5393 fprintf(f
,"Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
5395 case OPCODE_BIND_TEXTURE
:
5396 fprintf(f
,"BindTexture %s %d\n", gl_lookup_enum_by_nr(n
[1].ui
),
5399 case OPCODE_SHADE_MODEL
:
5400 fprintf(f
,"ShadeModel %s\n", gl_lookup_enum_by_nr(n
[1].ui
));
5404 * meta opcodes/commands
5407 fprintf(f
,"Error: %s %s\n", enum_string(n
[1].e
), (const char *)n
[2].data
);
5409 case OPCODE_CONTINUE
:
5410 fprintf(f
,"DISPLAY-LIST-CONTINUE\n");
5411 n
= (Node
*) n
[1].next
;
5413 case OPCODE_END_OF_LIST
:
5414 fprintf(f
,"END-LIST %u\n", list
);
5418 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
5419 fprintf(f
,"ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
5424 fprintf(f
,"command %d, %u operands\n",opcode
,InstSize
[opcode
]);
5427 /* increment n to point to next compiled command */
5428 if (opcode
!=OPCODE_CONTINUE
) {
5429 n
+= InstSize
[opcode
];
5438 * Clients may call this function to help debug display list problems.
5439 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
5440 * changed, or break in the future without notice.
5442 void mesa_print_display_list( GLuint list
)
5444 GET_CURRENT_CONTEXT(ctx
);
5445 print_list( ctx
, stderr
, list
);