1 /* $Id: dlist.c,v 1.65 2001/03/03 20:33:27 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2001 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"
49 #include "extensions.h"
54 #include "histogram.h"
74 #include "math/m_matrix.h"
75 #include "math/m_xform.h"
82 Functions which aren't compiled but executed immediately:
86 glEndList --- BUT: call ctx->Driver.EndList at end of list execution?
97 Functions which cause errors if called while compiling a display list:
104 * Display list instructions are stored as sequences of "nodes". Nodes
105 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
106 * are linked together with a pointer.
110 /* How many nodes to allocate at a time:
111 * - reduced now that we hold vertices etc. elsewhere.
113 #define BLOCK_SIZE 64
117 * Display list opcodes.
119 * The fact that these identifiers are assigned consecutive
120 * integer values starting at 0 is very important, see InstSize array usage)
129 OPCODE_BLEND_EQUATION
,
131 OPCODE_BLEND_FUNC_SEPARATE
,
133 OPCODE_CALL_LIST_OFFSET
,
139 OPCODE_CLEAR_STENCIL
,
142 OPCODE_COLOR_MATERIAL
,
144 OPCODE_COLOR_TABLE_PARAMETER_FV
,
145 OPCODE_COLOR_TABLE_PARAMETER_IV
,
146 OPCODE_COLOR_SUB_TABLE
,
147 OPCODE_CONVOLUTION_FILTER_1D
,
148 OPCODE_CONVOLUTION_FILTER_2D
,
149 OPCODE_CONVOLUTION_PARAMETER_I
,
150 OPCODE_CONVOLUTION_PARAMETER_IV
,
151 OPCODE_CONVOLUTION_PARAMETER_F
,
152 OPCODE_CONVOLUTION_PARAMETER_FV
,
153 OPCODE_COPY_COLOR_SUB_TABLE
,
154 OPCODE_COPY_COLOR_TABLE
,
156 OPCODE_COPY_TEX_IMAGE1D
,
157 OPCODE_COPY_TEX_IMAGE2D
,
158 OPCODE_COPY_TEX_SUB_IMAGE1D
,
159 OPCODE_COPY_TEX_SUB_IMAGE2D
,
160 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 _mesa_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 _mesa_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_HISTOGRAM
] = 5;
567 InstSize
[OPCODE_INDEX_MASK
] = 2;
568 InstSize
[OPCODE_INIT_NAMES
] = 1;
569 InstSize
[OPCODE_LIGHT
] = 7;
570 InstSize
[OPCODE_LIGHT_MODEL
] = 6;
571 InstSize
[OPCODE_LINE_STIPPLE
] = 3;
572 InstSize
[OPCODE_LINE_WIDTH
] = 2;
573 InstSize
[OPCODE_LIST_BASE
] = 2;
574 InstSize
[OPCODE_LOAD_IDENTITY
] = 1;
575 InstSize
[OPCODE_LOAD_MATRIX
] = 17;
576 InstSize
[OPCODE_LOAD_NAME
] = 2;
577 InstSize
[OPCODE_LOGIC_OP
] = 2;
578 InstSize
[OPCODE_MAP1
] = 7;
579 InstSize
[OPCODE_MAP2
] = 11;
580 InstSize
[OPCODE_MAPGRID1
] = 4;
581 InstSize
[OPCODE_MAPGRID2
] = 7;
582 InstSize
[OPCODE_MATRIX_MODE
] = 2;
583 InstSize
[OPCODE_MIN_MAX
] = 4;
584 InstSize
[OPCODE_MULT_MATRIX
] = 17;
585 InstSize
[OPCODE_ORTHO
] = 7;
586 InstSize
[OPCODE_PASSTHROUGH
] = 2;
587 InstSize
[OPCODE_PIXEL_MAP
] = 4;
588 InstSize
[OPCODE_PIXEL_TRANSFER
] = 3;
589 InstSize
[OPCODE_PIXEL_ZOOM
] = 3;
590 InstSize
[OPCODE_POINT_SIZE
] = 2;
591 InstSize
[OPCODE_POINT_PARAMETERS
] = 5;
592 InstSize
[OPCODE_POLYGON_MODE
] = 3;
593 InstSize
[OPCODE_POLYGON_STIPPLE
] = 2;
594 InstSize
[OPCODE_POLYGON_OFFSET
] = 3;
595 InstSize
[OPCODE_POP_ATTRIB
] = 1;
596 InstSize
[OPCODE_POP_MATRIX
] = 1;
597 InstSize
[OPCODE_POP_NAME
] = 1;
598 InstSize
[OPCODE_PRIORITIZE_TEXTURE
] = 3;
599 InstSize
[OPCODE_PUSH_ATTRIB
] = 2;
600 InstSize
[OPCODE_PUSH_MATRIX
] = 1;
601 InstSize
[OPCODE_PUSH_NAME
] = 2;
602 InstSize
[OPCODE_RASTER_POS
] = 5;
603 InstSize
[OPCODE_READ_BUFFER
] = 2;
604 InstSize
[OPCODE_RESET_HISTOGRAM
] = 2;
605 InstSize
[OPCODE_RESET_MIN_MAX
] = 2;
606 InstSize
[OPCODE_ROTATE
] = 5;
607 InstSize
[OPCODE_SCALE
] = 4;
608 InstSize
[OPCODE_SCISSOR
] = 5;
609 InstSize
[OPCODE_STENCIL_FUNC
] = 4;
610 InstSize
[OPCODE_STENCIL_MASK
] = 2;
611 InstSize
[OPCODE_STENCIL_OP
] = 4;
612 InstSize
[OPCODE_SHADE_MODEL
] = 2;
613 InstSize
[OPCODE_TEXENV
] = 7;
614 InstSize
[OPCODE_TEXGEN
] = 7;
615 InstSize
[OPCODE_TEXPARAMETER
] = 7;
616 InstSize
[OPCODE_TEX_IMAGE1D
] = 9;
617 InstSize
[OPCODE_TEX_IMAGE2D
] = 10;
618 InstSize
[OPCODE_TEX_IMAGE3D
] = 11;
619 InstSize
[OPCODE_TEX_SUB_IMAGE1D
] = 8;
620 InstSize
[OPCODE_TEX_SUB_IMAGE2D
] = 10;
621 InstSize
[OPCODE_TEX_SUB_IMAGE3D
] = 12;
622 InstSize
[OPCODE_TRANSLATE
] = 4;
623 InstSize
[OPCODE_VIEWPORT
] = 5;
624 InstSize
[OPCODE_WINDOW_POS
] = 5;
625 InstSize
[OPCODE_CONTINUE
] = 2;
626 InstSize
[OPCODE_ERROR
] = 3;
627 InstSize
[OPCODE_END_OF_LIST
] = 1;
628 /* GL_SGIX/SGIS_pixel_texture */
629 InstSize
[OPCODE_PIXEL_TEXGEN_SGIX
] = 2;
630 InstSize
[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
] = 3;
631 /* GL_ARB_texture_compression */
632 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_1D
] = 8;
633 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_2D
] = 9;
634 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_3D
] = 10;
635 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
] = 8;
636 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
] = 10;
637 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
] = 12;
638 /* GL_ARB_multitexture */
639 InstSize
[OPCODE_ACTIVE_TEXTURE
] = 2;
640 InstSize
[OPCODE_CLIENT_ACTIVE_TEXTURE
] = 2;
647 * Allocate space for a display list instruction.
648 * Input: opcode - type of instruction
649 * argcount - size in bytes of data required.
650 * Return: pointer to the usable data area (not including the internal
654 _mesa_alloc_instruction( GLcontext
*ctx
, int opcode
, GLint sz
)
657 GLuint count
= 1 + (sz
+ sizeof(Node
) - 1) / sizeof(Node
);
660 if (opcode
< (int) OPCODE_DRV_0
) {
661 assert( (GLint
) count
== InstSize
[opcode
] );
665 if (ctx
->CurrentPos
+ count
+ 2 > BLOCK_SIZE
) {
666 /* This block is full. Allocate a new block and chain to it */
667 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
668 n
[0].opcode
= OPCODE_CONTINUE
;
669 newblock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
671 _mesa_error( ctx
, GL_OUT_OF_MEMORY
, "Building display list" );
674 n
[1].next
= (Node
*) newblock
;
675 ctx
->CurrentBlock
= newblock
;
679 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
680 ctx
->CurrentPos
+= count
;
682 n
[0].opcode
= (OpCode
) opcode
;
684 return (void *)&n
[1];
688 /* Allow modules and drivers to get their own opcodes.
691 _mesa_alloc_opcode( GLcontext
*ctx
,
693 void (*execute
)( GLcontext
*, void * ),
694 void (*destroy
)( GLcontext
*, void * ),
695 void (*print
)( GLcontext
*, void * ) )
697 if (ctx
->listext
.nr_opcodes
< GL_MAX_EXT_OPCODES
) {
698 GLuint i
= ctx
->listext
.nr_opcodes
++;
699 ctx
->listext
.opcode
[i
].size
= 1 + (sz
+ sizeof(Node
) - 1)/sizeof(Node
);
700 ctx
->listext
.opcode
[i
].execute
= execute
;
701 ctx
->listext
.opcode
[i
].destroy
= destroy
;
702 ctx
->listext
.opcode
[i
].print
= print
;
703 return i
+ OPCODE_DRV_0
;
710 /* Mimic the old behaviour of alloc_instruction:
711 * - sz is in units of sizeof(Node)
712 * - return value a pointer to sizeof(Node) before the actual
715 #define ALLOC_INSTRUCTION(ctx, opcode, sz) \
716 ((Node *)_mesa_alloc_instruction(ctx, opcode, sz*sizeof(Node)) - 1)
721 * Display List compilation functions
723 static void save_Accum( GLenum op
, GLfloat value
)
725 GET_CURRENT_CONTEXT(ctx
);
727 FLUSH_VERTICES(ctx
, 0);
728 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACCUM
, 2 );
733 if (ctx
->ExecuteFlag
) {
734 (*ctx
->Exec
->Accum
)( op
, value
);
739 static void save_AlphaFunc( GLenum func
, GLclampf ref
)
741 GET_CURRENT_CONTEXT(ctx
);
743 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
744 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ALPHA_FUNC
, 2 );
747 n
[2].f
= (GLfloat
) ref
;
749 if (ctx
->ExecuteFlag
) {
750 (*ctx
->Exec
->AlphaFunc
)( func
, ref
);
755 static void save_BindTexture( GLenum target
, GLuint texture
)
757 GET_CURRENT_CONTEXT(ctx
);
759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
760 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_TEXTURE
, 2 );
765 if (ctx
->ExecuteFlag
) {
766 (*ctx
->Exec
->BindTexture
)( target
, texture
);
771 static void save_Bitmap( GLsizei width
, GLsizei height
,
772 GLfloat xorig
, GLfloat yorig
,
773 GLfloat xmove
, GLfloat ymove
,
774 const GLubyte
*pixels
)
776 GET_CURRENT_CONTEXT(ctx
);
777 GLvoid
*image
= _mesa_unpack_bitmap( width
, height
, pixels
, &ctx
->Unpack
);
779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
780 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BITMAP
, 7 );
782 n
[1].i
= (GLint
) width
;
783 n
[2].i
= (GLint
) height
;
793 if (ctx
->ExecuteFlag
) {
794 (*ctx
->Exec
->Bitmap
)( width
, height
,
795 xorig
, yorig
, xmove
, ymove
, pixels
);
800 static void save_BlendEquation( GLenum mode
)
802 GET_CURRENT_CONTEXT(ctx
);
804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
805 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_EQUATION
, 1 );
809 if (ctx
->ExecuteFlag
) {
810 (*ctx
->Exec
->BlendEquation
)( mode
);
815 static void save_BlendFunc( GLenum sfactor
, GLenum dfactor
)
817 GET_CURRENT_CONTEXT(ctx
);
819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
820 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_FUNC
, 2 );
825 if (ctx
->ExecuteFlag
) {
826 (*ctx
->Exec
->BlendFunc
)( sfactor
, dfactor
);
831 static void save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
832 GLenum sfactorA
, GLenum dfactorA
)
834 GET_CURRENT_CONTEXT(ctx
);
836 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
837 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4 );
844 if (ctx
->ExecuteFlag
) {
845 (*ctx
->Exec
->BlendFuncSeparateEXT
)( sfactorRGB
, dfactorRGB
,
851 static void save_BlendColor( GLfloat red
, GLfloat green
,
852 GLfloat blue
, GLfloat alpha
)
854 GET_CURRENT_CONTEXT(ctx
);
856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
857 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_COLOR
, 4 );
864 if (ctx
->ExecuteFlag
) {
865 (*ctx
->Exec
->BlendColor
)( red
, green
, blue
, alpha
);
870 void _mesa_save_CallList( GLuint list
)
872 GET_CURRENT_CONTEXT(ctx
);
874 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
876 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CALL_LIST
, 1 );
880 if (ctx
->ExecuteFlag
) {
881 (*ctx
->Exec
->CallList
)( list
);
886 void _mesa_save_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
888 GET_CURRENT_CONTEXT(ctx
);
890 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
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 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
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 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
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 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
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 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
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 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
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 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
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 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
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 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
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 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
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 target
== GL_PROXY_TEXTURE_CUBE_MAP_ARB
) {
1067 /* execute immediately */
1068 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1069 format
, type
, table
);
1072 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, table
,
1075 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1076 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE
, 6 );
1079 n
[2].e
= internalFormat
;
1088 if (ctx
->ExecuteFlag
) {
1089 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1090 format
, type
, table
);
1098 save_ColorTableParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1100 GET_CURRENT_CONTEXT(ctx
);
1103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
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_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1133 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6 );
1138 if (pname
== GL_COLOR_TABLE_SGI
||
1139 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1140 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
) {
1147 if (ctx
->ExecuteFlag
) {
1148 (*ctx
->Exec
->ColorTableParameteriv
)( target
, pname
, params
);
1154 static void save_ColorSubTable( GLenum target
, GLsizei start
, GLsizei count
,
1155 GLenum format
, GLenum type
,
1156 const GLvoid
*table
)
1158 GET_CURRENT_CONTEXT(ctx
);
1159 GLvoid
*image
= _mesa_unpack_image(count
, 1, 1, format
, type
, table
,
1162 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1163 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_SUB_TABLE
, 6 );
1175 if (ctx
->ExecuteFlag
) {
1176 (*ctx
->Exec
->ColorSubTable
)(target
, start
, count
, format
, type
, table
);
1182 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1183 GLint x
, GLint y
, GLsizei width
)
1185 GET_CURRENT_CONTEXT(ctx
);
1188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1189 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 6 );
1197 if (ctx
->ExecuteFlag
) {
1198 (*ctx
->Exec
->CopyColorSubTable
)(target
, start
, x
, y
, width
);
1204 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1205 GLint x
, GLint y
, GLsizei width
)
1207 GET_CURRENT_CONTEXT(ctx
);
1210 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1211 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_TABLE
, 6 );
1214 n
[2].e
= internalformat
;
1219 if (ctx
->ExecuteFlag
) {
1220 (*ctx
->Exec
->CopyColorTable
)(target
, internalformat
, x
, y
, width
);
1226 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1227 GLenum format
, GLenum type
, const GLvoid
*filter
)
1229 GET_CURRENT_CONTEXT(ctx
);
1230 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, filter
,
1233 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1234 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6 );
1237 n
[2].e
= internalFormat
;
1246 if (ctx
->ExecuteFlag
) {
1247 (*ctx
->Exec
->ConvolutionFilter1D
)( target
, internalFormat
, width
,
1248 format
, type
, filter
);
1254 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1255 GLsizei width
, GLsizei height
, GLenum format
,
1256 GLenum type
, const GLvoid
*filter
)
1258 GET_CURRENT_CONTEXT(ctx
);
1259 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
, filter
,
1262 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1263 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7 );
1266 n
[2].e
= internalFormat
;
1276 if (ctx
->ExecuteFlag
) {
1277 (*ctx
->Exec
->ConvolutionFilter2D
)( target
, internalFormat
, width
, height
,
1278 format
, type
, filter
);
1284 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1286 GET_CURRENT_CONTEXT(ctx
);
1288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1289 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3 );
1295 if (ctx
->ExecuteFlag
) {
1296 (*ctx
->Exec
->ConvolutionParameteri
)( target
, pname
, param
);
1302 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1304 GET_CURRENT_CONTEXT(ctx
);
1306 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1307 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6 );
1312 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1313 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1314 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1320 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1323 if (ctx
->ExecuteFlag
) {
1324 (*ctx
->Exec
->ConvolutionParameteriv
)( target
, pname
, params
);
1330 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1332 GET_CURRENT_CONTEXT(ctx
);
1334 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1335 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3 );
1341 if (ctx
->ExecuteFlag
) {
1342 (*ctx
->Exec
->ConvolutionParameterf
)( target
, pname
, param
);
1348 save_ConvolutionParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1350 GET_CURRENT_CONTEXT(ctx
);
1352 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1353 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6 );
1358 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1359 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1360 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1366 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1369 if (ctx
->ExecuteFlag
) {
1370 (*ctx
->Exec
->ConvolutionParameterfv
)( target
, pname
, params
);
1375 static void save_CopyPixels( GLint x
, GLint y
,
1376 GLsizei width
, GLsizei height
, GLenum type
)
1378 GET_CURRENT_CONTEXT(ctx
);
1380 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1381 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_PIXELS
, 5 );
1385 n
[3].i
= (GLint
) width
;
1386 n
[4].i
= (GLint
) height
;
1389 if (ctx
->ExecuteFlag
) {
1390 (*ctx
->Exec
->CopyPixels
)( x
, y
, width
, height
, type
);
1397 save_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
1398 GLint x
, GLint y
, GLsizei width
, GLint border
)
1400 GET_CURRENT_CONTEXT(ctx
);
1402 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1403 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7 );
1407 n
[3].e
= internalformat
;
1413 if (ctx
->ExecuteFlag
) {
1414 (*ctx
->Exec
->CopyTexImage1D
)( target
, level
, internalformat
,
1415 x
, y
, width
, border
);
1421 save_CopyTexImage2D( GLenum target
, GLint level
,
1422 GLenum internalformat
,
1423 GLint x
, GLint y
, GLsizei width
,
1424 GLsizei height
, GLint border
)
1426 GET_CURRENT_CONTEXT(ctx
);
1428 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1429 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8 );
1433 n
[3].e
= internalformat
;
1440 if (ctx
->ExecuteFlag
) {
1441 (*ctx
->Exec
->CopyTexImage2D
)( target
, level
, internalformat
,
1442 x
, y
, width
, height
, border
);
1449 save_CopyTexSubImage1D( GLenum target
, GLint level
,
1450 GLint xoffset
, GLint x
, GLint y
,
1453 GET_CURRENT_CONTEXT(ctx
);
1455 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1456 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6 );
1465 if (ctx
->ExecuteFlag
) {
1466 (*ctx
->Exec
->CopyTexSubImage1D
)( target
, level
, xoffset
, x
, y
, width
);
1472 save_CopyTexSubImage2D( GLenum target
, GLint level
,
1473 GLint xoffset
, GLint yoffset
,
1475 GLsizei width
, GLint height
)
1477 GET_CURRENT_CONTEXT(ctx
);
1479 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1480 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8 );
1491 if (ctx
->ExecuteFlag
) {
1492 (*ctx
->Exec
->CopyTexSubImage2D
)( target
, level
, xoffset
, yoffset
,
1493 x
, y
, width
, height
);
1499 save_CopyTexSubImage3D( GLenum target
, GLint level
,
1500 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1502 GLsizei width
, GLint height
)
1504 GET_CURRENT_CONTEXT(ctx
);
1506 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1507 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9 );
1519 if (ctx
->ExecuteFlag
) {
1520 (*ctx
->Exec
->CopyTexSubImage3D
)( target
, level
,
1521 xoffset
, yoffset
, zoffset
,
1522 x
, y
, width
, height
);
1527 static void save_CullFace( GLenum mode
)
1529 GET_CURRENT_CONTEXT(ctx
);
1531 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1532 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CULL_FACE
, 1 );
1536 if (ctx
->ExecuteFlag
) {
1537 (*ctx
->Exec
->CullFace
)( mode
);
1542 static void save_DepthFunc( GLenum func
)
1544 GET_CURRENT_CONTEXT(ctx
);
1546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1547 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_FUNC
, 1 );
1551 if (ctx
->ExecuteFlag
) {
1552 (*ctx
->Exec
->DepthFunc
)( func
);
1557 static void save_DepthMask( GLboolean mask
)
1559 GET_CURRENT_CONTEXT(ctx
);
1561 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1562 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_MASK
, 1 );
1566 if (ctx
->ExecuteFlag
) {
1567 (*ctx
->Exec
->DepthMask
)( mask
);
1572 static void save_DepthRange( GLclampd nearval
, GLclampd farval
)
1574 GET_CURRENT_CONTEXT(ctx
);
1576 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1577 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_RANGE
, 2 );
1579 n
[1].f
= (GLfloat
) nearval
;
1580 n
[2].f
= (GLfloat
) farval
;
1582 if (ctx
->ExecuteFlag
) {
1583 (*ctx
->Exec
->DepthRange
)( nearval
, farval
);
1588 static void save_Disable( GLenum cap
)
1590 GET_CURRENT_CONTEXT(ctx
);
1592 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1593 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DISABLE
, 1 );
1597 if (ctx
->ExecuteFlag
) {
1598 (*ctx
->Exec
->Disable
)( cap
);
1603 static void save_DrawBuffer( GLenum mode
)
1605 GET_CURRENT_CONTEXT(ctx
);
1607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1608 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_BUFFER
, 1 );
1612 if (ctx
->ExecuteFlag
) {
1613 (*ctx
->Exec
->DrawBuffer
)( mode
);
1618 static void save_DrawPixels( GLsizei width
, GLsizei height
,
1619 GLenum format
, GLenum type
,
1620 const GLvoid
*pixels
)
1622 GET_CURRENT_CONTEXT(ctx
);
1623 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
1624 pixels
, &ctx
->Unpack
);
1626 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1627 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_PIXELS
, 5 );
1638 if (ctx
->ExecuteFlag
) {
1639 (*ctx
->Exec
->DrawPixels
)( width
, height
, format
, type
, pixels
);
1645 static void save_Enable( GLenum cap
)
1647 GET_CURRENT_CONTEXT(ctx
);
1649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1650 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ENABLE
, 1 );
1654 if (ctx
->ExecuteFlag
) {
1655 (*ctx
->Exec
->Enable
)( cap
);
1661 void _mesa_save_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
1663 GET_CURRENT_CONTEXT(ctx
);
1665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1666 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH1
, 3 );
1672 if (ctx
->ExecuteFlag
) {
1673 (*ctx
->Exec
->EvalMesh1
)( mode
, i1
, i2
);
1678 void _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1680 GET_CURRENT_CONTEXT(ctx
);
1682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1683 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH2
, 5 );
1691 if (ctx
->ExecuteFlag
) {
1692 (*ctx
->Exec
->EvalMesh2
)( mode
, i1
, i2
, j1
, j2
);
1699 static void save_Fogfv( GLenum pname
, const GLfloat
*params
)
1701 GET_CURRENT_CONTEXT(ctx
);
1703 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1704 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FOG
, 5 );
1712 if (ctx
->ExecuteFlag
) {
1713 (*ctx
->Exec
->Fogfv
)( pname
, params
);
1718 static void save_Fogf( GLenum pname
, GLfloat param
)
1720 save_Fogfv(pname
, ¶m
);
1724 static void save_Fogiv(GLenum pname
, const GLint
*params
)
1729 case GL_FOG_DENSITY
:
1733 p
[0] = (GLfloat
) *params
;
1736 p
[0] = INT_TO_FLOAT( params
[0] );
1737 p
[1] = INT_TO_FLOAT( params
[1] );
1738 p
[2] = INT_TO_FLOAT( params
[2] );
1739 p
[3] = INT_TO_FLOAT( params
[3] );
1742 /* Error will be caught later in gl_Fogfv */
1745 save_Fogfv(pname
, p
);
1749 static void save_Fogi(GLenum pname
, GLint param
)
1751 save_Fogiv(pname
, ¶m
);
1755 static void save_FrontFace( GLenum mode
)
1757 GET_CURRENT_CONTEXT(ctx
);
1759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1760 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRONT_FACE
, 1 );
1764 if (ctx
->ExecuteFlag
) {
1765 (*ctx
->Exec
->FrontFace
)( mode
);
1770 static void save_Frustum( GLdouble left
, GLdouble right
,
1771 GLdouble bottom
, GLdouble top
,
1772 GLdouble nearval
, GLdouble farval
)
1774 GET_CURRENT_CONTEXT(ctx
);
1776 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1777 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRUSTUM
, 6 );
1786 if (ctx
->ExecuteFlag
) {
1787 (*ctx
->Exec
->Frustum
)( left
, right
, bottom
, top
, nearval
, farval
);
1792 static void save_Hint( GLenum target
, GLenum mode
)
1794 GET_CURRENT_CONTEXT(ctx
);
1796 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1797 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HINT
, 2 );
1802 if (ctx
->ExecuteFlag
) {
1803 (*ctx
->Exec
->Hint
)( target
, mode
);
1809 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
, GLboolean sink
)
1811 GET_CURRENT_CONTEXT(ctx
);
1814 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1815 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HISTOGRAM
, 4 );
1819 n
[3].e
= internalFormat
;
1822 if (ctx
->ExecuteFlag
) {
1823 (*ctx
->Exec
->Histogram
)( target
, width
, internalFormat
, sink
);
1828 static void save_IndexMask( GLuint mask
)
1830 GET_CURRENT_CONTEXT(ctx
);
1832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1833 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_INDEX_MASK
, 1 );
1837 if (ctx
->ExecuteFlag
) {
1838 (*ctx
->Exec
->IndexMask
)( mask
);
1843 static void save_InitNames( void )
1845 GET_CURRENT_CONTEXT(ctx
);
1846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1847 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_INIT_NAMES
, 0 );
1848 if (ctx
->ExecuteFlag
) {
1849 (*ctx
->Exec
->InitNames
)();
1854 static void save_Lightfv( GLenum light
, GLenum pname
, const GLfloat
*params
)
1856 GET_CURRENT_CONTEXT(ctx
);
1858 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1859 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT
, 6 );
1877 case GL_SPOT_DIRECTION
:
1880 case GL_SPOT_EXPONENT
:
1883 case GL_SPOT_CUTOFF
:
1886 case GL_CONSTANT_ATTENUATION
:
1889 case GL_LINEAR_ATTENUATION
:
1892 case GL_QUADRATIC_ATTENUATION
:
1898 for (i
= 0; i
< nParams
; i
++) {
1899 n
[3+i
].f
= params
[i
];
1902 if (ctx
->ExecuteFlag
) {
1903 (*ctx
->Exec
->Lightfv
)( light
, pname
, params
);
1908 static void save_Lightf( GLenum light
, GLenum pname
, GLfloat params
)
1910 save_Lightfv(light
, pname
, ¶ms
);
1914 static void save_Lightiv( GLenum light
, GLenum pname
, const GLint
*params
)
1921 fparam
[0] = INT_TO_FLOAT( params
[0] );
1922 fparam
[1] = INT_TO_FLOAT( params
[1] );
1923 fparam
[2] = INT_TO_FLOAT( params
[2] );
1924 fparam
[3] = INT_TO_FLOAT( params
[3] );
1927 fparam
[0] = (GLfloat
) params
[0];
1928 fparam
[1] = (GLfloat
) params
[1];
1929 fparam
[2] = (GLfloat
) params
[2];
1930 fparam
[3] = (GLfloat
) params
[3];
1932 case GL_SPOT_DIRECTION
:
1933 fparam
[0] = (GLfloat
) params
[0];
1934 fparam
[1] = (GLfloat
) params
[1];
1935 fparam
[2] = (GLfloat
) params
[2];
1937 case GL_SPOT_EXPONENT
:
1938 case GL_SPOT_CUTOFF
:
1939 case GL_CONSTANT_ATTENUATION
:
1940 case GL_LINEAR_ATTENUATION
:
1941 case GL_QUADRATIC_ATTENUATION
:
1942 fparam
[0] = (GLfloat
) params
[0];
1945 /* error will be caught later in gl_Lightfv */
1948 save_Lightfv( light
, pname
, fparam
);
1952 static void save_Lighti( GLenum light
, GLenum pname
, GLint param
)
1954 save_Lightiv( light
, pname
, ¶m
);
1958 static void save_LightModelfv( GLenum pname
, const GLfloat
*params
)
1960 GET_CURRENT_CONTEXT(ctx
);
1962 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1963 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT_MODEL
, 5 );
1971 if (ctx
->ExecuteFlag
) {
1972 (*ctx
->Exec
->LightModelfv
)( pname
, params
);
1977 static void save_LightModelf( GLenum pname
, GLfloat param
)
1979 save_LightModelfv(pname
, ¶m
);
1983 static void save_LightModeliv( GLenum pname
, const GLint
*params
)
1987 case GL_LIGHT_MODEL_AMBIENT
:
1988 fparam
[0] = INT_TO_FLOAT( params
[0] );
1989 fparam
[1] = INT_TO_FLOAT( params
[1] );
1990 fparam
[2] = INT_TO_FLOAT( params
[2] );
1991 fparam
[3] = INT_TO_FLOAT( params
[3] );
1993 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
1994 case GL_LIGHT_MODEL_TWO_SIDE
:
1995 case GL_LIGHT_MODEL_COLOR_CONTROL
:
1996 fparam
[0] = (GLfloat
) params
[0];
1999 /* Error will be caught later in gl_LightModelfv */
2002 save_LightModelfv(pname
, fparam
);
2006 static void save_LightModeli( GLenum pname
, GLint param
)
2008 save_LightModeliv(pname
, ¶m
);
2012 static void save_LineStipple( GLint factor
, GLushort pattern
)
2014 GET_CURRENT_CONTEXT(ctx
);
2016 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2017 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_STIPPLE
, 2 );
2022 if (ctx
->ExecuteFlag
) {
2023 (*ctx
->Exec
->LineStipple
)( factor
, pattern
);
2028 static void save_LineWidth( GLfloat width
)
2030 GET_CURRENT_CONTEXT(ctx
);
2032 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2033 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_WIDTH
, 1 );
2037 if (ctx
->ExecuteFlag
) {
2038 (*ctx
->Exec
->LineWidth
)( width
);
2043 static void save_ListBase( GLuint base
)
2045 GET_CURRENT_CONTEXT(ctx
);
2047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2048 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIST_BASE
, 1 );
2052 if (ctx
->ExecuteFlag
) {
2053 (*ctx
->Exec
->ListBase
)( base
);
2058 static void save_LoadIdentity( void )
2060 GET_CURRENT_CONTEXT(ctx
);
2061 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2062 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_IDENTITY
, 0 );
2063 if (ctx
->ExecuteFlag
) {
2064 (*ctx
->Exec
->LoadIdentity
)();
2069 static void save_LoadMatrixf( const GLfloat
*m
)
2071 GET_CURRENT_CONTEXT(ctx
);
2073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2074 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_MATRIX
, 16 );
2077 for (i
=0;i
<16;i
++) {
2081 if (ctx
->ExecuteFlag
) {
2082 (*ctx
->Exec
->LoadMatrixf
)( m
);
2087 static void save_LoadMatrixd( const GLdouble
*m
)
2091 for (i
= 0; i
< 16; i
++) {
2094 save_LoadMatrixf(f
);
2098 static void save_LoadName( GLuint name
)
2100 GET_CURRENT_CONTEXT(ctx
);
2102 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2103 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_NAME
, 1 );
2107 if (ctx
->ExecuteFlag
) {
2108 (*ctx
->Exec
->LoadName
)( name
);
2113 static void save_LogicOp( GLenum opcode
)
2115 GET_CURRENT_CONTEXT(ctx
);
2117 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2118 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOGIC_OP
, 1 );
2122 if (ctx
->ExecuteFlag
) {
2123 (*ctx
->Exec
->LogicOp
)( opcode
);
2128 static void save_Map1d( GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2129 GLint order
, const GLdouble
*points
)
2131 GET_CURRENT_CONTEXT(ctx
);
2133 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2134 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2136 GLfloat
*pnts
= _mesa_copy_map_points1d( target
, stride
, order
, points
);
2140 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2142 n
[6].data
= (void *) pnts
;
2144 if (ctx
->ExecuteFlag
) {
2145 (*ctx
->Exec
->Map1d
)( target
, u1
, u2
, stride
, order
, points
);
2149 static void save_Map1f( GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2150 GLint order
, const GLfloat
*points
)
2152 GET_CURRENT_CONTEXT(ctx
);
2154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2155 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2157 GLfloat
*pnts
= _mesa_copy_map_points1f( target
, stride
, order
, points
);
2161 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2163 n
[6].data
= (void *) pnts
;
2165 if (ctx
->ExecuteFlag
) {
2166 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, stride
, order
, points
);
2171 static void save_Map2d( GLenum target
,
2172 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2173 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2174 const GLdouble
*points
)
2176 GET_CURRENT_CONTEXT(ctx
);
2178 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2179 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2181 GLfloat
*pnts
= _mesa_copy_map_points2d( target
, ustride
, uorder
,
2182 vstride
, vorder
, points
);
2188 /* XXX verify these strides are correct */
2189 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2190 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2193 n
[10].data
= (void *) pnts
;
2195 if (ctx
->ExecuteFlag
) {
2196 (*ctx
->Exec
->Map2d
)( target
,
2197 u1
, u2
, ustride
, uorder
,
2198 v1
, v2
, vstride
, vorder
, points
);
2203 static void save_Map2f( GLenum target
,
2204 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2205 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2206 const GLfloat
*points
)
2208 GET_CURRENT_CONTEXT(ctx
);
2210 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2211 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2213 GLfloat
*pnts
= _mesa_copy_map_points2f( target
, ustride
, uorder
,
2214 vstride
, vorder
, points
);
2220 /* XXX verify these strides are correct */
2221 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2222 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2225 n
[10].data
= (void *) pnts
;
2227 if (ctx
->ExecuteFlag
) {
2228 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
2229 v1
, v2
, vstride
, vorder
, points
);
2234 static void save_MapGrid1f( GLint un
, GLfloat u1
, GLfloat u2
)
2236 GET_CURRENT_CONTEXT(ctx
);
2238 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2239 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID1
, 3 );
2245 if (ctx
->ExecuteFlag
) {
2246 (*ctx
->Exec
->MapGrid1f
)( un
, u1
, u2
);
2251 static void save_MapGrid1d( GLint un
, GLdouble u1
, GLdouble u2
)
2253 save_MapGrid1f(un
, u1
, u2
);
2257 static void save_MapGrid2f( GLint un
, GLfloat u1
, GLfloat u2
,
2258 GLint vn
, GLfloat v1
, GLfloat v2
)
2260 GET_CURRENT_CONTEXT(ctx
);
2262 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2263 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID2
, 6 );
2272 if (ctx
->ExecuteFlag
) {
2273 (*ctx
->Exec
->MapGrid2f
)( un
, u1
, u2
, vn
, v1
, v2
);
2279 static void save_MapGrid2d( GLint un
, GLdouble u1
, GLdouble u2
,
2280 GLint vn
, GLdouble v1
, GLdouble v2
)
2282 save_MapGrid2f(un
, u1
, u2
, vn
, v1
, v2
);
2286 static void save_MatrixMode( GLenum mode
)
2288 GET_CURRENT_CONTEXT(ctx
);
2290 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2291 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MATRIX_MODE
, 1 );
2295 if (ctx
->ExecuteFlag
) {
2296 (*ctx
->Exec
->MatrixMode
)( mode
);
2302 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2304 GET_CURRENT_CONTEXT(ctx
);
2307 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2308 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MIN_MAX
, 3 );
2311 n
[2].e
= internalFormat
;
2314 if (ctx
->ExecuteFlag
) {
2315 (*ctx
->Exec
->Minmax
)( target
, internalFormat
, sink
);
2320 static void save_MultMatrixf( const GLfloat
*m
)
2322 GET_CURRENT_CONTEXT(ctx
);
2324 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2325 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MULT_MATRIX
, 16 );
2328 for (i
=0;i
<16;i
++) {
2332 if (ctx
->ExecuteFlag
) {
2333 (*ctx
->Exec
->MultMatrixf
)( m
);
2338 static void save_MultMatrixd( const GLdouble
*m
)
2342 for (i
= 0; i
< 16; i
++) {
2345 save_MultMatrixf(f
);
2349 static void save_NewList( GLuint list
, GLenum mode
)
2351 GET_CURRENT_CONTEXT(ctx
);
2352 /* It's an error to call this function while building a display list */
2353 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
2360 static void save_Ortho( GLdouble left
, GLdouble right
,
2361 GLdouble bottom
, GLdouble top
,
2362 GLdouble nearval
, GLdouble farval
)
2364 GET_CURRENT_CONTEXT(ctx
);
2366 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2367 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ORTHO
, 6 );
2376 if (ctx
->ExecuteFlag
) {
2377 (*ctx
->Exec
->Ortho
)( left
, right
, bottom
, top
, nearval
, farval
);
2383 save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
2385 GET_CURRENT_CONTEXT(ctx
);
2387 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2388 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_MAP
, 3 );
2392 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
2393 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
2395 if (ctx
->ExecuteFlag
) {
2396 (*ctx
->Exec
->PixelMapfv
)( map
, mapsize
, values
);
2402 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2404 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2406 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2407 for (i
=0;i
<mapsize
;i
++) {
2408 fvalues
[i
] = (GLfloat
) values
[i
];
2412 for (i
=0;i
<mapsize
;i
++) {
2413 fvalues
[i
] = UINT_TO_FLOAT( values
[i
] );
2416 save_PixelMapfv(map
, mapsize
, fvalues
);
2421 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2423 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2425 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2426 for (i
=0;i
<mapsize
;i
++) {
2427 fvalues
[i
] = (GLfloat
) values
[i
];
2431 for (i
=0;i
<mapsize
;i
++) {
2432 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2435 save_PixelMapfv(map
, mapsize
, fvalues
);
2440 save_PixelTransferf( GLenum pname
, GLfloat param
)
2442 GET_CURRENT_CONTEXT(ctx
);
2444 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2445 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2450 if (ctx
->ExecuteFlag
) {
2451 (*ctx
->Exec
->PixelTransferf
)( pname
, param
);
2457 save_PixelTransferi( GLenum pname
, GLint param
)
2459 save_PixelTransferf( pname
, (GLfloat
) param
);
2464 save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2466 GET_CURRENT_CONTEXT(ctx
);
2468 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2469 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2474 if (ctx
->ExecuteFlag
) {
2475 (*ctx
->Exec
->PixelZoom
)( xfactor
, yfactor
);
2481 save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2483 GET_CURRENT_CONTEXT(ctx
);
2485 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2486 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2493 if (ctx
->ExecuteFlag
) {
2494 (*ctx
->Exec
->PointParameterfvEXT
)( pname
, params
);
2499 static void save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2501 save_PointParameterfvEXT(pname
, ¶m
);
2505 static void save_PointSize( GLfloat size
)
2507 GET_CURRENT_CONTEXT(ctx
);
2509 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2510 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_SIZE
, 1 );
2514 if (ctx
->ExecuteFlag
) {
2515 (*ctx
->Exec
->PointSize
)( size
);
2520 static void save_PolygonMode( GLenum face
, GLenum mode
)
2522 GET_CURRENT_CONTEXT(ctx
);
2524 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2525 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_MODE
, 2 );
2530 if (ctx
->ExecuteFlag
) {
2531 (*ctx
->Exec
->PolygonMode
)( face
, mode
);
2537 * Polygon stipple must have been upacked already!
2539 static void save_PolygonStipple( const GLubyte
*pattern
)
2541 GET_CURRENT_CONTEXT(ctx
);
2543 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2544 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2547 n
[1].data
= MALLOC( 32 * 4 );
2548 data
= n
[1].data
; /* This needed for Acorn compiler */
2549 MEMCPY( data
, pattern
, 32 * 4 );
2551 if (ctx
->ExecuteFlag
) {
2552 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) pattern
);
2557 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2559 GET_CURRENT_CONTEXT(ctx
);
2561 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2562 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2567 if (ctx
->ExecuteFlag
) {
2568 (*ctx
->Exec
->PolygonOffset
)( factor
, units
);
2573 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2575 GET_CURRENT_CONTEXT(ctx
);
2576 save_PolygonOffset(factor
, ctx
->DepthMaxF
* bias
);
2580 static void save_PopAttrib( void )
2582 GET_CURRENT_CONTEXT(ctx
);
2583 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2584 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_ATTRIB
, 0 );
2585 if (ctx
->ExecuteFlag
) {
2586 (*ctx
->Exec
->PopAttrib
)();
2591 static void save_PopMatrix( void )
2593 GET_CURRENT_CONTEXT(ctx
);
2594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2595 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_MATRIX
, 0 );
2596 if (ctx
->ExecuteFlag
) {
2597 (*ctx
->Exec
->PopMatrix
)();
2602 static void save_PopName( void )
2604 GET_CURRENT_CONTEXT(ctx
);
2605 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2606 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_NAME
, 0 );
2607 if (ctx
->ExecuteFlag
) {
2608 (*ctx
->Exec
->PopName
)();
2613 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2614 const GLclampf
*priorities
)
2616 GET_CURRENT_CONTEXT(ctx
);
2618 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2620 for (i
=0;i
<num
;i
++) {
2622 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2624 n
[1].ui
= textures
[i
];
2625 n
[2].f
= priorities
[i
];
2628 if (ctx
->ExecuteFlag
) {
2629 (*ctx
->Exec
->PrioritizeTextures
)( num
, textures
, priorities
);
2634 static void save_PushAttrib( GLbitfield mask
)
2636 GET_CURRENT_CONTEXT(ctx
);
2638 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2639 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2643 if (ctx
->ExecuteFlag
) {
2644 (*ctx
->Exec
->PushAttrib
)( mask
);
2649 static void save_PushMatrix( void )
2651 GET_CURRENT_CONTEXT(ctx
);
2652 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2653 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2654 if (ctx
->ExecuteFlag
) {
2655 (*ctx
->Exec
->PushMatrix
)();
2660 static void save_PushName( GLuint name
)
2662 GET_CURRENT_CONTEXT(ctx
);
2664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2665 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_NAME
, 1 );
2669 if (ctx
->ExecuteFlag
) {
2670 (*ctx
->Exec
->PushName
)( name
);
2675 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2677 GET_CURRENT_CONTEXT(ctx
);
2679 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2680 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RASTER_POS
, 4 );
2687 if (ctx
->ExecuteFlag
) {
2688 (*ctx
->Exec
->RasterPos4f
)( x
, y
, z
, w
);
2692 static void save_RasterPos2d(GLdouble x
, GLdouble y
)
2694 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2697 static void save_RasterPos2f(GLfloat x
, GLfloat y
)
2699 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2702 static void save_RasterPos2i(GLint x
, GLint y
)
2704 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2707 static void save_RasterPos2s(GLshort x
, GLshort y
)
2709 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2712 static void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2714 save_RasterPos4f(x
, y
, z
, 1.0F
);
2717 static void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2719 save_RasterPos4f(x
, y
, z
, 1.0F
);
2722 static void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2724 save_RasterPos4f(x
, y
, z
, 1.0F
);
2727 static void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2729 save_RasterPos4f(x
, y
, z
, 1.0F
);
2732 static void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2734 save_RasterPos4f(x
, y
, z
, w
);
2737 static void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2739 save_RasterPos4f(x
, y
, z
, w
);
2742 static void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2744 save_RasterPos4f(x
, y
, z
, w
);
2747 static void save_RasterPos2dv(const GLdouble
*v
)
2749 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2752 static void save_RasterPos2fv(const GLfloat
*v
)
2754 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2757 static void save_RasterPos2iv(const GLint
*v
)
2759 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2762 static void save_RasterPos2sv(const GLshort
*v
)
2764 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2767 static void save_RasterPos3dv(const GLdouble
*v
)
2769 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2772 static void save_RasterPos3fv(const GLfloat
*v
)
2774 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2777 static void save_RasterPos3iv(const GLint
*v
)
2779 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2782 static void save_RasterPos3sv(const GLshort
*v
)
2784 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2787 static void save_RasterPos4dv(const GLdouble
*v
)
2789 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2792 static void save_RasterPos4fv(const GLfloat
*v
)
2794 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2797 static void save_RasterPos4iv(const GLint
*v
)
2799 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2802 static void save_RasterPos4sv(const GLshort
*v
)
2804 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2808 static void save_PassThrough( GLfloat token
)
2810 GET_CURRENT_CONTEXT(ctx
);
2812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2813 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PASSTHROUGH
, 1 );
2817 if (ctx
->ExecuteFlag
) {
2818 (*ctx
->Exec
->PassThrough
)( token
);
2823 static void save_ReadBuffer( GLenum mode
)
2825 GET_CURRENT_CONTEXT(ctx
);
2827 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2828 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_READ_BUFFER
, 1 );
2832 if (ctx
->ExecuteFlag
) {
2833 (*ctx
->Exec
->ReadBuffer
)( mode
);
2839 save_ResetHistogram(GLenum target
)
2841 GET_CURRENT_CONTEXT(ctx
);
2843 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2844 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_HISTOGRAM
, 1 );
2848 if (ctx
->ExecuteFlag
) {
2849 (*ctx
->Exec
->ResetHistogram
)( target
);
2855 save_ResetMinmax(GLenum target
)
2857 GET_CURRENT_CONTEXT(ctx
);
2859 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2860 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_MIN_MAX
, 1 );
2864 if (ctx
->ExecuteFlag
) {
2865 (*ctx
->Exec
->ResetMinmax
)( target
);
2870 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2872 GET_CURRENT_CONTEXT(ctx
);
2874 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2875 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ROTATE
, 4 );
2882 if (ctx
->ExecuteFlag
) {
2883 (*ctx
->Exec
->Rotatef
)( angle
, x
, y
, z
);
2888 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2890 save_Rotatef(angle
, x
, y
, z
);
2894 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2896 GET_CURRENT_CONTEXT(ctx
);
2898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2899 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCALE
, 3 );
2905 if (ctx
->ExecuteFlag
) {
2906 (*ctx
->Exec
->Scalef
)( x
, y
, z
);
2911 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
2913 save_Scalef(x
, y
, z
);
2917 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
2919 GET_CURRENT_CONTEXT(ctx
);
2921 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2922 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCISSOR
, 4 );
2929 if (ctx
->ExecuteFlag
) {
2930 (*ctx
->Exec
->Scissor
)( x
, y
, width
, height
);
2935 static void save_ShadeModel( GLenum mode
)
2937 GET_CURRENT_CONTEXT(ctx
);
2939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2940 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SHADE_MODEL
, 1 );
2944 if (ctx
->ExecuteFlag
) {
2945 (*ctx
->Exec
->ShadeModel
)( mode
);
2950 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
2952 GET_CURRENT_CONTEXT(ctx
);
2954 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2955 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_FUNC
, 3 );
2961 if (ctx
->ExecuteFlag
) {
2962 (*ctx
->Exec
->StencilFunc
)( func
, ref
, mask
);
2967 static void save_StencilMask( GLuint mask
)
2969 GET_CURRENT_CONTEXT(ctx
);
2971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2972 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_MASK
, 1 );
2976 if (ctx
->ExecuteFlag
) {
2977 (*ctx
->Exec
->StencilMask
)( mask
);
2982 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
2984 GET_CURRENT_CONTEXT(ctx
);
2986 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2987 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_OP
, 3 );
2993 if (ctx
->ExecuteFlag
) {
2994 (*ctx
->Exec
->StencilOp
)( fail
, zfail
, zpass
);
2999 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
3001 GET_CURRENT_CONTEXT(ctx
);
3003 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3004 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXENV
, 6 );
3013 if (ctx
->ExecuteFlag
) {
3014 (*ctx
->Exec
->TexEnvfv
)( target
, pname
, params
);
3019 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
3021 save_TexEnvfv( target
, pname
, ¶m
);
3025 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
3028 p
[0] = (GLfloat
) param
;
3029 p
[1] = p
[2] = p
[3] = 0.0;
3030 save_TexEnvfv( target
, pname
, p
);
3034 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
3037 p
[0] = INT_TO_FLOAT( param
[0] );
3038 p
[1] = INT_TO_FLOAT( param
[1] );
3039 p
[2] = INT_TO_FLOAT( param
[2] );
3040 p
[3] = INT_TO_FLOAT( param
[3] );
3041 save_TexEnvfv( target
, pname
, p
);
3045 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
3047 GET_CURRENT_CONTEXT(ctx
);
3049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3050 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXGEN
, 6 );
3059 if (ctx
->ExecuteFlag
) {
3060 (*ctx
->Exec
->TexGenfv
)( coord
, pname
, params
);
3065 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3072 save_TexGenfv(coord
, pname
, p
);
3076 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3078 GLfloat p
= (GLfloat
) param
;
3079 save_TexGenfv( coord
, pname
, &p
);
3083 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3090 save_TexGenfv( coord
, pname
, p
);
3094 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
3096 save_TexGenfv(coord
, pname
, ¶m
);
3100 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
3102 save_TexGeniv( coord
, pname
, ¶m
);
3106 static void save_TexParameterfv( GLenum target
,
3107 GLenum pname
, const GLfloat
*params
)
3109 GET_CURRENT_CONTEXT(ctx
);
3111 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3112 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXPARAMETER
, 6 );
3121 if (ctx
->ExecuteFlag
) {
3122 (*ctx
->Exec
->TexParameterfv
)( target
, pname
, params
);
3127 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
3129 save_TexParameterfv(target
, pname
, ¶m
);
3133 static void save_TexParameteri( GLenum target
, GLenum pname
, const GLint param
)
3136 fparam
[0] = (GLfloat
) param
;
3137 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3138 save_TexParameterfv(target
, pname
, fparam
);
3142 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
3145 fparam
[0] = (GLfloat
) params
[0];
3146 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3147 save_TexParameterfv(target
, pname
, fparam
);
3151 static void save_TexImage1D( GLenum target
,
3152 GLint level
, GLint components
,
3153 GLsizei width
, GLint border
,
3154 GLenum format
, GLenum type
,
3155 const GLvoid
*pixels
)
3157 GET_CURRENT_CONTEXT(ctx
);
3158 if (target
== GL_PROXY_TEXTURE_1D
) {
3159 /* don't compile, execute immediately */
3160 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3161 border
, format
, type
, pixels
);
3164 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3165 pixels
, &ctx
->Unpack
);
3167 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3168 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
3172 n
[3].i
= components
;
3173 n
[4].i
= (GLint
) width
;
3182 if (ctx
->ExecuteFlag
) {
3183 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3184 border
, format
, type
, pixels
);
3190 static void save_TexImage2D( GLenum target
,
3191 GLint level
, GLint components
,
3192 GLsizei width
, GLsizei height
, GLint border
,
3193 GLenum format
, GLenum type
,
3194 const GLvoid
*pixels
)
3196 GET_CURRENT_CONTEXT(ctx
);
3197 if (target
== GL_PROXY_TEXTURE_2D
) {
3198 /* don't compile, execute immediately */
3199 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3200 height
, border
, format
, type
, pixels
);
3203 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3204 pixels
, &ctx
->Unpack
);
3206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3207 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
3211 n
[3].i
= components
;
3212 n
[4].i
= (GLint
) width
;
3213 n
[5].i
= (GLint
) height
;
3222 if (ctx
->ExecuteFlag
) {
3223 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3224 height
, border
, format
, type
, pixels
);
3230 static void save_TexImage3D( GLenum target
,
3231 GLint level
, GLint internalFormat
,
3232 GLsizei width
, GLsizei height
, GLsizei depth
,
3234 GLenum format
, GLenum type
,
3235 const GLvoid
*pixels
)
3237 GET_CURRENT_CONTEXT(ctx
);
3238 if (target
== GL_PROXY_TEXTURE_3D
) {
3239 /* don't compile, execute immediately */
3240 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3241 height
, depth
, border
, format
, type
, pixels
);
3245 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3246 pixels
, &ctx
->Unpack
);
3247 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3248 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
3252 n
[3].i
= internalFormat
;
3253 n
[4].i
= (GLint
) width
;
3254 n
[5].i
= (GLint
) height
;
3255 n
[6].i
= (GLint
) depth
;
3264 if (ctx
->ExecuteFlag
) {
3265 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3266 height
, depth
, border
, format
, type
, pixels
);
3272 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
3273 GLsizei width
, GLenum format
, GLenum type
,
3274 const GLvoid
*pixels
)
3276 GET_CURRENT_CONTEXT(ctx
);
3278 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3279 pixels
, &ctx
->Unpack
);
3280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3281 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
3286 n
[4].i
= (GLint
) width
;
3294 if (ctx
->ExecuteFlag
) {
3295 (*ctx
->Exec
->TexSubImage1D
)( target
, level
, xoffset
, width
,
3296 format
, type
, pixels
);
3301 static void save_TexSubImage2D( GLenum target
, GLint level
,
3302 GLint xoffset
, GLint yoffset
,
3303 GLsizei width
, GLsizei height
,
3304 GLenum format
, GLenum type
,
3305 const GLvoid
*pixels
)
3307 GET_CURRENT_CONTEXT(ctx
);
3309 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3310 pixels
, &ctx
->Unpack
);
3311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3312 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
3318 n
[5].i
= (GLint
) width
;
3319 n
[6].i
= (GLint
) height
;
3327 if (ctx
->ExecuteFlag
) {
3328 (*ctx
->Exec
->TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
3329 width
, height
, format
, type
, pixels
);
3334 static void save_TexSubImage3D( GLenum target
, GLint level
,
3335 GLint xoffset
, GLint yoffset
,GLint zoffset
,
3336 GLsizei width
, GLsizei height
, GLsizei depth
,
3337 GLenum format
, GLenum type
,
3338 const GLvoid
*pixels
)
3340 GET_CURRENT_CONTEXT(ctx
);
3342 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3343 pixels
, &ctx
->Unpack
);
3344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3345 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
3352 n
[6].i
= (GLint
) width
;
3353 n
[7].i
= (GLint
) height
;
3354 n
[8].i
= (GLint
) depth
;
3362 if (ctx
->ExecuteFlag
) {
3363 (*ctx
->Exec
->TexSubImage3D
)( target
, level
,
3364 xoffset
, yoffset
, zoffset
,
3365 width
, height
, depth
, format
, type
, pixels
);
3370 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
3372 GET_CURRENT_CONTEXT(ctx
);
3374 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3375 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRANSLATE
, 3 );
3381 if (ctx
->ExecuteFlag
) {
3382 (*ctx
->Exec
->Translatef
)( x
, y
, z
);
3387 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3389 save_Translatef(x
, y
, z
);
3394 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3396 GET_CURRENT_CONTEXT(ctx
);
3398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3399 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_VIEWPORT
, 4 );
3403 n
[3].i
= (GLint
) width
;
3404 n
[4].i
= (GLint
) height
;
3406 if (ctx
->ExecuteFlag
) {
3407 (*ctx
->Exec
->Viewport
)( x
, y
, width
, height
);
3412 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3414 GET_CURRENT_CONTEXT(ctx
);
3416 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3417 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_WINDOW_POS
, 4 );
3424 if (ctx
->ExecuteFlag
) {
3425 (*ctx
->Exec
->WindowPos4fMESA
)( x
, y
, z
, w
);
3429 static void save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3431 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3434 static void save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3436 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3439 static void save_WindowPos2iMESA(GLint x
, GLint y
)
3441 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3444 static void save_WindowPos2sMESA(GLshort x
, GLshort y
)
3446 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3449 static void save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3451 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3454 static void save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3456 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3459 static void save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3461 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3464 static void save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3466 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3469 static void save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3471 save_WindowPos4fMESA(x
, y
, z
, w
);
3474 static void save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3476 save_WindowPos4fMESA(x
, y
, z
, w
);
3479 static void save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3481 save_WindowPos4fMESA(x
, y
, z
, w
);
3484 static void save_WindowPos2dvMESA(const GLdouble
*v
)
3486 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3489 static void save_WindowPos2fvMESA(const GLfloat
*v
)
3491 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3494 static void save_WindowPos2ivMESA(const GLint
*v
)
3496 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3499 static void save_WindowPos2svMESA(const GLshort
*v
)
3501 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3504 static void save_WindowPos3dvMESA(const GLdouble
*v
)
3506 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3509 static void save_WindowPos3fvMESA(const GLfloat
*v
)
3511 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3514 static void save_WindowPos3ivMESA(const GLint
*v
)
3516 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3519 static void save_WindowPos3svMESA(const GLshort
*v
)
3521 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3524 static void save_WindowPos4dvMESA(const GLdouble
*v
)
3526 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3529 static void save_WindowPos4fvMESA(const GLfloat
*v
)
3531 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3534 static void save_WindowPos4ivMESA(const GLint
*v
)
3536 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3539 static void save_WindowPos4svMESA(const GLshort
*v
)
3541 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3546 /* GL_ARB_multitexture */
3547 static void save_ActiveTextureARB( GLenum target
)
3549 GET_CURRENT_CONTEXT(ctx
);
3551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3552 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3556 if (ctx
->ExecuteFlag
) {
3557 (*ctx
->Exec
->ActiveTextureARB
)( target
);
3562 /* GL_ARB_multitexture */
3563 static void save_ClientActiveTextureARB( GLenum target
)
3565 GET_CURRENT_CONTEXT(ctx
);
3567 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3568 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLIENT_ACTIVE_TEXTURE
, 1 );
3572 if (ctx
->ExecuteFlag
) {
3573 (*ctx
->Exec
->ClientActiveTextureARB
)( target
);
3579 /* GL_ARB_transpose_matrix */
3581 static void save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3584 _math_transposefd(tm
, m
);
3585 save_LoadMatrixf(tm
);
3589 static void save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3592 _math_transposef(tm
, m
);
3593 save_LoadMatrixf(tm
);
3598 save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3601 _math_transposefd(tm
, m
);
3602 save_MultMatrixf(tm
);
3607 save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3610 _math_transposef(tm
, m
);
3611 save_MultMatrixf(tm
);
3616 save_PixelTexGenSGIX(GLenum mode
)
3618 GET_CURRENT_CONTEXT(ctx
);
3620 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3621 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_SGIX
, 1 );
3625 if (ctx
->ExecuteFlag
) {
3626 (*ctx
->Exec
->PixelTexGenSGIX
)( mode
);
3631 /* GL_ARB_texture_compression */
3633 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3634 GLenum internalFormat
, GLsizei width
,
3635 GLint border
, GLsizei imageSize
,
3638 GET_CURRENT_CONTEXT(ctx
);
3639 if (target
== GL_PROXY_TEXTURE_1D
) {
3640 /* don't compile, execute immediately */
3641 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3642 width
, border
, imageSize
, data
);
3647 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3648 /* make copy of image */
3649 image
= MALLOC(imageSize
);
3651 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3654 MEMCPY(image
, data
, imageSize
);
3655 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 8 );
3659 n
[3].e
= internalFormat
;
3660 n
[4].i
= (GLint
) width
;
3668 if (ctx
->ExecuteFlag
) {
3669 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3670 width
, border
, imageSize
, data
);
3677 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
3678 GLenum internalFormat
, GLsizei width
,
3679 GLsizei height
, GLint border
, GLsizei imageSize
,
3682 GET_CURRENT_CONTEXT(ctx
);
3683 if (target
== GL_PROXY_TEXTURE_2D
) {
3684 /* don't compile, execute immediately */
3685 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3686 width
, height
, border
, imageSize
, data
);
3691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3692 /* make copy of image */
3693 image
= MALLOC(imageSize
);
3695 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
3698 MEMCPY(image
, data
, imageSize
);
3699 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 9 );
3703 n
[3].e
= internalFormat
;
3704 n
[4].i
= (GLint
) width
;
3705 n
[5].i
= (GLint
) height
;
3713 if (ctx
->ExecuteFlag
) {
3714 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3715 width
, height
, border
, imageSize
, data
);
3722 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
3723 GLenum internalFormat
, GLsizei width
,
3724 GLsizei height
, GLsizei depth
, GLint border
,
3725 GLsizei imageSize
, const GLvoid
*data
)
3727 GET_CURRENT_CONTEXT(ctx
);
3728 if (target
== GL_PROXY_TEXTURE_3D
) {
3729 /* don't compile, execute immediately */
3730 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3731 width
, height
, depth
, border
, imageSize
, data
);
3736 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3737 /* make copy of image */
3738 image
= MALLOC(imageSize
);
3740 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
3743 MEMCPY(image
, data
, imageSize
);
3744 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 10 );
3748 n
[3].e
= internalFormat
;
3749 n
[4].i
= (GLint
) width
;
3750 n
[5].i
= (GLint
) height
;
3751 n
[6].i
= (GLint
) depth
;
3759 if (ctx
->ExecuteFlag
) {
3760 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3761 width
, height
, depth
, border
, imageSize
, data
);
3768 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
3769 GLsizei width
, GLenum format
,
3770 GLsizei imageSize
, const GLvoid
*data
)
3775 GET_CURRENT_CONTEXT(ctx
);
3776 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3778 /* make copy of image */
3779 image
= MALLOC(imageSize
);
3781 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
3784 MEMCPY(image
, data
, imageSize
);
3785 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 8 );
3790 n
[4].i
= (GLint
) width
;
3798 if (ctx
->ExecuteFlag
) {
3799 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(target
, level
, xoffset
,
3800 width
, format
, imageSize
, data
);
3806 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
3807 GLint yoffset
, GLsizei width
, GLsizei height
,
3808 GLenum format
, GLsizei imageSize
,
3814 GET_CURRENT_CONTEXT(ctx
);
3815 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3817 /* make copy of image */
3818 image
= MALLOC(imageSize
);
3820 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
3823 MEMCPY(image
, data
, imageSize
);
3824 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 10 );
3830 n
[5].i
= (GLint
) width
;
3831 n
[6].i
= (GLint
) height
;
3839 if (ctx
->ExecuteFlag
) {
3840 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(target
, level
, xoffset
, yoffset
,
3841 width
, height
, format
, imageSize
, data
);
3847 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
3848 GLint yoffset
, GLint zoffset
, GLsizei width
,
3849 GLsizei height
, GLsizei depth
, GLenum format
,
3850 GLsizei imageSize
, const GLvoid
*data
)
3855 GET_CURRENT_CONTEXT(ctx
);
3856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3858 /* make copy of image */
3859 image
= MALLOC(imageSize
);
3861 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
3864 MEMCPY(image
, data
, imageSize
);
3865 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 12 );
3872 n
[6].i
= (GLint
) width
;
3873 n
[7].i
= (GLint
) height
;
3874 n
[8].i
= (GLint
) depth
;
3876 n
[10].i
= imageSize
;
3882 if (ctx
->ExecuteFlag
) {
3883 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(target
, level
, xoffset
, yoffset
,
3884 zoffset
, width
, height
, depth
, format
, imageSize
, data
);
3889 /* GL_SGIS_pixel_texture */
3892 save_PixelTexGenParameteriSGIS(GLenum target
, GLint value
)
3894 GET_CURRENT_CONTEXT(ctx
);
3896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3897 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
, 2 );
3902 if (ctx
->ExecuteFlag
) {
3903 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( target
, value
);
3909 save_PixelTexGenParameterfSGIS(GLenum target
, GLfloat value
)
3911 save_PixelTexGenParameteriSGIS(target
, (GLint
) value
);
3916 save_PixelTexGenParameterivSGIS(GLenum target
, const GLint
*value
)
3918 save_PixelTexGenParameteriSGIS(target
, *value
);
3923 save_PixelTexGenParameterfvSGIS(GLenum target
, const GLfloat
*value
)
3925 save_PixelTexGenParameteriSGIS(target
, (GLint
) *value
);
3929 /* KW: Compile commands
3931 * Will appear in the list before the vertex buffer containing the
3932 * command that provoked the error. I don't see this as a problem.
3935 _mesa_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
3938 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ERROR
, 2 );
3941 n
[2].data
= (void *) s
;
3943 /* execute already done */
3948 islist(GLcontext
*ctx
, GLuint list
)
3950 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
3960 /**********************************************************************/
3961 /* Display list execution */
3962 /**********************************************************************/
3966 * Execute a display list. Note that the ListBase offset must have already
3967 * been added before calling this function. I.e. the list argument is
3968 * the absolute list number, not relative to ListBase.
3969 * Input: list - display list number
3972 execute_list( GLcontext
*ctx
, GLuint list
)
3977 if (!islist(ctx
,list
))
3980 if (ctx
->Driver
.BeginCallList
)
3981 ctx
->Driver
.BeginCallList( ctx
, list
);
3983 /* fprintf(stderr, "execute list %d\n", list); */
3984 /* mesa_print_display_list( list ); */
3988 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
3992 OpCode opcode
= n
[0].opcode
;
3993 int i
= (int)n
[0].opcode
- (int)OPCODE_DRV_0
;
3995 if (i
>= 0 && i
< ctx
->listext
.nr_opcodes
) {
3996 ctx
->listext
.opcode
[i
].execute(ctx
, &n
[1]);
3997 n
+= ctx
->listext
.opcode
[i
].size
;
4002 _mesa_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
4005 (*ctx
->Exec
->Accum
)( n
[1].e
, n
[2].f
);
4007 case OPCODE_ALPHA_FUNC
:
4008 (*ctx
->Exec
->AlphaFunc
)( n
[1].e
, n
[2].f
);
4010 case OPCODE_BIND_TEXTURE
:
4011 (*ctx
->Exec
->BindTexture
)( n
[1].e
, n
[2].ui
);
4015 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4016 ctx
->Unpack
= _mesa_native_packing
;
4017 (*ctx
->Exec
->Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
4018 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (const GLubyte
*) n
[7].data
);
4019 ctx
->Unpack
= save
; /* restore */
4022 case OPCODE_BLEND_COLOR
:
4023 (*ctx
->Exec
->BlendColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4025 case OPCODE_BLEND_EQUATION
:
4026 (*ctx
->Exec
->BlendEquation
)( n
[1].e
);
4028 case OPCODE_BLEND_FUNC
:
4029 (*ctx
->Exec
->BlendFunc
)( n
[1].e
, n
[2].e
);
4031 case OPCODE_BLEND_FUNC_SEPARATE
:
4032 (*ctx
->Exec
->BlendFuncSeparateEXT
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
4034 case OPCODE_CALL_LIST
:
4035 /* Generated by glCallList(), don't add ListBase */
4036 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4037 execute_list( ctx
, n
[1].ui
);
4040 case OPCODE_CALL_LIST_OFFSET
:
4041 /* Generated by glCallLists() so we must add ListBase */
4042 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4043 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
4047 (*ctx
->Exec
->Clear
)( n
[1].bf
);
4049 case OPCODE_CLEAR_COLOR
:
4050 (*ctx
->Exec
->ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4052 case OPCODE_CLEAR_ACCUM
:
4053 (*ctx
->Exec
->ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4055 case OPCODE_CLEAR_DEPTH
:
4056 (*ctx
->Exec
->ClearDepth
)( (GLclampd
) n
[1].f
);
4058 case OPCODE_CLEAR_INDEX
:
4059 (*ctx
->Exec
->ClearIndex
)( n
[1].ui
);
4061 case OPCODE_CLEAR_STENCIL
:
4062 (*ctx
->Exec
->ClearStencil
)( n
[1].i
);
4064 case OPCODE_CLIP_PLANE
:
4071 (*ctx
->Exec
->ClipPlane
)( n
[1].e
, eq
);
4074 case OPCODE_COLOR_MASK
:
4075 (*ctx
->Exec
->ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
4077 case OPCODE_COLOR_MATERIAL
:
4078 (*ctx
->Exec
->ColorMaterial
)( n
[1].e
, n
[2].e
);
4080 case OPCODE_COLOR_TABLE
:
4082 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4083 ctx
->Unpack
= _mesa_native_packing
;
4084 (*ctx
->Exec
->ColorTable
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
4085 n
[5].e
, n
[6].data
);
4086 ctx
->Unpack
= save
; /* restore */
4089 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
4096 (*ctx
->Exec
->ColorTableParameterfv
)( n
[1].e
, n
[2].e
, params
);
4099 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
4106 (*ctx
->Exec
->ColorTableParameteriv
)( n
[1].e
, n
[2].e
, params
);
4109 case OPCODE_COLOR_SUB_TABLE
:
4111 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4112 ctx
->Unpack
= _mesa_native_packing
;
4113 (*ctx
->Exec
->ColorSubTable
)( n
[1].e
, n
[2].i
, n
[3].i
,
4114 n
[4].e
, n
[5].e
, n
[6].data
);
4115 ctx
->Unpack
= save
; /* restore */
4118 case OPCODE_CONVOLUTION_FILTER_1D
:
4120 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4121 ctx
->Unpack
= _mesa_native_packing
;
4122 (*ctx
->Exec
->ConvolutionFilter1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4123 n
[4].e
, n
[5].e
, n
[6].data
);
4124 ctx
->Unpack
= save
; /* restore */
4127 case OPCODE_CONVOLUTION_FILTER_2D
:
4129 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4130 ctx
->Unpack
= _mesa_native_packing
;
4131 (*ctx
->Exec
->ConvolutionFilter2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4132 n
[4].i
, n
[5].e
, n
[6].e
, n
[7].data
);
4133 ctx
->Unpack
= save
; /* restore */
4136 case OPCODE_CONVOLUTION_PARAMETER_I
:
4137 (*ctx
->Exec
->ConvolutionParameteri
)( n
[1].e
, n
[2].e
, n
[3].i
);
4139 case OPCODE_CONVOLUTION_PARAMETER_IV
:
4146 (*ctx
->Exec
->ConvolutionParameteriv
)( n
[1].e
, n
[2].e
, params
);
4149 case OPCODE_CONVOLUTION_PARAMETER_F
:
4150 (*ctx
->Exec
->ConvolutionParameterf
)( n
[1].e
, n
[2].e
, n
[3].f
);
4152 case OPCODE_CONVOLUTION_PARAMETER_FV
:
4159 (*ctx
->Exec
->ConvolutionParameterfv
)( n
[1].e
, n
[2].e
, params
);
4162 case OPCODE_COPY_COLOR_SUB_TABLE
:
4163 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4164 n
[3].i
, n
[4].i
, n
[5].i
);
4166 case OPCODE_COPY_COLOR_TABLE
:
4167 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4168 n
[3].i
, n
[4].i
, n
[5].i
);
4170 case OPCODE_COPY_PIXELS
:
4171 (*ctx
->Exec
->CopyPixels
)( n
[1].i
, n
[2].i
,
4172 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
4174 case OPCODE_COPY_TEX_IMAGE1D
:
4175 (*ctx
->Exec
->CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4176 n
[5].i
, n
[6].i
, n
[7].i
);
4178 case OPCODE_COPY_TEX_IMAGE2D
:
4179 (*ctx
->Exec
->CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4180 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4182 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
4183 (*ctx
->Exec
->CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4184 n
[4].i
, n
[5].i
, n
[6].i
);
4186 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
4187 (*ctx
->Exec
->CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4188 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4190 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
4191 (*ctx
->Exec
->CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4192 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
4194 case OPCODE_CULL_FACE
:
4195 (*ctx
->Exec
->CullFace
)( n
[1].e
);
4197 case OPCODE_DEPTH_FUNC
:
4198 (*ctx
->Exec
->DepthFunc
)( n
[1].e
);
4200 case OPCODE_DEPTH_MASK
:
4201 (*ctx
->Exec
->DepthMask
)( n
[1].b
);
4203 case OPCODE_DEPTH_RANGE
:
4204 (*ctx
->Exec
->DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
4206 case OPCODE_DISABLE
:
4207 (*ctx
->Exec
->Disable
)( n
[1].e
);
4209 case OPCODE_DRAW_BUFFER
:
4210 (*ctx
->Exec
->DrawBuffer
)( n
[1].e
);
4212 case OPCODE_DRAW_PIXELS
:
4214 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4215 ctx
->Unpack
= _mesa_native_packing
;
4216 (*ctx
->Exec
->DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
4218 ctx
->Unpack
= save
; /* restore */
4222 (*ctx
->Exec
->Enable
)( n
[1].e
);
4224 case OPCODE_EVALMESH1
:
4225 (*ctx
->Exec
->EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
4227 case OPCODE_EVALMESH2
:
4228 (*ctx
->Exec
->EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
4237 (*ctx
->Exec
->Fogfv
)( n
[1].e
, p
);
4240 case OPCODE_FRONT_FACE
:
4241 (*ctx
->Exec
->FrontFace
)( n
[1].e
);
4243 case OPCODE_FRUSTUM
:
4244 (*ctx
->Exec
->Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4247 (*ctx
->Exec
->Hint
)( n
[1].e
, n
[2].e
);
4249 case OPCODE_HISTOGRAM
:
4250 (*ctx
->Exec
->Histogram
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
);
4252 case OPCODE_INDEX_MASK
:
4253 (*ctx
->Exec
->IndexMask
)( n
[1].ui
);
4255 case OPCODE_INIT_NAMES
:
4256 (*ctx
->Exec
->InitNames
)();
4265 (*ctx
->Exec
->Lightfv
)( n
[1].e
, n
[2].e
, p
);
4268 case OPCODE_LIGHT_MODEL
:
4275 (*ctx
->Exec
->LightModelfv
)( n
[1].e
, p
);
4278 case OPCODE_LINE_STIPPLE
:
4279 (*ctx
->Exec
->LineStipple
)( n
[1].i
, n
[2].us
);
4281 case OPCODE_LINE_WIDTH
:
4282 (*ctx
->Exec
->LineWidth
)( n
[1].f
);
4284 case OPCODE_LIST_BASE
:
4285 (*ctx
->Exec
->ListBase
)( n
[1].ui
);
4287 case OPCODE_LOAD_IDENTITY
:
4288 (*ctx
->Exec
->LoadIdentity
)();
4290 case OPCODE_LOAD_MATRIX
:
4291 if (sizeof(Node
)==sizeof(GLfloat
)) {
4292 (*ctx
->Exec
->LoadMatrixf
)( &n
[1].f
);
4297 for (i
=0;i
<16;i
++) {
4300 (*ctx
->Exec
->LoadMatrixf
)( m
);
4303 case OPCODE_LOAD_NAME
:
4304 (*ctx
->Exec
->LoadName
)( n
[1].ui
);
4306 case OPCODE_LOGIC_OP
:
4307 (*ctx
->Exec
->LogicOp
)( n
[1].e
);
4311 GLenum target
= n
[1].e
;
4312 GLint ustride
= _mesa_evaluator_components(target
);
4313 GLint uorder
= n
[5].i
;
4314 GLfloat u1
= n
[2].f
;
4315 GLfloat u2
= n
[3].f
;
4316 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, ustride
, uorder
,
4317 (GLfloat
*) n
[6].data
);
4322 GLenum target
= n
[1].e
;
4323 GLfloat u1
= n
[2].f
;
4324 GLfloat u2
= n
[3].f
;
4325 GLfloat v1
= n
[4].f
;
4326 GLfloat v2
= n
[5].f
;
4327 GLint ustride
= n
[6].i
;
4328 GLint vstride
= n
[7].i
;
4329 GLint uorder
= n
[8].i
;
4330 GLint vorder
= n
[9].i
;
4331 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
4332 v1
, v2
, vstride
, vorder
,
4333 (GLfloat
*) n
[10].data
);
4336 case OPCODE_MAPGRID1
:
4337 (*ctx
->Exec
->MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
4339 case OPCODE_MAPGRID2
:
4340 (*ctx
->Exec
->MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
4342 case OPCODE_MATRIX_MODE
:
4343 (*ctx
->Exec
->MatrixMode
)( n
[1].e
);
4345 case OPCODE_MIN_MAX
:
4346 (*ctx
->Exec
->Minmax
)(n
[1].e
, n
[2].e
, n
[3].b
);
4348 case OPCODE_MULT_MATRIX
:
4349 if (sizeof(Node
)==sizeof(GLfloat
)) {
4350 (*ctx
->Exec
->MultMatrixf
)( &n
[1].f
);
4355 for (i
=0;i
<16;i
++) {
4358 (*ctx
->Exec
->MultMatrixf
)( m
);
4362 (*ctx
->Exec
->Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4364 case OPCODE_PASSTHROUGH
:
4365 (*ctx
->Exec
->PassThrough
)( n
[1].f
);
4367 case OPCODE_PIXEL_MAP
:
4368 (*ctx
->Exec
->PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
4370 case OPCODE_PIXEL_TRANSFER
:
4371 (*ctx
->Exec
->PixelTransferf
)( n
[1].e
, n
[2].f
);
4373 case OPCODE_PIXEL_ZOOM
:
4374 (*ctx
->Exec
->PixelZoom
)( n
[1].f
, n
[2].f
);
4376 case OPCODE_POINT_SIZE
:
4377 (*ctx
->Exec
->PointSize
)( n
[1].f
);
4379 case OPCODE_POINT_PARAMETERS
:
4385 (*ctx
->Exec
->PointParameterfvEXT
)( n
[1].e
, params
);
4388 case OPCODE_POLYGON_MODE
:
4389 (*ctx
->Exec
->PolygonMode
)( n
[1].e
, n
[2].e
);
4391 case OPCODE_POLYGON_STIPPLE
:
4392 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) n
[1].data
);
4394 case OPCODE_POLYGON_OFFSET
:
4395 (*ctx
->Exec
->PolygonOffset
)( n
[1].f
, n
[2].f
);
4397 case OPCODE_POP_ATTRIB
:
4398 (*ctx
->Exec
->PopAttrib
)();
4400 case OPCODE_POP_MATRIX
:
4401 (*ctx
->Exec
->PopMatrix
)();
4403 case OPCODE_POP_NAME
:
4404 (*ctx
->Exec
->PopName
)();
4406 case OPCODE_PRIORITIZE_TEXTURE
:
4407 (*ctx
->Exec
->PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
4409 case OPCODE_PUSH_ATTRIB
:
4410 (*ctx
->Exec
->PushAttrib
)( n
[1].bf
);
4412 case OPCODE_PUSH_MATRIX
:
4413 (*ctx
->Exec
->PushMatrix
)();
4415 case OPCODE_PUSH_NAME
:
4416 (*ctx
->Exec
->PushName
)( n
[1].ui
);
4418 case OPCODE_RASTER_POS
:
4419 (*ctx
->Exec
->RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4421 case OPCODE_READ_BUFFER
:
4422 (*ctx
->Exec
->ReadBuffer
)( n
[1].e
);
4424 case OPCODE_RESET_HISTOGRAM
:
4425 (*ctx
->Exec
->ResetHistogram
)( n
[1].e
);
4427 case OPCODE_RESET_MIN_MAX
:
4428 (*ctx
->Exec
->ResetMinmax
)( n
[1].e
);
4431 (*ctx
->Exec
->Rotatef
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4434 (*ctx
->Exec
->Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4436 case OPCODE_SCISSOR
:
4437 (*ctx
->Exec
->Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
4439 case OPCODE_SHADE_MODEL
:
4440 (*ctx
->Exec
->ShadeModel
)( n
[1].e
);
4442 case OPCODE_STENCIL_FUNC
:
4443 (*ctx
->Exec
->StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
4445 case OPCODE_STENCIL_MASK
:
4446 (*ctx
->Exec
->StencilMask
)( n
[1].ui
);
4448 case OPCODE_STENCIL_OP
:
4449 (*ctx
->Exec
->StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
4458 (*ctx
->Exec
->TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
4468 (*ctx
->Exec
->TexGenfv
)( n
[1].e
, n
[2].e
, params
);
4471 case OPCODE_TEXPARAMETER
:
4478 (*ctx
->Exec
->TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
4481 case OPCODE_TEX_IMAGE1D
:
4483 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4484 ctx
->Unpack
= _mesa_native_packing
;
4485 (*ctx
->Exec
->TexImage1D
)(
4486 n
[1].e
, /* target */
4488 n
[3].i
, /* components */
4490 n
[5].e
, /* border */
4491 n
[6].e
, /* format */
4494 ctx
->Unpack
= save
; /* restore */
4497 case OPCODE_TEX_IMAGE2D
:
4499 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4500 ctx
->Unpack
= _mesa_native_packing
;
4501 (*ctx
->Exec
->TexImage2D
)(
4502 n
[1].e
, /* target */
4504 n
[3].i
, /* components */
4506 n
[5].i
, /* height */
4507 n
[6].e
, /* border */
4508 n
[7].e
, /* format */
4511 ctx
->Unpack
= save
; /* restore */
4514 case OPCODE_TEX_IMAGE3D
:
4516 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4517 ctx
->Unpack
= _mesa_native_packing
;
4518 (*ctx
->Exec
->TexImage3D
)(
4519 n
[1].e
, /* target */
4521 n
[3].i
, /* components */
4523 n
[5].i
, /* height */
4525 n
[7].e
, /* border */
4526 n
[8].e
, /* format */
4529 ctx
->Unpack
= save
; /* restore */
4532 case OPCODE_TEX_SUB_IMAGE1D
:
4534 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4535 ctx
->Unpack
= _mesa_native_packing
;
4536 (*ctx
->Exec
->TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4538 n
[6].e
, n
[7].data
);
4539 ctx
->Unpack
= save
; /* restore */
4542 case OPCODE_TEX_SUB_IMAGE2D
:
4544 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4545 ctx
->Unpack
= _mesa_native_packing
;
4546 (*ctx
->Exec
->TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4548 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
4549 ctx
->Unpack
= save
; /* restore */
4552 case OPCODE_TEX_SUB_IMAGE3D
:
4554 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4555 ctx
->Unpack
= _mesa_native_packing
;
4556 (*ctx
->Exec
->TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4557 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
4558 n
[8].i
, n
[9].e
, n
[10].e
,
4560 ctx
->Unpack
= save
; /* restore */
4563 case OPCODE_TRANSLATE
:
4564 (*ctx
->Exec
->Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4566 case OPCODE_VIEWPORT
:
4567 (*ctx
->Exec
->Viewport
)(n
[1].i
, n
[2].i
,
4568 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
4570 case OPCODE_WINDOW_POS
:
4571 (*ctx
->Exec
->WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4573 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
4574 (*ctx
->Exec
->ActiveTextureARB
)( n
[1].e
);
4576 case OPCODE_CLIENT_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
4577 (*ctx
->Exec
->ClientActiveTextureARB
)( n
[1].e
);
4579 case OPCODE_PIXEL_TEXGEN_SGIX
: /* GL_SGIX_pixel_texture */
4580 (*ctx
->Exec
->PixelTexGenSGIX
)( n
[1].e
);
4582 case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
: /* GL_SGIS_pixel_texture */
4583 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( n
[1].e
, n
[2].i
);
4585 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
4586 (*ctx
->Exec
->CompressedTexImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4587 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].data
);
4589 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
4590 (*ctx
->Exec
->CompressedTexImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4591 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].data
);
4593 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
4594 (*ctx
->Exec
->CompressedTexImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4595 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].data
);
4597 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
4598 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4599 n
[4].i
, n
[5].e
, n
[6].i
, n
[7].data
);
4601 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
4602 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4603 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
, n
[9].data
);
4605 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
4606 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4607 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
4608 n
[9].e
, n
[10].i
, n
[11].data
);
4610 case OPCODE_CONTINUE
:
4611 n
= (Node
*) n
[1].next
;
4613 case OPCODE_END_OF_LIST
:
4619 sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
4620 _mesa_problem( ctx
, msg
);
4625 /* increment n to point to next compiled command */
4626 if (opcode
!=OPCODE_CONTINUE
) {
4627 n
+= InstSize
[opcode
];
4633 if (ctx
->Driver
.EndCallList
)
4634 ctx
->Driver
.EndCallList( ctx
);
4641 /**********************************************************************/
4643 /**********************************************************************/
4649 * Test if a display list number is valid.
4652 _mesa_IsList( GLuint list
)
4654 GET_CURRENT_CONTEXT(ctx
);
4655 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4656 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
4657 return islist(ctx
, list
);
4662 * Delete a sequence of consecutive display lists.
4665 _mesa_DeleteLists( GLuint list
, GLsizei range
)
4667 GET_CURRENT_CONTEXT(ctx
);
4669 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4670 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4673 _mesa_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
4676 for (i
=list
;i
<list
+range
;i
++) {
4677 _mesa_destroy_list( ctx
, i
);
4684 * Return a display list number, n, such that lists n through n+range-1
4688 _mesa_GenLists(GLsizei range
)
4690 GET_CURRENT_CONTEXT(ctx
);
4692 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4693 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
4696 _mesa_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
4704 * Make this an atomic operation
4706 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
4708 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
4710 /* reserve the list IDs by with empty/dummy lists */
4712 for (i
=0; i
<range
; i
++) {
4713 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
4717 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
4725 * Begin a new display list.
4728 _mesa_NewList( GLuint list
, GLenum mode
)
4730 GET_CURRENT_CONTEXT(ctx
);
4731 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
4732 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4734 if (MESA_VERBOSE
&VERBOSE_API
)
4735 fprintf(stderr
, "glNewList %u %s\n", list
, _mesa_lookup_enum_by_nr(mode
));
4738 _mesa_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
4742 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
4743 _mesa_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
4747 if (ctx
->CurrentListPtr
) {
4748 /* already compiling a display list */
4749 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
4753 /* Allocate new display list */
4754 ctx
->CurrentListNum
= list
;
4755 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
4756 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
4757 ctx
->CurrentPos
= 0;
4758 ctx
->CompileFlag
= GL_TRUE
;
4759 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
4761 ctx
->Driver
.NewList( ctx
, list
, mode
);
4763 ctx
->CurrentDispatch
= ctx
->Save
;
4764 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4770 * End definition of current display list. Is the current
4771 * ASSERT_OUTSIDE_BEGIN_END strong enough to really guarentee that
4772 * we are outside begin/end calls?
4775 _mesa_EndList( void )
4777 GET_CURRENT_CONTEXT(ctx
);
4778 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
4779 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4780 if (MESA_VERBOSE
&VERBOSE_API
)
4781 fprintf(stderr
, "glEndList\n");
4783 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
); /* ??? */
4785 /* Check that a list is under construction */
4786 if (!ctx
->CurrentListPtr
) {
4787 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
4791 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_END_OF_LIST
, 0 );
4793 /* Destroy old list, if any */
4794 _mesa_destroy_list(ctx
, ctx
->CurrentListNum
);
4795 /* Install the list */
4796 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
4799 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
4800 mesa_print_display_list(ctx
->CurrentListNum
);
4802 ctx
->CurrentListNum
= 0;
4803 ctx
->CurrentListPtr
= NULL
;
4804 ctx
->ExecuteFlag
= GL_TRUE
;
4805 ctx
->CompileFlag
= GL_FALSE
;
4807 ctx
->Driver
.EndList( ctx
);
4809 ctx
->CurrentDispatch
= ctx
->Exec
;
4810 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4817 _mesa_CallList( GLuint list
)
4819 GLboolean save_compile_flag
;
4820 GET_CURRENT_CONTEXT(ctx
);
4821 FLUSH_CURRENT(ctx
, 0);
4822 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
4823 /* execute the display list, and restore the CompileFlag. */
4825 /* mesa_print_display_list( list ); */
4827 save_compile_flag
= ctx
->CompileFlag
;
4828 if (save_compile_flag
) {
4829 ctx
->CompileFlag
= GL_FALSE
;
4832 execute_list( ctx
, list
);
4833 ctx
->CompileFlag
= save_compile_flag
;
4835 /* also restore API function pointers to point to "save" versions */
4836 if (save_compile_flag
) {
4837 ctx
->CurrentDispatch
= ctx
->Save
;
4838 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4845 * Execute glCallLists: call multiple display lists.
4848 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
4850 GET_CURRENT_CONTEXT(ctx
);
4853 GLboolean save_compile_flag
;
4855 /* Save the CompileFlag status, turn it off, execute display list,
4856 * and restore the CompileFlag.
4858 save_compile_flag
= ctx
->CompileFlag
;
4859 ctx
->CompileFlag
= GL_FALSE
;
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 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4885 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4886 ctx
->List
.ListBase
= base
;
4890 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
4892 static void exec_Finish( void )
4894 GET_CURRENT_CONTEXT(ctx
);
4895 FLUSH_VERTICES(ctx
, 0);
4896 ctx
->Exec
->Finish();
4899 static void exec_Flush( void )
4901 GET_CURRENT_CONTEXT(ctx
);
4902 FLUSH_VERTICES(ctx
, 0);
4903 ctx
->Exec
->Flush( );
4906 static void exec_GetBooleanv( GLenum pname
, GLboolean
*params
)
4908 GET_CURRENT_CONTEXT(ctx
);
4909 FLUSH_VERTICES(ctx
, 0);
4910 ctx
->Exec
->GetBooleanv( pname
, params
);
4913 static void exec_GetClipPlane( GLenum plane
, GLdouble
*equation
)
4915 GET_CURRENT_CONTEXT(ctx
);
4916 FLUSH_VERTICES(ctx
, 0);
4917 ctx
->Exec
->GetClipPlane( plane
, equation
);
4920 static void exec_GetDoublev( GLenum pname
, GLdouble
*params
)
4922 GET_CURRENT_CONTEXT(ctx
);
4923 FLUSH_VERTICES(ctx
, 0);
4924 ctx
->Exec
->GetDoublev( pname
, params
);
4927 static GLenum
exec_GetError( void )
4929 GET_CURRENT_CONTEXT(ctx
);
4930 FLUSH_VERTICES(ctx
, 0);
4931 return ctx
->Exec
->GetError( );
4934 static void exec_GetFloatv( GLenum pname
, GLfloat
*params
)
4936 GET_CURRENT_CONTEXT(ctx
);
4937 FLUSH_VERTICES(ctx
, 0);
4938 ctx
->Exec
->GetFloatv( pname
, params
);
4941 static void exec_GetIntegerv( GLenum pname
, GLint
*params
)
4943 GET_CURRENT_CONTEXT(ctx
);
4944 FLUSH_VERTICES(ctx
, 0);
4945 ctx
->Exec
->GetIntegerv( pname
, params
);
4948 static void exec_GetLightfv( GLenum light
, GLenum pname
, GLfloat
*params
)
4950 GET_CURRENT_CONTEXT(ctx
);
4951 FLUSH_VERTICES(ctx
, 0);
4952 ctx
->Exec
->GetLightfv( light
, pname
, params
);
4955 static void exec_GetLightiv( GLenum light
, GLenum pname
, GLint
*params
)
4957 GET_CURRENT_CONTEXT(ctx
);
4958 FLUSH_VERTICES(ctx
, 0);
4959 ctx
->Exec
->GetLightiv( light
, pname
, params
);
4962 static void exec_GetMapdv( GLenum target
, GLenum query
, GLdouble
*v
)
4964 GET_CURRENT_CONTEXT(ctx
);
4965 FLUSH_VERTICES(ctx
, 0);
4966 ctx
->Exec
->GetMapdv( target
, query
, v
);
4969 static void exec_GetMapfv( GLenum target
, GLenum query
, GLfloat
*v
)
4971 GET_CURRENT_CONTEXT(ctx
);
4972 FLUSH_VERTICES(ctx
, 0);
4973 ctx
->Exec
->GetMapfv( target
, query
, v
);
4976 static void exec_GetMapiv( GLenum target
, GLenum query
, GLint
*v
)
4978 GET_CURRENT_CONTEXT(ctx
);
4979 FLUSH_VERTICES(ctx
, 0);
4980 ctx
->Exec
->GetMapiv( target
, query
, v
);
4983 static void exec_GetMaterialfv( GLenum face
, GLenum pname
, GLfloat
*params
)
4985 GET_CURRENT_CONTEXT(ctx
);
4986 FLUSH_VERTICES(ctx
, 0);
4987 ctx
->Exec
->GetMaterialfv( face
, pname
, params
);
4990 static void exec_GetMaterialiv( GLenum face
, GLenum pname
, GLint
*params
)
4992 GET_CURRENT_CONTEXT(ctx
);
4993 FLUSH_VERTICES(ctx
, 0);
4994 ctx
->Exec
->GetMaterialiv( face
, pname
, params
);
4997 static void exec_GetPixelMapfv( GLenum map
, GLfloat
*values
)
4999 GET_CURRENT_CONTEXT(ctx
);
5000 FLUSH_VERTICES(ctx
, 0);
5001 ctx
->Exec
->GetPixelMapfv( map
, values
);
5004 static void exec_GetPixelMapuiv( GLenum map
, GLuint
*values
)
5006 GET_CURRENT_CONTEXT(ctx
);
5007 FLUSH_VERTICES(ctx
, 0);
5008 ctx
->Exec
->GetPixelMapuiv( map
, values
);
5011 static void exec_GetPixelMapusv( GLenum map
, GLushort
*values
)
5013 GET_CURRENT_CONTEXT(ctx
);
5014 FLUSH_VERTICES(ctx
, 0);
5015 ctx
->Exec
->GetPixelMapusv( map
, values
);
5018 static void exec_GetPolygonStipple( GLubyte
*dest
)
5020 GET_CURRENT_CONTEXT(ctx
);
5021 FLUSH_VERTICES(ctx
, 0);
5022 ctx
->Exec
->GetPolygonStipple( dest
);
5025 static const GLubyte
*exec_GetString( GLenum name
)
5027 GET_CURRENT_CONTEXT(ctx
);
5028 FLUSH_VERTICES(ctx
, 0);
5029 return ctx
->Exec
->GetString( name
);
5032 static void exec_GetTexEnvfv( GLenum target
, GLenum pname
, GLfloat
*params
)
5034 GET_CURRENT_CONTEXT(ctx
);
5035 FLUSH_VERTICES(ctx
, 0);
5036 ctx
->Exec
->GetTexEnvfv( target
, pname
, params
);
5039 static void exec_GetTexEnviv( GLenum target
, GLenum pname
, GLint
*params
)
5041 GET_CURRENT_CONTEXT(ctx
);
5042 FLUSH_VERTICES(ctx
, 0);
5043 ctx
->Exec
->GetTexEnviv( target
, pname
, params
);
5046 static void exec_GetTexGendv( GLenum coord
, GLenum pname
, GLdouble
*params
)
5048 GET_CURRENT_CONTEXT(ctx
);
5049 FLUSH_VERTICES(ctx
, 0);
5050 ctx
->Exec
->GetTexGendv( coord
, pname
, params
);
5053 static void exec_GetTexGenfv( GLenum coord
, GLenum pname
, GLfloat
*params
)
5055 GET_CURRENT_CONTEXT(ctx
);
5056 FLUSH_VERTICES(ctx
, 0);
5057 ctx
->Exec
->GetTexGenfv( coord
, pname
, params
);
5060 static void exec_GetTexGeniv( GLenum coord
, GLenum pname
, GLint
*params
)
5062 GET_CURRENT_CONTEXT(ctx
);
5063 FLUSH_VERTICES(ctx
, 0);
5064 ctx
->Exec
->GetTexGeniv( coord
, pname
, params
);
5067 static void exec_GetTexImage( GLenum target
, GLint level
, GLenum format
,
5068 GLenum type
, GLvoid
*pixels
)
5070 GET_CURRENT_CONTEXT(ctx
);
5071 FLUSH_VERTICES(ctx
, 0);
5072 ctx
->Exec
->GetTexImage( target
, level
, format
, type
, pixels
);
5075 static void exec_GetTexLevelParameterfv( GLenum target
, GLint level
,
5076 GLenum pname
, GLfloat
*params
)
5078 GET_CURRENT_CONTEXT(ctx
);
5079 FLUSH_VERTICES(ctx
, 0);
5080 ctx
->Exec
->GetTexLevelParameterfv( target
, level
, pname
, params
);
5083 static void exec_GetTexLevelParameteriv( GLenum target
, GLint level
,
5084 GLenum pname
, GLint
*params
)
5086 GET_CURRENT_CONTEXT(ctx
);
5087 FLUSH_VERTICES(ctx
, 0);
5088 ctx
->Exec
->GetTexLevelParameteriv( target
, level
, pname
, params
);
5091 static void exec_GetTexParameterfv( GLenum target
, GLenum pname
,
5094 GET_CURRENT_CONTEXT(ctx
);
5095 FLUSH_VERTICES(ctx
, 0);
5096 ctx
->Exec
->GetTexParameterfv( target
, pname
, params
);
5099 static void exec_GetTexParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
5101 GET_CURRENT_CONTEXT(ctx
);
5102 FLUSH_VERTICES(ctx
, 0);
5103 ctx
->Exec
->GetTexParameteriv( target
, pname
, params
);
5106 static GLboolean
exec_IsEnabled( GLenum cap
)
5108 GET_CURRENT_CONTEXT(ctx
);
5109 FLUSH_VERTICES(ctx
, 0);
5110 return ctx
->Exec
->IsEnabled( cap
);
5113 static void exec_PixelStoref( GLenum pname
, GLfloat param
)
5115 GET_CURRENT_CONTEXT(ctx
);
5116 FLUSH_VERTICES(ctx
, 0);
5117 ctx
->Exec
->PixelStoref( pname
, param
);
5120 static void exec_PixelStorei( GLenum pname
, GLint param
)
5122 GET_CURRENT_CONTEXT(ctx
);
5123 FLUSH_VERTICES(ctx
, 0);
5124 ctx
->Exec
->PixelStorei( pname
, param
);
5127 static void exec_ReadPixels( GLint x
, GLint y
, GLsizei width
, GLsizei height
,
5128 GLenum format
, GLenum type
, GLvoid
*pixels
)
5130 GET_CURRENT_CONTEXT(ctx
);
5131 FLUSH_VERTICES(ctx
, 0);
5132 ctx
->Exec
->ReadPixels( x
, y
, width
, height
, format
, type
, pixels
);
5135 static GLint
exec_RenderMode( GLenum mode
)
5137 GET_CURRENT_CONTEXT(ctx
);
5138 FLUSH_VERTICES(ctx
, 0);
5139 return ctx
->Exec
->RenderMode( mode
);
5142 static void exec_FeedbackBuffer( GLsizei size
, GLenum type
, GLfloat
*buffer
)
5144 GET_CURRENT_CONTEXT(ctx
);
5145 FLUSH_VERTICES(ctx
, 0);
5146 ctx
->Exec
->FeedbackBuffer( size
, type
, buffer
);
5149 static void exec_SelectBuffer( GLsizei size
, GLuint
*buffer
)
5151 GET_CURRENT_CONTEXT(ctx
);
5152 FLUSH_VERTICES(ctx
, 0);
5153 ctx
->Exec
->SelectBuffer( size
, buffer
);
5156 static GLboolean
exec_AreTexturesResident(GLsizei n
, const GLuint
*texName
,
5157 GLboolean
*residences
)
5159 GET_CURRENT_CONTEXT(ctx
);
5160 FLUSH_VERTICES(ctx
, 0);
5161 return ctx
->Exec
->AreTexturesResident( n
, texName
, residences
);
5164 static void exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
,
5167 GET_CURRENT_CONTEXT(ctx
);
5168 FLUSH_VERTICES(ctx
, 0);
5169 ctx
->Exec
->ColorPointer( size
, type
, stride
, ptr
);
5172 static void exec_DeleteTextures( GLsizei n
, const GLuint
*texName
)
5174 GET_CURRENT_CONTEXT(ctx
);
5175 FLUSH_VERTICES(ctx
, 0);
5176 ctx
->Exec
->DeleteTextures( n
, texName
);
5179 static void exec_DisableClientState( GLenum cap
)
5181 GET_CURRENT_CONTEXT(ctx
);
5182 FLUSH_VERTICES(ctx
, 0);
5183 ctx
->Exec
->DisableClientState( cap
);
5186 static void exec_EdgeFlagPointer(GLsizei stride
, const void *vptr
)
5188 GET_CURRENT_CONTEXT(ctx
);
5189 FLUSH_VERTICES(ctx
, 0);
5190 ctx
->Exec
->EdgeFlagPointer( stride
, vptr
);
5193 static void exec_EnableClientState( GLenum cap
)
5195 GET_CURRENT_CONTEXT(ctx
);
5196 FLUSH_VERTICES(ctx
, 0);
5197 ctx
->Exec
->EnableClientState( cap
);
5200 static void exec_GenTextures( GLsizei n
, GLuint
*texName
)
5202 GET_CURRENT_CONTEXT(ctx
);
5203 FLUSH_VERTICES(ctx
, 0);
5204 ctx
->Exec
->GenTextures( n
, texName
);
5207 static void exec_GetPointerv( GLenum pname
, GLvoid
**params
)
5209 GET_CURRENT_CONTEXT(ctx
);
5210 FLUSH_VERTICES(ctx
, 0);
5211 ctx
->Exec
->GetPointerv( pname
, params
);
5214 static void exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5216 GET_CURRENT_CONTEXT(ctx
);
5217 FLUSH_VERTICES(ctx
, 0);
5218 ctx
->Exec
->IndexPointer( type
, stride
, ptr
);
5221 static void exec_InterleavedArrays(GLenum format
, GLsizei stride
,
5222 const GLvoid
*pointer
)
5224 GET_CURRENT_CONTEXT(ctx
);
5225 FLUSH_VERTICES(ctx
, 0);
5226 ctx
->Exec
->InterleavedArrays( format
, stride
, pointer
);
5229 static GLboolean
exec_IsTexture( GLuint texture
)
5231 GET_CURRENT_CONTEXT(ctx
);
5232 FLUSH_VERTICES(ctx
, 0);
5233 return ctx
->Exec
->IsTexture( texture
);
5236 static void exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5238 GET_CURRENT_CONTEXT(ctx
);
5239 FLUSH_VERTICES(ctx
, 0);
5240 ctx
->Exec
->NormalPointer( type
, stride
, ptr
);
5243 static void exec_PopClientAttrib(void)
5245 GET_CURRENT_CONTEXT(ctx
);
5246 FLUSH_VERTICES(ctx
, 0);
5247 ctx
->Exec
->PopClientAttrib();
5250 static void exec_PushClientAttrib(GLbitfield mask
)
5252 GET_CURRENT_CONTEXT(ctx
);
5253 FLUSH_VERTICES(ctx
, 0);
5254 ctx
->Exec
->PushClientAttrib( mask
);
5257 static void exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
5260 GET_CURRENT_CONTEXT(ctx
);
5261 FLUSH_VERTICES(ctx
, 0);
5262 ctx
->Exec
->TexCoordPointer( size
, type
, stride
, ptr
);
5265 static void exec_GetCompressedTexImageARB(GLenum target
, GLint level
,
5268 GET_CURRENT_CONTEXT(ctx
);
5269 FLUSH_VERTICES(ctx
, 0);
5270 ctx
->Exec
->GetCompressedTexImageARB( target
, level
, img
);
5273 static void exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
5276 GET_CURRENT_CONTEXT(ctx
);
5277 FLUSH_VERTICES(ctx
, 0);
5278 ctx
->Exec
->VertexPointer( size
, type
, stride
, ptr
);
5281 static void exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
5282 GLint x
, GLint y
, GLsizei width
)
5284 GET_CURRENT_CONTEXT(ctx
);
5285 FLUSH_VERTICES(ctx
, 0);
5286 ctx
->Exec
->CopyConvolutionFilter1D( target
, internalFormat
, x
, y
, width
);
5289 static void exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
5290 GLint x
, GLint y
, GLsizei width
,
5293 GET_CURRENT_CONTEXT(ctx
);
5294 FLUSH_VERTICES(ctx
, 0);
5295 ctx
->Exec
->CopyConvolutionFilter2D( target
, internalFormat
, x
, y
, width
,
5299 static void exec_GetColorTable( GLenum target
, GLenum format
,
5300 GLenum type
, GLvoid
*data
)
5302 GET_CURRENT_CONTEXT(ctx
);
5303 FLUSH_VERTICES(ctx
, 0);
5304 ctx
->Exec
->GetColorTable( target
, format
, type
, data
);
5307 static void exec_GetColorTableParameterfv( GLenum target
, GLenum pname
,
5310 GET_CURRENT_CONTEXT(ctx
);
5311 FLUSH_VERTICES(ctx
, 0);
5312 ctx
->Exec
->GetColorTableParameterfv( target
, pname
, params
);
5315 static void exec_GetColorTableParameteriv( GLenum target
, GLenum pname
,
5318 GET_CURRENT_CONTEXT(ctx
);
5319 FLUSH_VERTICES(ctx
, 0);
5320 ctx
->Exec
->GetColorTableParameteriv( target
, pname
, params
);
5323 static void exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
5326 GET_CURRENT_CONTEXT(ctx
);
5327 FLUSH_VERTICES(ctx
, 0);
5328 ctx
->Exec
->GetConvolutionFilter( target
, format
, type
, image
);
5331 static void exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
,
5334 GET_CURRENT_CONTEXT(ctx
);
5335 FLUSH_VERTICES(ctx
, 0);
5336 ctx
->Exec
->GetConvolutionParameterfv( target
, pname
, params
);
5339 static void exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
,
5342 GET_CURRENT_CONTEXT(ctx
);
5343 FLUSH_VERTICES(ctx
, 0);
5344 ctx
->Exec
->GetConvolutionParameteriv( target
, pname
, params
);
5347 static void exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
5348 GLenum type
, GLvoid
*values
)
5350 GET_CURRENT_CONTEXT(ctx
);
5351 FLUSH_VERTICES(ctx
, 0);
5352 ctx
->Exec
->GetHistogram( target
, reset
, format
, type
, values
);
5355 static void exec_GetHistogramParameterfv(GLenum target
, GLenum pname
,
5358 GET_CURRENT_CONTEXT(ctx
);
5359 FLUSH_VERTICES(ctx
, 0);
5360 ctx
->Exec
->GetHistogramParameterfv( target
, pname
, params
);
5363 static void exec_GetHistogramParameteriv(GLenum target
, GLenum pname
,
5366 GET_CURRENT_CONTEXT(ctx
);
5367 FLUSH_VERTICES(ctx
, 0);
5368 ctx
->Exec
->GetHistogramParameteriv( target
, pname
, params
);
5371 static void exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
5372 GLenum type
, GLvoid
*values
)
5374 GET_CURRENT_CONTEXT(ctx
);
5375 FLUSH_VERTICES(ctx
, 0);
5376 ctx
->Exec
->GetMinmax( target
, reset
, format
, type
, values
);
5379 static void exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
,
5382 GET_CURRENT_CONTEXT(ctx
);
5383 FLUSH_VERTICES(ctx
, 0);
5384 ctx
->Exec
->GetMinmaxParameterfv( target
, pname
, params
);
5387 static void exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
,
5390 GET_CURRENT_CONTEXT(ctx
);
5391 FLUSH_VERTICES(ctx
, 0);
5392 ctx
->Exec
->GetMinmaxParameteriv( target
, pname
, params
);
5395 static void exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
5396 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
5398 GET_CURRENT_CONTEXT(ctx
);
5399 FLUSH_VERTICES(ctx
, 0);
5400 ctx
->Exec
->GetSeparableFilter( target
, format
, type
, row
, column
, span
);
5403 static void exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
5404 GLsizei width
, GLsizei height
, GLenum format
,
5405 GLenum type
, const GLvoid
*row
,
5406 const GLvoid
*column
)
5408 GET_CURRENT_CONTEXT(ctx
);
5409 FLUSH_VERTICES(ctx
, 0);
5410 ctx
->Exec
->SeparableFilter2D( target
, internalFormat
, width
, height
, format
,
5414 static void exec_GetPixelTexGenParameterivSGIS(GLenum target
, GLint
*value
)
5416 GET_CURRENT_CONTEXT(ctx
);
5417 FLUSH_VERTICES(ctx
, 0);
5418 ctx
->Exec
->GetPixelTexGenParameterivSGIS( target
, value
);
5421 static void exec_GetPixelTexGenParameterfvSGIS(GLenum target
, GLfloat
*value
)
5423 GET_CURRENT_CONTEXT(ctx
);
5424 FLUSH_VERTICES(ctx
, 0);
5425 ctx
->Exec
->GetPixelTexGenParameterfvSGIS( target
, value
);
5428 static void exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5429 GLsizei count
, const GLvoid
*ptr
)
5431 GET_CURRENT_CONTEXT(ctx
);
5432 FLUSH_VERTICES(ctx
, 0);
5433 ctx
->Exec
->ColorPointerEXT( size
, type
, stride
, count
, ptr
);
5436 static void exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
,
5437 const GLboolean
*ptr
)
5439 GET_CURRENT_CONTEXT(ctx
);
5440 FLUSH_VERTICES(ctx
, 0);
5441 ctx
->Exec
->EdgeFlagPointerEXT( stride
, count
, ptr
);
5444 static void exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
5447 GET_CURRENT_CONTEXT(ctx
);
5448 FLUSH_VERTICES(ctx
, 0);
5449 ctx
->Exec
->IndexPointerEXT( type
, stride
, count
, ptr
);
5452 static void exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
5455 GET_CURRENT_CONTEXT(ctx
);
5456 FLUSH_VERTICES(ctx
, 0);
5457 ctx
->Exec
->NormalPointerEXT( type
, stride
, count
, ptr
);
5460 static void exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5461 GLsizei count
, const GLvoid
*ptr
)
5463 GET_CURRENT_CONTEXT(ctx
);
5464 FLUSH_VERTICES(ctx
, 0);
5465 ctx
->Exec
->TexCoordPointerEXT( size
, type
, stride
, count
, ptr
);
5468 static void exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5469 GLsizei count
, const GLvoid
*ptr
)
5471 GET_CURRENT_CONTEXT(ctx
);
5472 FLUSH_VERTICES(ctx
, 0);
5473 ctx
->Exec
->VertexPointerEXT( size
, type
, stride
, count
, ptr
);
5476 static void exec_LockArraysEXT(GLint first
, GLsizei count
)
5478 GET_CURRENT_CONTEXT(ctx
);
5479 FLUSH_VERTICES(ctx
, 0);
5480 ctx
->Exec
->LockArraysEXT( first
, count
);
5483 static void exec_UnlockArraysEXT( void )
5485 GET_CURRENT_CONTEXT(ctx
);
5486 FLUSH_VERTICES(ctx
, 0);
5487 ctx
->Exec
->UnlockArraysEXT( );
5490 static void exec_ResizeBuffersMESA( void )
5492 GET_CURRENT_CONTEXT(ctx
);
5493 FLUSH_VERTICES(ctx
, 0);
5494 ctx
->Exec
->ResizeBuffersMESA( );
5497 static void exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
5498 GLsizei stride
, const GLvoid
*ptr
)
5500 GET_CURRENT_CONTEXT(ctx
);
5501 FLUSH_VERTICES(ctx
, 0);
5502 ctx
->Exec
->SecondaryColorPointerEXT( size
, type
, stride
, ptr
);
5505 static void exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
,
5508 GET_CURRENT_CONTEXT(ctx
);
5509 FLUSH_VERTICES(ctx
, 0);
5510 ctx
->Exec
->FogCoordPointerEXT( type
, stride
, ptr
);
5515 * Assign all the pointers in <table> to point to Mesa's display list
5516 * building functions.
5518 * This does not include any of the tnl functions - they are
5519 * initialized from _mesa_init_api_defaults and from the active vtxfmt
5523 _mesa_init_dlist_table( struct _glapi_table
*table
, GLuint tableSize
)
5525 _mesa_init_no_op_table(table
, tableSize
);
5527 _mesa_loopback_init_api_table( table
, GL_FALSE
);
5530 table
->Accum
= save_Accum
;
5531 table
->AlphaFunc
= save_AlphaFunc
;
5532 table
->Bitmap
= save_Bitmap
;
5533 table
->BlendFunc
= save_BlendFunc
;
5534 table
->CallList
= _mesa_save_CallList
;
5535 table
->CallLists
= _mesa_save_CallLists
;
5536 table
->Clear
= save_Clear
;
5537 table
->ClearAccum
= save_ClearAccum
;
5538 table
->ClearColor
= save_ClearColor
;
5539 table
->ClearDepth
= save_ClearDepth
;
5540 table
->ClearIndex
= save_ClearIndex
;
5541 table
->ClearStencil
= save_ClearStencil
;
5542 table
->ClipPlane
= save_ClipPlane
;
5543 table
->ColorMask
= save_ColorMask
;
5544 table
->ColorMaterial
= save_ColorMaterial
;
5545 table
->CopyPixels
= save_CopyPixels
;
5546 table
->CullFace
= save_CullFace
;
5547 table
->DeleteLists
= _mesa_DeleteLists
;
5548 table
->DepthFunc
= save_DepthFunc
;
5549 table
->DepthMask
= save_DepthMask
;
5550 table
->DepthRange
= save_DepthRange
;
5551 table
->Disable
= save_Disable
;
5552 table
->DrawBuffer
= save_DrawBuffer
;
5553 table
->DrawPixels
= save_DrawPixels
;
5554 table
->Enable
= save_Enable
;
5555 table
->EndList
= _mesa_EndList
;
5556 table
->EvalMesh1
= _mesa_save_EvalMesh1
;
5557 table
->EvalMesh2
= _mesa_save_EvalMesh2
;
5558 table
->Finish
= exec_Finish
;
5559 table
->Flush
= exec_Flush
;
5560 table
->Fogf
= save_Fogf
;
5561 table
->Fogfv
= save_Fogfv
;
5562 table
->Fogi
= save_Fogi
;
5563 table
->Fogiv
= save_Fogiv
;
5564 table
->FrontFace
= save_FrontFace
;
5565 table
->Frustum
= save_Frustum
;
5566 table
->GenLists
= _mesa_GenLists
;
5567 table
->GetBooleanv
= exec_GetBooleanv
;
5568 table
->GetClipPlane
= exec_GetClipPlane
;
5569 table
->GetDoublev
= exec_GetDoublev
;
5570 table
->GetError
= exec_GetError
;
5571 table
->GetFloatv
= exec_GetFloatv
;
5572 table
->GetIntegerv
= exec_GetIntegerv
;
5573 table
->GetLightfv
= exec_GetLightfv
;
5574 table
->GetLightiv
= exec_GetLightiv
;
5575 table
->GetMapdv
= exec_GetMapdv
;
5576 table
->GetMapfv
= exec_GetMapfv
;
5577 table
->GetMapiv
= exec_GetMapiv
;
5578 table
->GetMaterialfv
= exec_GetMaterialfv
;
5579 table
->GetMaterialiv
= exec_GetMaterialiv
;
5580 table
->GetPixelMapfv
= exec_GetPixelMapfv
;
5581 table
->GetPixelMapuiv
= exec_GetPixelMapuiv
;
5582 table
->GetPixelMapusv
= exec_GetPixelMapusv
;
5583 table
->GetPolygonStipple
= exec_GetPolygonStipple
;
5584 table
->GetString
= exec_GetString
;
5585 table
->GetTexEnvfv
= exec_GetTexEnvfv
;
5586 table
->GetTexEnviv
= exec_GetTexEnviv
;
5587 table
->GetTexGendv
= exec_GetTexGendv
;
5588 table
->GetTexGenfv
= exec_GetTexGenfv
;
5589 table
->GetTexGeniv
= exec_GetTexGeniv
;
5590 table
->GetTexImage
= exec_GetTexImage
;
5591 table
->GetTexLevelParameterfv
= exec_GetTexLevelParameterfv
;
5592 table
->GetTexLevelParameteriv
= exec_GetTexLevelParameteriv
;
5593 table
->GetTexParameterfv
= exec_GetTexParameterfv
;
5594 table
->GetTexParameteriv
= exec_GetTexParameteriv
;
5595 table
->Hint
= save_Hint
;
5596 table
->IndexMask
= save_IndexMask
;
5597 table
->InitNames
= save_InitNames
;
5598 table
->IsEnabled
= exec_IsEnabled
;
5599 table
->IsList
= _mesa_IsList
;
5600 table
->LightModelf
= save_LightModelf
;
5601 table
->LightModelfv
= save_LightModelfv
;
5602 table
->LightModeli
= save_LightModeli
;
5603 table
->LightModeliv
= save_LightModeliv
;
5604 table
->Lightf
= save_Lightf
;
5605 table
->Lightfv
= save_Lightfv
;
5606 table
->Lighti
= save_Lighti
;
5607 table
->Lightiv
= save_Lightiv
;
5608 table
->LineStipple
= save_LineStipple
;
5609 table
->LineWidth
= save_LineWidth
;
5610 table
->ListBase
= save_ListBase
;
5611 table
->LoadIdentity
= save_LoadIdentity
;
5612 table
->LoadMatrixd
= save_LoadMatrixd
;
5613 table
->LoadMatrixf
= save_LoadMatrixf
;
5614 table
->LoadName
= save_LoadName
;
5615 table
->LogicOp
= save_LogicOp
;
5616 table
->Map1d
= save_Map1d
;
5617 table
->Map1f
= save_Map1f
;
5618 table
->Map2d
= save_Map2d
;
5619 table
->Map2f
= save_Map2f
;
5620 table
->MapGrid1d
= save_MapGrid1d
;
5621 table
->MapGrid1f
= save_MapGrid1f
;
5622 table
->MapGrid2d
= save_MapGrid2d
;
5623 table
->MapGrid2f
= save_MapGrid2f
;
5624 table
->MatrixMode
= save_MatrixMode
;
5625 table
->MultMatrixd
= save_MultMatrixd
;
5626 table
->MultMatrixf
= save_MultMatrixf
;
5627 table
->NewList
= save_NewList
;
5628 table
->Ortho
= save_Ortho
;
5629 table
->PassThrough
= save_PassThrough
;
5630 table
->PixelMapfv
= save_PixelMapfv
;
5631 table
->PixelMapuiv
= save_PixelMapuiv
;
5632 table
->PixelMapusv
= save_PixelMapusv
;
5633 table
->PixelStoref
= exec_PixelStoref
;
5634 table
->PixelStorei
= exec_PixelStorei
;
5635 table
->PixelTransferf
= save_PixelTransferf
;
5636 table
->PixelTransferi
= save_PixelTransferi
;
5637 table
->PixelZoom
= save_PixelZoom
;
5638 table
->PointSize
= save_PointSize
;
5639 table
->PolygonMode
= save_PolygonMode
;
5640 table
->PolygonOffset
= save_PolygonOffset
;
5641 table
->PolygonStipple
= save_PolygonStipple
;
5642 table
->PopAttrib
= save_PopAttrib
;
5643 table
->PopMatrix
= save_PopMatrix
;
5644 table
->PopName
= save_PopName
;
5645 table
->PushAttrib
= save_PushAttrib
;
5646 table
->PushMatrix
= save_PushMatrix
;
5647 table
->PushName
= save_PushName
;
5648 table
->RasterPos2d
= save_RasterPos2d
;
5649 table
->RasterPos2dv
= save_RasterPos2dv
;
5650 table
->RasterPos2f
= save_RasterPos2f
;
5651 table
->RasterPos2fv
= save_RasterPos2fv
;
5652 table
->RasterPos2i
= save_RasterPos2i
;
5653 table
->RasterPos2iv
= save_RasterPos2iv
;
5654 table
->RasterPos2s
= save_RasterPos2s
;
5655 table
->RasterPos2sv
= save_RasterPos2sv
;
5656 table
->RasterPos3d
= save_RasterPos3d
;
5657 table
->RasterPos3dv
= save_RasterPos3dv
;
5658 table
->RasterPos3f
= save_RasterPos3f
;
5659 table
->RasterPos3fv
= save_RasterPos3fv
;
5660 table
->RasterPos3i
= save_RasterPos3i
;
5661 table
->RasterPos3iv
= save_RasterPos3iv
;
5662 table
->RasterPos3s
= save_RasterPos3s
;
5663 table
->RasterPos3sv
= save_RasterPos3sv
;
5664 table
->RasterPos4d
= save_RasterPos4d
;
5665 table
->RasterPos4dv
= save_RasterPos4dv
;
5666 table
->RasterPos4f
= save_RasterPos4f
;
5667 table
->RasterPos4fv
= save_RasterPos4fv
;
5668 table
->RasterPos4i
= save_RasterPos4i
;
5669 table
->RasterPos4iv
= save_RasterPos4iv
;
5670 table
->RasterPos4s
= save_RasterPos4s
;
5671 table
->RasterPos4sv
= save_RasterPos4sv
;
5672 table
->ReadBuffer
= save_ReadBuffer
;
5673 table
->ReadPixels
= exec_ReadPixels
;
5674 table
->RenderMode
= exec_RenderMode
;
5675 table
->Rotated
= save_Rotated
;
5676 table
->Rotatef
= save_Rotatef
;
5677 table
->Scaled
= save_Scaled
;
5678 table
->Scalef
= save_Scalef
;
5679 table
->Scissor
= save_Scissor
;
5680 table
->FeedbackBuffer
= exec_FeedbackBuffer
;
5681 table
->SelectBuffer
= exec_SelectBuffer
;
5682 table
->ShadeModel
= save_ShadeModel
;
5683 table
->StencilFunc
= save_StencilFunc
;
5684 table
->StencilMask
= save_StencilMask
;
5685 table
->StencilOp
= save_StencilOp
;
5686 table
->TexEnvf
= save_TexEnvf
;
5687 table
->TexEnvfv
= save_TexEnvfv
;
5688 table
->TexEnvi
= save_TexEnvi
;
5689 table
->TexEnviv
= save_TexEnviv
;
5690 table
->TexGend
= save_TexGend
;
5691 table
->TexGendv
= save_TexGendv
;
5692 table
->TexGenf
= save_TexGenf
;
5693 table
->TexGenfv
= save_TexGenfv
;
5694 table
->TexGeni
= save_TexGeni
;
5695 table
->TexGeniv
= save_TexGeniv
;
5696 table
->TexImage1D
= save_TexImage1D
;
5697 table
->TexImage2D
= save_TexImage2D
;
5698 table
->TexParameterf
= save_TexParameterf
;
5699 table
->TexParameterfv
= save_TexParameterfv
;
5700 table
->TexParameteri
= save_TexParameteri
;
5701 table
->TexParameteriv
= save_TexParameteriv
;
5702 table
->Translated
= save_Translated
;
5703 table
->Translatef
= save_Translatef
;
5704 table
->Viewport
= save_Viewport
;
5707 table
->AreTexturesResident
= exec_AreTexturesResident
;
5708 table
->BindTexture
= save_BindTexture
;
5709 table
->ColorPointer
= exec_ColorPointer
;
5710 table
->CopyTexImage1D
= save_CopyTexImage1D
;
5711 table
->CopyTexImage2D
= save_CopyTexImage2D
;
5712 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
5713 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
5714 table
->DeleteTextures
= exec_DeleteTextures
;
5715 table
->DisableClientState
= exec_DisableClientState
;
5716 table
->EdgeFlagPointer
= exec_EdgeFlagPointer
;
5717 table
->EnableClientState
= exec_EnableClientState
;
5718 table
->GenTextures
= exec_GenTextures
;
5719 table
->GetPointerv
= exec_GetPointerv
;
5720 table
->IndexPointer
= exec_IndexPointer
;
5721 table
->InterleavedArrays
= exec_InterleavedArrays
;
5722 table
->IsTexture
= exec_IsTexture
;
5723 table
->NormalPointer
= exec_NormalPointer
;
5724 table
->PopClientAttrib
= exec_PopClientAttrib
;
5725 table
->PrioritizeTextures
= save_PrioritizeTextures
;
5726 table
->PushClientAttrib
= exec_PushClientAttrib
;
5727 table
->TexCoordPointer
= exec_TexCoordPointer
;
5728 table
->TexSubImage1D
= save_TexSubImage1D
;
5729 table
->TexSubImage2D
= save_TexSubImage2D
;
5730 table
->VertexPointer
= exec_VertexPointer
;
5733 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
5734 table
->TexImage3D
= save_TexImage3D
;
5735 table
->TexSubImage3D
= save_TexSubImage3D
;
5737 /* GL_ARB_imaging */
5738 /* Not all are supported */
5739 table
->BlendColor
= save_BlendColor
;
5740 table
->BlendEquation
= save_BlendEquation
;
5741 table
->ColorSubTable
= save_ColorSubTable
;
5742 table
->ColorTable
= save_ColorTable
;
5743 table
->ColorTableParameterfv
= save_ColorTableParameterfv
;
5744 table
->ColorTableParameteriv
= save_ColorTableParameteriv
;
5745 table
->ConvolutionFilter1D
= save_ConvolutionFilter1D
;
5746 table
->ConvolutionFilter2D
= save_ConvolutionFilter2D
;
5747 table
->ConvolutionParameterf
= save_ConvolutionParameterf
;
5748 table
->ConvolutionParameterfv
= save_ConvolutionParameterfv
;
5749 table
->ConvolutionParameteri
= save_ConvolutionParameteri
;
5750 table
->ConvolutionParameteriv
= save_ConvolutionParameteriv
;
5751 table
->CopyColorSubTable
= save_CopyColorSubTable
;
5752 table
->CopyColorTable
= save_CopyColorTable
;
5753 table
->CopyConvolutionFilter1D
= exec_CopyConvolutionFilter1D
;
5754 table
->CopyConvolutionFilter2D
= exec_CopyConvolutionFilter2D
;
5755 table
->GetColorTable
= exec_GetColorTable
;
5756 table
->GetColorTableParameterfv
= exec_GetColorTableParameterfv
;
5757 table
->GetColorTableParameteriv
= exec_GetColorTableParameteriv
;
5758 table
->GetConvolutionFilter
= exec_GetConvolutionFilter
;
5759 table
->GetConvolutionParameterfv
= exec_GetConvolutionParameterfv
;
5760 table
->GetConvolutionParameteriv
= exec_GetConvolutionParameteriv
;
5761 table
->GetHistogram
= exec_GetHistogram
;
5762 table
->GetHistogramParameterfv
= exec_GetHistogramParameterfv
;
5763 table
->GetHistogramParameteriv
= exec_GetHistogramParameteriv
;
5764 table
->GetMinmax
= exec_GetMinmax
;
5765 table
->GetMinmaxParameterfv
= exec_GetMinmaxParameterfv
;
5766 table
->GetMinmaxParameteriv
= exec_GetMinmaxParameteriv
;
5767 table
->GetSeparableFilter
= exec_GetSeparableFilter
;
5768 table
->Histogram
= save_Histogram
;
5769 table
->Minmax
= save_Minmax
;
5770 table
->ResetHistogram
= save_ResetHistogram
;
5771 table
->ResetMinmax
= save_ResetMinmax
;
5772 table
->SeparableFilter2D
= exec_SeparableFilter2D
;
5774 /* 2. GL_EXT_blend_color */
5776 table
->BlendColorEXT
= save_BlendColorEXT
;
5779 /* 3. GL_EXT_polygon_offset */
5780 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
5782 /* 6. GL_EXT_texture3d */
5784 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
5785 table
->TexImage3DEXT
= save_TexImage3DEXT
;
5786 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
5789 /* 15. GL_SGIX_pixel_texture */
5790 table
->PixelTexGenSGIX
= save_PixelTexGenSGIX
;
5792 /* 15. GL_SGIS_pixel_texture */
5793 table
->PixelTexGenParameteriSGIS
= save_PixelTexGenParameteriSGIS
;
5794 table
->PixelTexGenParameterfSGIS
= save_PixelTexGenParameterfSGIS
;
5795 table
->PixelTexGenParameterivSGIS
= save_PixelTexGenParameterivSGIS
;
5796 table
->PixelTexGenParameterfvSGIS
= save_PixelTexGenParameterfvSGIS
;
5797 table
->GetPixelTexGenParameterivSGIS
= exec_GetPixelTexGenParameterivSGIS
;
5798 table
->GetPixelTexGenParameterfvSGIS
= exec_GetPixelTexGenParameterfvSGIS
;
5800 /* 30. GL_EXT_vertex_array */
5801 table
->ColorPointerEXT
= exec_ColorPointerEXT
;
5802 table
->EdgeFlagPointerEXT
= exec_EdgeFlagPointerEXT
;
5803 table
->IndexPointerEXT
= exec_IndexPointerEXT
;
5804 table
->NormalPointerEXT
= exec_NormalPointerEXT
;
5805 table
->TexCoordPointerEXT
= exec_TexCoordPointerEXT
;
5806 table
->VertexPointerEXT
= exec_VertexPointerEXT
;
5808 /* 37. GL_EXT_blend_minmax */
5810 table
->BlendEquationEXT
= save_BlendEquationEXT
;
5813 /* 54. GL_EXT_point_parameters */
5814 table
->PointParameterfEXT
= save_PointParameterfEXT
;
5815 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
5817 /* 78. GL_EXT_paletted_texture */
5819 table
->ColorTableEXT
= save_ColorTable
;
5820 table
->ColorSubTableEXT
= save_ColorSubTable
;
5822 table
->GetColorTableEXT
= exec_GetColorTable
;
5823 table
->GetColorTableParameterfvEXT
= exec_GetColorTableParameterfv
;
5824 table
->GetColorTableParameterivEXT
= exec_GetColorTableParameteriv
;
5826 /* 97. GL_EXT_compiled_vertex_array */
5827 table
->LockArraysEXT
= exec_LockArraysEXT
;
5828 table
->UnlockArraysEXT
= exec_UnlockArraysEXT
;
5830 /* GL_ARB_multitexture */
5831 table
->ActiveTextureARB
= save_ActiveTextureARB
;
5832 table
->ClientActiveTextureARB
= save_ClientActiveTextureARB
;
5834 /* GL_EXT_blend_func_separate */
5835 table
->BlendFuncSeparateEXT
= save_BlendFuncSeparateEXT
;
5837 /* GL_MESA_window_pos */
5838 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
5839 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
5840 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
5841 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
5842 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
5843 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
5844 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
5845 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
5846 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
5847 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
5848 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
5849 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
5850 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
5851 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
5852 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
5853 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
5854 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
5855 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
5856 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
5857 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
5858 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
5859 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
5860 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
5861 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
5863 /* GL_MESA_resize_buffers */
5864 table
->ResizeBuffersMESA
= exec_ResizeBuffersMESA
;
5866 /* GL_ARB_transpose_matrix */
5867 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
5868 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
5869 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
5870 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
5872 /* ARB 12. GL_ARB_texture_compression */
5873 table
->CompressedTexImage3DARB
= save_CompressedTexImage3DARB
;
5874 table
->CompressedTexImage2DARB
= save_CompressedTexImage2DARB
;
5875 table
->CompressedTexImage1DARB
= save_CompressedTexImage1DARB
;
5876 table
->CompressedTexSubImage3DARB
= save_CompressedTexSubImage3DARB
;
5877 table
->CompressedTexSubImage2DARB
= save_CompressedTexSubImage2DARB
;
5878 table
->CompressedTexSubImage1DARB
= save_CompressedTexSubImage1DARB
;
5879 table
->GetCompressedTexImageARB
= exec_GetCompressedTexImageARB
;
5881 /* GL_EXT_secondary_color */
5882 table
->SecondaryColorPointerEXT
= exec_SecondaryColorPointerEXT
;
5884 /* GL_EXT_fog_coord */
5885 table
->FogCoordPointerEXT
= exec_FogCoordPointerEXT
;
5893 static const char *enum_string( GLenum k
)
5895 return _mesa_lookup_enum_by_nr( k
);
5900 * Print the commands in a display list. For debugging only.
5901 * TODO: many commands aren't handled yet.
5903 static void print_list( GLcontext
*ctx
, FILE *f
, GLuint list
)
5908 if (!glIsList(list
)) {
5909 fprintf(f
,"%u is not a display list ID\n",list
);
5913 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
5915 fprintf( f
, "START-LIST %u, address %p\n", list
, (void*)n
);
5917 done
= n
? GL_FALSE
: GL_TRUE
;
5919 OpCode opcode
= n
[0].opcode
;
5920 int i
= (int)n
[0].opcode
- (int)OPCODE_DRV_0
;
5922 if (i
>= 0 && i
< ctx
->listext
.nr_opcodes
) {
5923 ctx
->listext
.opcode
[i
].print(ctx
, &n
[1]);
5924 n
+= ctx
->listext
.opcode
[i
].size
;
5928 fprintf(f
,"accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
5931 fprintf(f
,"Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
5932 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
5934 case OPCODE_CALL_LIST
:
5935 fprintf(f
,"CallList %d\n", (int) n
[1].ui
);
5937 case OPCODE_CALL_LIST_OFFSET
:
5938 fprintf(f
,"CallList %d + offset %u = %u\n", (int) n
[1].ui
,
5939 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
5941 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5942 fprintf(f
,"ColorTableParameterfv %s %s %f %f %f %f\n",
5943 enum_string(n
[1].e
), enum_string(n
[2].e
),
5944 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5946 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5947 fprintf(f
,"ColorTableParameteriv %s %s %d %d %d %d\n",
5948 enum_string(n
[1].e
), enum_string(n
[2].e
),
5949 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
5951 case OPCODE_DISABLE
:
5952 fprintf(f
,"Disable %s\n", enum_string(n
[1].e
));
5955 fprintf(f
,"Enable %s\n", enum_string(n
[1].e
));
5957 case OPCODE_FRUSTUM
:
5958 fprintf(f
,"Frustum %g %g %g %g %g %g\n",
5959 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5961 case OPCODE_LINE_STIPPLE
:
5962 fprintf(f
,"LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
5964 case OPCODE_LOAD_IDENTITY
:
5965 fprintf(f
,"LoadIdentity\n");
5967 case OPCODE_LOAD_MATRIX
:
5968 fprintf(f
,"LoadMatrix\n");
5969 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
5970 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
5971 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
5972 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
5974 case OPCODE_MULT_MATRIX
:
5975 fprintf(f
,"MultMatrix (or Rotate)\n");
5976 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
5977 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
5978 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
5979 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
5982 fprintf(f
,"Ortho %g %g %g %g %g %g\n",
5983 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5985 case OPCODE_POP_ATTRIB
:
5986 fprintf(f
,"PopAttrib\n");
5988 case OPCODE_POP_MATRIX
:
5989 fprintf(f
,"PopMatrix\n");
5991 case OPCODE_POP_NAME
:
5992 fprintf(f
,"PopName\n");
5994 case OPCODE_PUSH_ATTRIB
:
5995 fprintf(f
,"PushAttrib %x\n", n
[1].bf
);
5997 case OPCODE_PUSH_MATRIX
:
5998 fprintf(f
,"PushMatrix\n");
6000 case OPCODE_PUSH_NAME
:
6001 fprintf(f
,"PushName %d\n", (int) n
[1].ui
);
6003 case OPCODE_RASTER_POS
:
6004 fprintf(f
,"RasterPos %g %g %g %g\n", n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
6007 fprintf(f
,"Rotate %g %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6010 fprintf(f
,"Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
6012 case OPCODE_TRANSLATE
:
6013 fprintf(f
,"Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
6015 case OPCODE_BIND_TEXTURE
:
6016 fprintf(f
,"BindTexture %s %d\n", _mesa_lookup_enum_by_nr(n
[1].ui
),
6019 case OPCODE_SHADE_MODEL
:
6020 fprintf(f
,"ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
6024 * meta opcodes/commands
6027 fprintf(f
,"Error: %s %s\n", enum_string(n
[1].e
), (const char *)n
[2].data
);
6029 case OPCODE_CONTINUE
:
6030 fprintf(f
,"DISPLAY-LIST-CONTINUE\n");
6031 n
= (Node
*) n
[1].next
;
6033 case OPCODE_END_OF_LIST
:
6034 fprintf(f
,"END-LIST %u\n", list
);
6038 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
6039 fprintf(f
,"ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
6044 fprintf(f
,"command %d, %u operands\n",opcode
,InstSize
[opcode
]);
6047 /* increment n to point to next compiled command */
6048 if (opcode
!=OPCODE_CONTINUE
) {
6049 n
+= InstSize
[opcode
];
6058 * Clients may call this function to help debug display list problems.
6059 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
6060 * changed, or break in the future without notice.
6062 void mesa_print_display_list( GLuint list
)
6064 GET_CURRENT_CONTEXT(ctx
);
6065 print_list( ctx
, stderr
, list
);