1 /* $Id: dlist.c,v 1.64 2001/02/06 21:42:48 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 gl_destroy_list( GLcontext
*ctx
, GLuint list
)
324 block
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
327 done
= block
? GL_FALSE
: GL_TRUE
;
330 /* check for extension opcodes first */
332 int i
= (int)n
[0].opcode
- (int)OPCODE_DRV_0
;
333 if (i
>= 0 && i
< ctx
->listext
.nr_opcodes
) {
334 ctx
->listext
.opcode
[i
].destroy(ctx
, &n
[1]);
335 n
+= ctx
->listext
.opcode
[i
].size
;
338 switch (n
[0].opcode
) {
341 n
+= InstSize
[n
[0].opcode
];
345 n
+= InstSize
[n
[0].opcode
];
347 case OPCODE_DRAW_PIXELS
:
349 n
+= InstSize
[n
[0].opcode
];
353 n
+= InstSize
[n
[0].opcode
];
355 case OPCODE_COLOR_TABLE
:
357 n
+= InstSize
[n
[0].opcode
];
359 case OPCODE_COLOR_SUB_TABLE
:
361 n
+= InstSize
[n
[0].opcode
];
363 case OPCODE_CONVOLUTION_FILTER_1D
:
365 n
+= InstSize
[n
[0].opcode
];
367 case OPCODE_CONVOLUTION_FILTER_2D
:
369 n
+= InstSize
[n
[0].opcode
];
371 case OPCODE_POLYGON_STIPPLE
:
373 n
+= InstSize
[n
[0].opcode
];
375 case OPCODE_TEX_IMAGE1D
:
377 n
+= InstSize
[n
[0].opcode
];
379 case OPCODE_TEX_IMAGE2D
:
381 n
+= InstSize
[n
[0].opcode
];
383 case OPCODE_TEX_IMAGE3D
:
385 n
+= InstSize
[n
[0].opcode
];
387 case OPCODE_TEX_SUB_IMAGE1D
:
389 n
+= InstSize
[n
[0].opcode
];
391 case OPCODE_TEX_SUB_IMAGE2D
:
393 n
+= InstSize
[n
[0].opcode
];
395 case OPCODE_TEX_SUB_IMAGE3D
:
397 n
+= InstSize
[n
[0].opcode
];
399 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
401 n
+= InstSize
[n
[0].opcode
];
403 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
405 n
+= InstSize
[n
[0].opcode
];
407 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
409 n
+= InstSize
[n
[0].opcode
];
411 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
413 n
+= InstSize
[n
[0].opcode
];
415 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
417 n
+= InstSize
[n
[0].opcode
];
419 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
421 n
+= InstSize
[n
[0].opcode
];
423 case OPCODE_CONTINUE
:
424 n
= (Node
*) n
[1].next
;
428 case OPCODE_END_OF_LIST
:
433 /* Most frequent case */
434 n
+= InstSize
[n
[0].opcode
];
440 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
446 * Translate the nth element of list from type to GLuint.
448 static GLuint
translate_id( GLsizei n
, GLenum type
, const GLvoid
*list
)
460 bptr
= (GLbyte
*) list
;
461 return (GLuint
) *(bptr
+n
);
462 case GL_UNSIGNED_BYTE
:
463 ubptr
= (GLubyte
*) list
;
464 return (GLuint
) *(ubptr
+n
);
466 sptr
= (GLshort
*) list
;
467 return (GLuint
) *(sptr
+n
);
468 case GL_UNSIGNED_SHORT
:
469 usptr
= (GLushort
*) list
;
470 return (GLuint
) *(usptr
+n
);
472 iptr
= (GLint
*) list
;
473 return (GLuint
) *(iptr
+n
);
474 case GL_UNSIGNED_INT
:
475 uiptr
= (GLuint
*) list
;
476 return (GLuint
) *(uiptr
+n
);
478 fptr
= (GLfloat
*) list
;
479 return (GLuint
) *(fptr
+n
);
481 ubptr
= ((GLubyte
*) list
) + 2*n
;
482 return (GLuint
) *ubptr
* 256 + (GLuint
) *(ubptr
+1);
484 ubptr
= ((GLubyte
*) list
) + 3*n
;
485 return (GLuint
) *ubptr
* 65536
486 + (GLuint
) *(ubptr
+1) * 256
487 + (GLuint
) *(ubptr
+2);
489 ubptr
= ((GLubyte
*) list
) + 4*n
;
490 return (GLuint
) *ubptr
* 16777216
491 + (GLuint
) *(ubptr
+1) * 65536
492 + (GLuint
) *(ubptr
+2) * 256
493 + (GLuint
) *(ubptr
+3);
502 /**********************************************************************/
504 /**********************************************************************/
506 void gl_init_lists( void )
508 static int init_flag
= 0;
511 InstSize
[OPCODE_ACCUM
] = 3;
512 InstSize
[OPCODE_ALPHA_FUNC
] = 3;
513 InstSize
[OPCODE_BIND_TEXTURE
] = 3;
514 InstSize
[OPCODE_BITMAP
] = 8;
515 InstSize
[OPCODE_BLEND_COLOR
] = 5;
516 InstSize
[OPCODE_BLEND_EQUATION
] = 2;
517 InstSize
[OPCODE_BLEND_FUNC
] = 3;
518 InstSize
[OPCODE_BLEND_FUNC_SEPARATE
] = 5;
519 InstSize
[OPCODE_CALL_LIST
] = 2;
520 InstSize
[OPCODE_CALL_LIST_OFFSET
] = 2;
521 InstSize
[OPCODE_CLEAR
] = 2;
522 InstSize
[OPCODE_CLEAR_ACCUM
] = 5;
523 InstSize
[OPCODE_CLEAR_COLOR
] = 5;
524 InstSize
[OPCODE_CLEAR_DEPTH
] = 2;
525 InstSize
[OPCODE_CLEAR_INDEX
] = 2;
526 InstSize
[OPCODE_CLEAR_STENCIL
] = 2;
527 InstSize
[OPCODE_CLIP_PLANE
] = 6;
528 InstSize
[OPCODE_COLOR_MASK
] = 5;
529 InstSize
[OPCODE_COLOR_MATERIAL
] = 3;
530 InstSize
[OPCODE_COLOR_TABLE
] = 7;
531 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_FV
] = 7;
532 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_IV
] = 7;
533 InstSize
[OPCODE_COLOR_SUB_TABLE
] = 7;
534 InstSize
[OPCODE_CONVOLUTION_FILTER_1D
] = 7;
535 InstSize
[OPCODE_CONVOLUTION_FILTER_2D
] = 8;
536 InstSize
[OPCODE_CONVOLUTION_PARAMETER_I
] = 4;
537 InstSize
[OPCODE_CONVOLUTION_PARAMETER_IV
] = 7;
538 InstSize
[OPCODE_CONVOLUTION_PARAMETER_F
] = 4;
539 InstSize
[OPCODE_CONVOLUTION_PARAMETER_FV
] = 7;
540 InstSize
[OPCODE_COPY_PIXELS
] = 6;
541 InstSize
[OPCODE_COPY_COLOR_SUB_TABLE
] = 6;
542 InstSize
[OPCODE_COPY_COLOR_TABLE
] = 6;
543 InstSize
[OPCODE_COPY_TEX_IMAGE1D
] = 8;
544 InstSize
[OPCODE_COPY_TEX_IMAGE2D
] = 9;
545 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE1D
] = 7;
546 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE2D
] = 9;
547 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE3D
] = 10;
548 InstSize
[OPCODE_CULL_FACE
] = 2;
549 InstSize
[OPCODE_DEPTH_FUNC
] = 2;
550 InstSize
[OPCODE_DEPTH_MASK
] = 2;
551 InstSize
[OPCODE_DEPTH_RANGE
] = 3;
552 InstSize
[OPCODE_DISABLE
] = 2;
553 InstSize
[OPCODE_DRAW_BUFFER
] = 2;
554 InstSize
[OPCODE_DRAW_PIXELS
] = 6;
555 InstSize
[OPCODE_ENABLE
] = 2;
556 InstSize
[OPCODE_EVALCOORD1
] = 2;
557 InstSize
[OPCODE_EVALCOORD2
] = 3;
558 InstSize
[OPCODE_EVALMESH1
] = 4;
559 InstSize
[OPCODE_EVALMESH2
] = 6;
560 InstSize
[OPCODE_EVALPOINT1
] = 2;
561 InstSize
[OPCODE_EVALPOINT2
] = 3;
562 InstSize
[OPCODE_FOG
] = 6;
563 InstSize
[OPCODE_FRONT_FACE
] = 2;
564 InstSize
[OPCODE_FRUSTUM
] = 7;
565 InstSize
[OPCODE_HINT
] = 3;
566 InstSize
[OPCODE_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 gl_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
= gl_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
= gl_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
= gl_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
= gl_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 gl_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
);
2382 static void save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
2384 GET_CURRENT_CONTEXT(ctx
);
2386 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2387 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_MAP
, 3 );
2391 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
2392 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
2394 if (ctx
->ExecuteFlag
) {
2395 (*ctx
->Exec
->PixelMapfv
)( map
, mapsize
, values
);
2400 static void save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2402 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2404 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2405 for (i
=0;i
<mapsize
;i
++) {
2406 fvalues
[i
] = (GLfloat
) values
[i
];
2410 for (i
=0;i
<mapsize
;i
++) {
2411 fvalues
[i
] = UINT_TO_FLOAT( values
[i
] );
2414 save_PixelMapfv(map
, mapsize
, fvalues
);
2418 static void save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2420 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2422 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2423 for (i
=0;i
<mapsize
;i
++) {
2424 fvalues
[i
] = (GLfloat
) values
[i
];
2428 for (i
=0;i
<mapsize
;i
++) {
2429 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2432 save_PixelMapfv(map
, mapsize
, fvalues
);
2436 static void save_PixelTransferf( GLenum pname
, GLfloat param
)
2438 GET_CURRENT_CONTEXT(ctx
);
2440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2441 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2446 if (ctx
->ExecuteFlag
) {
2447 (*ctx
->Exec
->PixelTransferf
)( pname
, param
);
2452 static void save_PixelTransferi( GLenum pname
, GLint param
)
2454 save_PixelTransferf( pname
, (GLfloat
) param
);
2458 static void save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2460 GET_CURRENT_CONTEXT(ctx
);
2462 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2463 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2468 if (ctx
->ExecuteFlag
) {
2469 (*ctx
->Exec
->PixelZoom
)( xfactor
, yfactor
);
2474 static void save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2476 GET_CURRENT_CONTEXT(ctx
);
2478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2479 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2486 if (ctx
->ExecuteFlag
) {
2487 (*ctx
->Exec
->PointParameterfvEXT
)( pname
, params
);
2492 static void save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2494 save_PointParameterfvEXT(pname
, ¶m
);
2498 static void save_PointSize( GLfloat size
)
2500 GET_CURRENT_CONTEXT(ctx
);
2502 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2503 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_SIZE
, 1 );
2507 if (ctx
->ExecuteFlag
) {
2508 (*ctx
->Exec
->PointSize
)( size
);
2513 static void save_PolygonMode( GLenum face
, GLenum mode
)
2515 GET_CURRENT_CONTEXT(ctx
);
2517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2518 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_MODE
, 2 );
2523 if (ctx
->ExecuteFlag
) {
2524 (*ctx
->Exec
->PolygonMode
)( face
, mode
);
2530 * Polygon stipple must have been upacked already!
2532 static void save_PolygonStipple( const GLubyte
*pattern
)
2534 GET_CURRENT_CONTEXT(ctx
);
2536 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2537 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2540 n
[1].data
= MALLOC( 32 * 4 );
2541 data
= n
[1].data
; /* This needed for Acorn compiler */
2542 MEMCPY( data
, pattern
, 32 * 4 );
2544 if (ctx
->ExecuteFlag
) {
2545 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) pattern
);
2550 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2552 GET_CURRENT_CONTEXT(ctx
);
2554 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2555 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2560 if (ctx
->ExecuteFlag
) {
2561 (*ctx
->Exec
->PolygonOffset
)( factor
, units
);
2566 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2568 GET_CURRENT_CONTEXT(ctx
);
2569 save_PolygonOffset(factor
, ctx
->DepthMaxF
* bias
);
2573 static void save_PopAttrib( void )
2575 GET_CURRENT_CONTEXT(ctx
);
2576 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2577 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_ATTRIB
, 0 );
2578 if (ctx
->ExecuteFlag
) {
2579 (*ctx
->Exec
->PopAttrib
)();
2584 static void save_PopMatrix( void )
2586 GET_CURRENT_CONTEXT(ctx
);
2587 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2588 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_MATRIX
, 0 );
2589 if (ctx
->ExecuteFlag
) {
2590 (*ctx
->Exec
->PopMatrix
)();
2595 static void save_PopName( void )
2597 GET_CURRENT_CONTEXT(ctx
);
2598 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2599 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_NAME
, 0 );
2600 if (ctx
->ExecuteFlag
) {
2601 (*ctx
->Exec
->PopName
)();
2606 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2607 const GLclampf
*priorities
)
2609 GET_CURRENT_CONTEXT(ctx
);
2611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2613 for (i
=0;i
<num
;i
++) {
2615 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2617 n
[1].ui
= textures
[i
];
2618 n
[2].f
= priorities
[i
];
2621 if (ctx
->ExecuteFlag
) {
2622 (*ctx
->Exec
->PrioritizeTextures
)( num
, textures
, priorities
);
2627 static void save_PushAttrib( GLbitfield mask
)
2629 GET_CURRENT_CONTEXT(ctx
);
2631 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2632 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2636 if (ctx
->ExecuteFlag
) {
2637 (*ctx
->Exec
->PushAttrib
)( mask
);
2642 static void save_PushMatrix( void )
2644 GET_CURRENT_CONTEXT(ctx
);
2645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2646 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2647 if (ctx
->ExecuteFlag
) {
2648 (*ctx
->Exec
->PushMatrix
)();
2653 static void save_PushName( GLuint name
)
2655 GET_CURRENT_CONTEXT(ctx
);
2657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2658 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_NAME
, 1 );
2662 if (ctx
->ExecuteFlag
) {
2663 (*ctx
->Exec
->PushName
)( name
);
2668 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2670 GET_CURRENT_CONTEXT(ctx
);
2672 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2673 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RASTER_POS
, 4 );
2680 if (ctx
->ExecuteFlag
) {
2681 (*ctx
->Exec
->RasterPos4f
)( x
, y
, z
, w
);
2685 static void save_RasterPos2d(GLdouble x
, GLdouble y
)
2687 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2690 static void save_RasterPos2f(GLfloat x
, GLfloat y
)
2692 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2695 static void save_RasterPos2i(GLint x
, GLint y
)
2697 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2700 static void save_RasterPos2s(GLshort x
, GLshort y
)
2702 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2705 static void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2707 save_RasterPos4f(x
, y
, z
, 1.0F
);
2710 static void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2712 save_RasterPos4f(x
, y
, z
, 1.0F
);
2715 static void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2717 save_RasterPos4f(x
, y
, z
, 1.0F
);
2720 static void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2722 save_RasterPos4f(x
, y
, z
, 1.0F
);
2725 static void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2727 save_RasterPos4f(x
, y
, z
, w
);
2730 static void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2732 save_RasterPos4f(x
, y
, z
, w
);
2735 static void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2737 save_RasterPos4f(x
, y
, z
, w
);
2740 static void save_RasterPos2dv(const GLdouble
*v
)
2742 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2745 static void save_RasterPos2fv(const GLfloat
*v
)
2747 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2750 static void save_RasterPos2iv(const GLint
*v
)
2752 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2755 static void save_RasterPos2sv(const GLshort
*v
)
2757 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2760 static void save_RasterPos3dv(const GLdouble
*v
)
2762 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2765 static void save_RasterPos3fv(const GLfloat
*v
)
2767 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2770 static void save_RasterPos3iv(const GLint
*v
)
2772 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2775 static void save_RasterPos3sv(const GLshort
*v
)
2777 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2780 static void save_RasterPos4dv(const GLdouble
*v
)
2782 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2785 static void save_RasterPos4fv(const GLfloat
*v
)
2787 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2790 static void save_RasterPos4iv(const GLint
*v
)
2792 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2795 static void save_RasterPos4sv(const GLshort
*v
)
2797 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2801 static void save_PassThrough( GLfloat token
)
2803 GET_CURRENT_CONTEXT(ctx
);
2805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2806 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PASSTHROUGH
, 1 );
2810 if (ctx
->ExecuteFlag
) {
2811 (*ctx
->Exec
->PassThrough
)( token
);
2816 static void save_ReadBuffer( GLenum mode
)
2818 GET_CURRENT_CONTEXT(ctx
);
2820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2821 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_READ_BUFFER
, 1 );
2825 if (ctx
->ExecuteFlag
) {
2826 (*ctx
->Exec
->ReadBuffer
)( mode
);
2832 save_ResetHistogram(GLenum target
)
2834 GET_CURRENT_CONTEXT(ctx
);
2836 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2837 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_HISTOGRAM
, 1 );
2841 if (ctx
->ExecuteFlag
) {
2842 (*ctx
->Exec
->ResetHistogram
)( target
);
2848 save_ResetMinmax(GLenum target
)
2850 GET_CURRENT_CONTEXT(ctx
);
2852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2853 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_MIN_MAX
, 1 );
2857 if (ctx
->ExecuteFlag
) {
2858 (*ctx
->Exec
->ResetMinmax
)( target
);
2863 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2865 GET_CURRENT_CONTEXT(ctx
);
2867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2868 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ROTATE
, 4 );
2875 if (ctx
->ExecuteFlag
) {
2876 (*ctx
->Exec
->Rotatef
)( angle
, x
, y
, z
);
2881 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2883 save_Rotatef(angle
, x
, y
, z
);
2887 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2889 GET_CURRENT_CONTEXT(ctx
);
2891 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2892 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCALE
, 3 );
2898 if (ctx
->ExecuteFlag
) {
2899 (*ctx
->Exec
->Scalef
)( x
, y
, z
);
2904 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
2906 save_Scalef(x
, y
, z
);
2910 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
2912 GET_CURRENT_CONTEXT(ctx
);
2914 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2915 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCISSOR
, 4 );
2922 if (ctx
->ExecuteFlag
) {
2923 (*ctx
->Exec
->Scissor
)( x
, y
, width
, height
);
2928 static void save_ShadeModel( GLenum mode
)
2930 GET_CURRENT_CONTEXT(ctx
);
2932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2933 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SHADE_MODEL
, 1 );
2937 if (ctx
->ExecuteFlag
) {
2938 (*ctx
->Exec
->ShadeModel
)( mode
);
2943 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
2945 GET_CURRENT_CONTEXT(ctx
);
2947 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2948 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_FUNC
, 3 );
2954 if (ctx
->ExecuteFlag
) {
2955 (*ctx
->Exec
->StencilFunc
)( func
, ref
, mask
);
2960 static void save_StencilMask( GLuint mask
)
2962 GET_CURRENT_CONTEXT(ctx
);
2964 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2965 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_MASK
, 1 );
2969 if (ctx
->ExecuteFlag
) {
2970 (*ctx
->Exec
->StencilMask
)( mask
);
2975 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
2977 GET_CURRENT_CONTEXT(ctx
);
2979 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2980 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_OP
, 3 );
2986 if (ctx
->ExecuteFlag
) {
2987 (*ctx
->Exec
->StencilOp
)( fail
, zfail
, zpass
);
2992 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
2994 GET_CURRENT_CONTEXT(ctx
);
2996 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2997 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXENV
, 6 );
3006 if (ctx
->ExecuteFlag
) {
3007 (*ctx
->Exec
->TexEnvfv
)( target
, pname
, params
);
3012 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
3014 save_TexEnvfv( target
, pname
, ¶m
);
3018 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
3021 p
[0] = (GLfloat
) param
;
3022 p
[1] = p
[2] = p
[3] = 0.0;
3023 save_TexEnvfv( target
, pname
, p
);
3027 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
3030 p
[0] = INT_TO_FLOAT( param
[0] );
3031 p
[1] = INT_TO_FLOAT( param
[1] );
3032 p
[2] = INT_TO_FLOAT( param
[2] );
3033 p
[3] = INT_TO_FLOAT( param
[3] );
3034 save_TexEnvfv( target
, pname
, p
);
3038 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
3040 GET_CURRENT_CONTEXT(ctx
);
3042 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3043 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXGEN
, 6 );
3052 if (ctx
->ExecuteFlag
) {
3053 (*ctx
->Exec
->TexGenfv
)( coord
, pname
, params
);
3058 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3065 save_TexGenfv(coord
, pname
, p
);
3069 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3071 GLfloat p
= (GLfloat
) param
;
3072 save_TexGenfv( coord
, pname
, &p
);
3076 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3083 save_TexGenfv( coord
, pname
, p
);
3087 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
3089 save_TexGenfv(coord
, pname
, ¶m
);
3093 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
3095 save_TexGeniv( coord
, pname
, ¶m
);
3099 static void save_TexParameterfv( GLenum target
,
3100 GLenum pname
, const GLfloat
*params
)
3102 GET_CURRENT_CONTEXT(ctx
);
3104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3105 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXPARAMETER
, 6 );
3114 if (ctx
->ExecuteFlag
) {
3115 (*ctx
->Exec
->TexParameterfv
)( target
, pname
, params
);
3120 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
3122 save_TexParameterfv(target
, pname
, ¶m
);
3126 static void save_TexParameteri( GLenum target
, GLenum pname
, const GLint param
)
3129 fparam
[0] = (GLfloat
) param
;
3130 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3131 save_TexParameterfv(target
, pname
, fparam
);
3135 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
3138 fparam
[0] = (GLfloat
) params
[0];
3139 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3140 save_TexParameterfv(target
, pname
, fparam
);
3144 static void save_TexImage1D( GLenum target
,
3145 GLint level
, GLint components
,
3146 GLsizei width
, GLint border
,
3147 GLenum format
, GLenum type
,
3148 const GLvoid
*pixels
)
3150 GET_CURRENT_CONTEXT(ctx
);
3151 if (target
== GL_PROXY_TEXTURE_1D
) {
3152 /* don't compile, execute immediately */
3153 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3154 border
, format
, type
, pixels
);
3157 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3158 pixels
, &ctx
->Unpack
);
3160 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3161 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
3165 n
[3].i
= components
;
3166 n
[4].i
= (GLint
) width
;
3175 if (ctx
->ExecuteFlag
) {
3176 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3177 border
, format
, type
, pixels
);
3183 static void save_TexImage2D( GLenum target
,
3184 GLint level
, GLint components
,
3185 GLsizei width
, GLsizei height
, GLint border
,
3186 GLenum format
, GLenum type
,
3187 const GLvoid
*pixels
)
3189 GET_CURRENT_CONTEXT(ctx
);
3190 if (target
== GL_PROXY_TEXTURE_2D
) {
3191 /* don't compile, execute immediately */
3192 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3193 height
, border
, format
, type
, pixels
);
3196 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3197 pixels
, &ctx
->Unpack
);
3199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3200 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
3204 n
[3].i
= components
;
3205 n
[4].i
= (GLint
) width
;
3206 n
[5].i
= (GLint
) height
;
3215 if (ctx
->ExecuteFlag
) {
3216 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3217 height
, border
, format
, type
, pixels
);
3223 static void save_TexImage3D( GLenum target
,
3224 GLint level
, GLint internalFormat
,
3225 GLsizei width
, GLsizei height
, GLsizei depth
,
3227 GLenum format
, GLenum type
,
3228 const GLvoid
*pixels
)
3230 GET_CURRENT_CONTEXT(ctx
);
3231 if (target
== GL_PROXY_TEXTURE_3D
) {
3232 /* don't compile, execute immediately */
3233 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3234 height
, depth
, border
, format
, type
, pixels
);
3238 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3239 pixels
, &ctx
->Unpack
);
3240 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3241 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
3245 n
[3].i
= internalFormat
;
3246 n
[4].i
= (GLint
) width
;
3247 n
[5].i
= (GLint
) height
;
3248 n
[6].i
= (GLint
) depth
;
3257 if (ctx
->ExecuteFlag
) {
3258 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3259 height
, depth
, border
, format
, type
, pixels
);
3265 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
3266 GLsizei width
, GLenum format
, GLenum type
,
3267 const GLvoid
*pixels
)
3269 GET_CURRENT_CONTEXT(ctx
);
3271 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3272 pixels
, &ctx
->Unpack
);
3273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3274 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
3279 n
[4].i
= (GLint
) width
;
3287 if (ctx
->ExecuteFlag
) {
3288 (*ctx
->Exec
->TexSubImage1D
)( target
, level
, xoffset
, width
,
3289 format
, type
, pixels
);
3294 static void save_TexSubImage2D( GLenum target
, GLint level
,
3295 GLint xoffset
, GLint yoffset
,
3296 GLsizei width
, GLsizei height
,
3297 GLenum format
, GLenum type
,
3298 const GLvoid
*pixels
)
3300 GET_CURRENT_CONTEXT(ctx
);
3302 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3303 pixels
, &ctx
->Unpack
);
3304 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3305 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
3311 n
[5].i
= (GLint
) width
;
3312 n
[6].i
= (GLint
) height
;
3320 if (ctx
->ExecuteFlag
) {
3321 (*ctx
->Exec
->TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
3322 width
, height
, format
, type
, pixels
);
3327 static void save_TexSubImage3D( GLenum target
, GLint level
,
3328 GLint xoffset
, GLint yoffset
,GLint zoffset
,
3329 GLsizei width
, GLsizei height
, GLsizei depth
,
3330 GLenum format
, GLenum type
,
3331 const GLvoid
*pixels
)
3333 GET_CURRENT_CONTEXT(ctx
);
3335 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3336 pixels
, &ctx
->Unpack
);
3337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3338 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
3345 n
[6].i
= (GLint
) width
;
3346 n
[7].i
= (GLint
) height
;
3347 n
[8].i
= (GLint
) depth
;
3355 if (ctx
->ExecuteFlag
) {
3356 (*ctx
->Exec
->TexSubImage3D
)( target
, level
,
3357 xoffset
, yoffset
, zoffset
,
3358 width
, height
, depth
, format
, type
, pixels
);
3363 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
3365 GET_CURRENT_CONTEXT(ctx
);
3367 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3368 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRANSLATE
, 3 );
3374 if (ctx
->ExecuteFlag
) {
3375 (*ctx
->Exec
->Translatef
)( x
, y
, z
);
3380 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3382 save_Translatef(x
, y
, z
);
3387 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3389 GET_CURRENT_CONTEXT(ctx
);
3391 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3392 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_VIEWPORT
, 4 );
3396 n
[3].i
= (GLint
) width
;
3397 n
[4].i
= (GLint
) height
;
3399 if (ctx
->ExecuteFlag
) {
3400 (*ctx
->Exec
->Viewport
)( x
, y
, width
, height
);
3405 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3407 GET_CURRENT_CONTEXT(ctx
);
3409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3410 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_WINDOW_POS
, 4 );
3417 if (ctx
->ExecuteFlag
) {
3418 (*ctx
->Exec
->WindowPos4fMESA
)( x
, y
, z
, w
);
3422 static void save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3424 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3427 static void save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3429 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3432 static void save_WindowPos2iMESA(GLint x
, GLint y
)
3434 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3437 static void save_WindowPos2sMESA(GLshort x
, GLshort y
)
3439 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3442 static void save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3444 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3447 static void save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3449 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3452 static void save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3454 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3457 static void save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3459 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3462 static void save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3464 save_WindowPos4fMESA(x
, y
, z
, w
);
3467 static void save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3469 save_WindowPos4fMESA(x
, y
, z
, w
);
3472 static void save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3474 save_WindowPos4fMESA(x
, y
, z
, w
);
3477 static void save_WindowPos2dvMESA(const GLdouble
*v
)
3479 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3482 static void save_WindowPos2fvMESA(const GLfloat
*v
)
3484 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3487 static void save_WindowPos2ivMESA(const GLint
*v
)
3489 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3492 static void save_WindowPos2svMESA(const GLshort
*v
)
3494 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3497 static void save_WindowPos3dvMESA(const GLdouble
*v
)
3499 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3502 static void save_WindowPos3fvMESA(const GLfloat
*v
)
3504 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3507 static void save_WindowPos3ivMESA(const GLint
*v
)
3509 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3512 static void save_WindowPos3svMESA(const GLshort
*v
)
3514 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3517 static void save_WindowPos4dvMESA(const GLdouble
*v
)
3519 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3522 static void save_WindowPos4fvMESA(const GLfloat
*v
)
3524 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3527 static void save_WindowPos4ivMESA(const GLint
*v
)
3529 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3532 static void save_WindowPos4svMESA(const GLshort
*v
)
3534 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3539 /* GL_ARB_multitexture */
3540 static void save_ActiveTextureARB( GLenum target
)
3542 GET_CURRENT_CONTEXT(ctx
);
3544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3545 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3549 if (ctx
->ExecuteFlag
) {
3550 (*ctx
->Exec
->ActiveTextureARB
)( target
);
3555 /* GL_ARB_multitexture */
3556 static void save_ClientActiveTextureARB( GLenum target
)
3558 GET_CURRENT_CONTEXT(ctx
);
3560 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3561 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLIENT_ACTIVE_TEXTURE
, 1 );
3565 if (ctx
->ExecuteFlag
) {
3566 (*ctx
->Exec
->ClientActiveTextureARB
)( target
);
3572 /* GL_ARB_transpose_matrix */
3574 static void save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3577 _math_transposefd(tm
, m
);
3578 save_LoadMatrixf(tm
);
3582 static void save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3585 _math_transposef(tm
, m
);
3586 save_LoadMatrixf(tm
);
3590 static void save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3593 _math_transposefd(tm
, m
);
3594 save_MultMatrixf(tm
);
3598 static void save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3601 _math_transposef(tm
, m
);
3602 save_MultMatrixf(tm
);
3606 static void save_PixelTexGenSGIX(GLenum mode
)
3608 GET_CURRENT_CONTEXT(ctx
);
3610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3611 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_SGIX
, 1 );
3615 if (ctx
->ExecuteFlag
) {
3616 (*ctx
->Exec
->PixelTexGenSGIX
)( mode
);
3621 /* GL_ARB_texture_compression */
3623 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3624 GLenum internalFormat
, GLsizei width
,
3625 GLint border
, GLsizei imageSize
,
3628 GET_CURRENT_CONTEXT(ctx
);
3629 if (target
== GL_PROXY_TEXTURE_1D
) {
3630 /* don't compile, execute immediately */
3631 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3632 width
, border
, imageSize
, data
);
3637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3638 /* make copy of image */
3639 image
= MALLOC(imageSize
);
3641 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3644 MEMCPY(image
, data
, imageSize
);
3645 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 8 );
3649 n
[3].e
= internalFormat
;
3650 n
[4].i
= (GLint
) width
;
3658 if (ctx
->ExecuteFlag
) {
3659 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3660 width
, border
, imageSize
, data
);
3667 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
3668 GLenum internalFormat
, GLsizei width
,
3669 GLsizei height
, GLint border
, GLsizei imageSize
,
3672 GET_CURRENT_CONTEXT(ctx
);
3673 if (target
== GL_PROXY_TEXTURE_2D
) {
3674 /* don't compile, execute immediately */
3675 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3676 width
, height
, border
, imageSize
, data
);
3681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3682 /* make copy of image */
3683 image
= MALLOC(imageSize
);
3685 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
3688 MEMCPY(image
, data
, imageSize
);
3689 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 9 );
3693 n
[3].e
= internalFormat
;
3694 n
[4].i
= (GLint
) width
;
3695 n
[5].i
= (GLint
) height
;
3703 if (ctx
->ExecuteFlag
) {
3704 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3705 width
, height
, border
, imageSize
, data
);
3712 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
3713 GLenum internalFormat
, GLsizei width
,
3714 GLsizei height
, GLsizei depth
, GLint border
,
3715 GLsizei imageSize
, const GLvoid
*data
)
3717 GET_CURRENT_CONTEXT(ctx
);
3718 if (target
== GL_PROXY_TEXTURE_3D
) {
3719 /* don't compile, execute immediately */
3720 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3721 width
, height
, depth
, border
, imageSize
, data
);
3726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3727 /* make copy of image */
3728 image
= MALLOC(imageSize
);
3730 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
3733 MEMCPY(image
, data
, imageSize
);
3734 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 10 );
3738 n
[3].e
= internalFormat
;
3739 n
[4].i
= (GLint
) width
;
3740 n
[5].i
= (GLint
) height
;
3741 n
[6].i
= (GLint
) depth
;
3749 if (ctx
->ExecuteFlag
) {
3750 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3751 width
, height
, depth
, border
, imageSize
, data
);
3758 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
3759 GLsizei width
, GLenum format
,
3760 GLsizei imageSize
, const GLvoid
*data
)
3765 GET_CURRENT_CONTEXT(ctx
);
3766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3768 /* make copy of image */
3769 image
= MALLOC(imageSize
);
3771 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
3774 MEMCPY(image
, data
, imageSize
);
3775 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 8 );
3780 n
[4].i
= (GLint
) width
;
3788 if (ctx
->ExecuteFlag
) {
3789 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(target
, level
, xoffset
,
3790 width
, format
, imageSize
, data
);
3796 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
3797 GLint yoffset
, GLsizei width
, GLsizei height
,
3798 GLenum format
, GLsizei imageSize
,
3804 GET_CURRENT_CONTEXT(ctx
);
3805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3807 /* make copy of image */
3808 image
= MALLOC(imageSize
);
3810 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
3813 MEMCPY(image
, data
, imageSize
);
3814 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 10 );
3820 n
[5].i
= (GLint
) width
;
3821 n
[6].i
= (GLint
) height
;
3829 if (ctx
->ExecuteFlag
) {
3830 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(target
, level
, xoffset
, yoffset
,
3831 width
, height
, format
, imageSize
, data
);
3837 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
3838 GLint yoffset
, GLint zoffset
, GLsizei width
,
3839 GLsizei height
, GLsizei depth
, GLenum format
,
3840 GLsizei imageSize
, const GLvoid
*data
)
3845 GET_CURRENT_CONTEXT(ctx
);
3846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3848 /* make copy of image */
3849 image
= MALLOC(imageSize
);
3851 gl_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
3854 MEMCPY(image
, data
, imageSize
);
3855 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 12 );
3862 n
[6].i
= (GLint
) width
;
3863 n
[7].i
= (GLint
) height
;
3864 n
[8].i
= (GLint
) depth
;
3866 n
[10].i
= imageSize
;
3872 if (ctx
->ExecuteFlag
) {
3873 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(target
, level
, xoffset
, yoffset
,
3874 zoffset
, width
, height
, depth
, format
, imageSize
, data
);
3879 /* GL_SGIS_pixel_texture */
3881 static void save_PixelTexGenParameteriSGIS(GLenum target
, GLint value
)
3883 GET_CURRENT_CONTEXT(ctx
);
3885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3886 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
, 2 );
3891 if (ctx
->ExecuteFlag
) {
3892 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( target
, value
);
3897 static void save_PixelTexGenParameterfSGIS(GLenum target
, GLfloat value
)
3899 save_PixelTexGenParameteriSGIS(target
, (GLint
) value
);
3903 static void save_PixelTexGenParameterivSGIS(GLenum target
, const GLint
*value
)
3905 save_PixelTexGenParameteriSGIS(target
, *value
);
3909 static void save_PixelTexGenParameterfvSGIS(GLenum target
, const GLfloat
*value
)
3911 save_PixelTexGenParameteriSGIS(target
, (GLint
) *value
);
3915 /* KW: Compile commands
3917 * Will appear in the list before the vertex buffer containing the
3918 * command that provoked the error. I don't see this as a problem.
3920 void gl_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
3923 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ERROR
, 2 );
3926 n
[2].data
= (void *) s
;
3928 /* execute already done */
3933 islist(GLcontext
*ctx
, GLuint list
)
3935 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
3945 /**********************************************************************/
3946 /* Display list execution */
3947 /**********************************************************************/
3951 * Execute a display list. Note that the ListBase offset must have already
3952 * been added before calling this function. I.e. the list argument is
3953 * the absolute list number, not relative to ListBase.
3954 * Input: list - display list number
3956 static void execute_list( GLcontext
*ctx
, GLuint list
)
3961 if (!islist(ctx
,list
))
3964 if (ctx
->Driver
.BeginCallList
)
3965 ctx
->Driver
.BeginCallList( ctx
, list
);
3967 /* fprintf(stderr, "execute list %d\n", list); */
3968 /* mesa_print_display_list( list ); */
3972 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
3976 OpCode opcode
= n
[0].opcode
;
3977 int i
= (int)n
[0].opcode
- (int)OPCODE_DRV_0
;
3979 if (i
>= 0 && i
< ctx
->listext
.nr_opcodes
) {
3980 ctx
->listext
.opcode
[i
].execute(ctx
, &n
[1]);
3981 n
+= ctx
->listext
.opcode
[i
].size
;
3986 gl_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
3989 (*ctx
->Exec
->Accum
)( n
[1].e
, n
[2].f
);
3991 case OPCODE_ALPHA_FUNC
:
3992 (*ctx
->Exec
->AlphaFunc
)( n
[1].e
, n
[2].f
);
3994 case OPCODE_BIND_TEXTURE
:
3995 (*ctx
->Exec
->BindTexture
)( n
[1].e
, n
[2].ui
);
3999 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4000 ctx
->Unpack
= _mesa_native_packing
;
4001 (*ctx
->Exec
->Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
4002 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (const GLubyte
*) n
[7].data
);
4003 ctx
->Unpack
= save
; /* restore */
4006 case OPCODE_BLEND_COLOR
:
4007 (*ctx
->Exec
->BlendColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4009 case OPCODE_BLEND_EQUATION
:
4010 (*ctx
->Exec
->BlendEquation
)( n
[1].e
);
4012 case OPCODE_BLEND_FUNC
:
4013 (*ctx
->Exec
->BlendFunc
)( n
[1].e
, n
[2].e
);
4015 case OPCODE_BLEND_FUNC_SEPARATE
:
4016 (*ctx
->Exec
->BlendFuncSeparateEXT
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
4018 case OPCODE_CALL_LIST
:
4019 /* Generated by glCallList(), don't add ListBase */
4020 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4021 execute_list( ctx
, n
[1].ui
);
4024 case OPCODE_CALL_LIST_OFFSET
:
4025 /* Generated by glCallLists() so we must add ListBase */
4026 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4027 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
4031 (*ctx
->Exec
->Clear
)( n
[1].bf
);
4033 case OPCODE_CLEAR_COLOR
:
4034 (*ctx
->Exec
->ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4036 case OPCODE_CLEAR_ACCUM
:
4037 (*ctx
->Exec
->ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4039 case OPCODE_CLEAR_DEPTH
:
4040 (*ctx
->Exec
->ClearDepth
)( (GLclampd
) n
[1].f
);
4042 case OPCODE_CLEAR_INDEX
:
4043 (*ctx
->Exec
->ClearIndex
)( n
[1].ui
);
4045 case OPCODE_CLEAR_STENCIL
:
4046 (*ctx
->Exec
->ClearStencil
)( n
[1].i
);
4048 case OPCODE_CLIP_PLANE
:
4055 (*ctx
->Exec
->ClipPlane
)( n
[1].e
, eq
);
4058 case OPCODE_COLOR_MASK
:
4059 (*ctx
->Exec
->ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
4061 case OPCODE_COLOR_MATERIAL
:
4062 (*ctx
->Exec
->ColorMaterial
)( n
[1].e
, n
[2].e
);
4064 case OPCODE_COLOR_TABLE
:
4066 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4067 ctx
->Unpack
= _mesa_native_packing
;
4068 (*ctx
->Exec
->ColorTable
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
4069 n
[5].e
, n
[6].data
);
4070 ctx
->Unpack
= save
; /* restore */
4073 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
4080 (*ctx
->Exec
->ColorTableParameterfv
)( n
[1].e
, n
[2].e
, params
);
4083 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
4090 (*ctx
->Exec
->ColorTableParameteriv
)( n
[1].e
, n
[2].e
, params
);
4093 case OPCODE_COLOR_SUB_TABLE
:
4095 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4096 ctx
->Unpack
= _mesa_native_packing
;
4097 (*ctx
->Exec
->ColorSubTable
)( n
[1].e
, n
[2].i
, n
[3].i
,
4098 n
[4].e
, n
[5].e
, n
[6].data
);
4099 ctx
->Unpack
= save
; /* restore */
4102 case OPCODE_CONVOLUTION_FILTER_1D
:
4104 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4105 ctx
->Unpack
= _mesa_native_packing
;
4106 (*ctx
->Exec
->ConvolutionFilter1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4107 n
[4].e
, n
[5].e
, n
[6].data
);
4108 ctx
->Unpack
= save
; /* restore */
4111 case OPCODE_CONVOLUTION_FILTER_2D
:
4113 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4114 ctx
->Unpack
= _mesa_native_packing
;
4115 (*ctx
->Exec
->ConvolutionFilter2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4116 n
[4].i
, n
[5].e
, n
[6].e
, n
[7].data
);
4117 ctx
->Unpack
= save
; /* restore */
4120 case OPCODE_CONVOLUTION_PARAMETER_I
:
4121 (*ctx
->Exec
->ConvolutionParameteri
)( n
[1].e
, n
[2].e
, n
[3].i
);
4123 case OPCODE_CONVOLUTION_PARAMETER_IV
:
4130 (*ctx
->Exec
->ConvolutionParameteriv
)( n
[1].e
, n
[2].e
, params
);
4133 case OPCODE_CONVOLUTION_PARAMETER_F
:
4134 (*ctx
->Exec
->ConvolutionParameterf
)( n
[1].e
, n
[2].e
, n
[3].f
);
4136 case OPCODE_CONVOLUTION_PARAMETER_FV
:
4143 (*ctx
->Exec
->ConvolutionParameterfv
)( n
[1].e
, n
[2].e
, params
);
4146 case OPCODE_COPY_COLOR_SUB_TABLE
:
4147 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4148 n
[3].i
, n
[4].i
, n
[5].i
);
4150 case OPCODE_COPY_COLOR_TABLE
:
4151 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4152 n
[3].i
, n
[4].i
, n
[5].i
);
4154 case OPCODE_COPY_PIXELS
:
4155 (*ctx
->Exec
->CopyPixels
)( n
[1].i
, n
[2].i
,
4156 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
4158 case OPCODE_COPY_TEX_IMAGE1D
:
4159 (*ctx
->Exec
->CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4160 n
[5].i
, n
[6].i
, n
[7].i
);
4162 case OPCODE_COPY_TEX_IMAGE2D
:
4163 (*ctx
->Exec
->CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4164 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4166 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
4167 (*ctx
->Exec
->CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4168 n
[4].i
, n
[5].i
, n
[6].i
);
4170 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
4171 (*ctx
->Exec
->CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4172 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4174 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
4175 (*ctx
->Exec
->CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4176 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
4178 case OPCODE_CULL_FACE
:
4179 (*ctx
->Exec
->CullFace
)( n
[1].e
);
4181 case OPCODE_DEPTH_FUNC
:
4182 (*ctx
->Exec
->DepthFunc
)( n
[1].e
);
4184 case OPCODE_DEPTH_MASK
:
4185 (*ctx
->Exec
->DepthMask
)( n
[1].b
);
4187 case OPCODE_DEPTH_RANGE
:
4188 (*ctx
->Exec
->DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
4190 case OPCODE_DISABLE
:
4191 (*ctx
->Exec
->Disable
)( n
[1].e
);
4193 case OPCODE_DRAW_BUFFER
:
4194 (*ctx
->Exec
->DrawBuffer
)( n
[1].e
);
4196 case OPCODE_DRAW_PIXELS
:
4198 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4199 ctx
->Unpack
= _mesa_native_packing
;
4200 (*ctx
->Exec
->DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
4202 ctx
->Unpack
= save
; /* restore */
4206 (*ctx
->Exec
->Enable
)( n
[1].e
);
4208 case OPCODE_EVALMESH1
:
4209 (*ctx
->Exec
->EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
4211 case OPCODE_EVALMESH2
:
4212 (*ctx
->Exec
->EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
4221 (*ctx
->Exec
->Fogfv
)( n
[1].e
, p
);
4224 case OPCODE_FRONT_FACE
:
4225 (*ctx
->Exec
->FrontFace
)( n
[1].e
);
4227 case OPCODE_FRUSTUM
:
4228 (*ctx
->Exec
->Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4231 (*ctx
->Exec
->Hint
)( n
[1].e
, n
[2].e
);
4233 case OPCODE_HISTOGRAM
:
4234 (*ctx
->Exec
->Histogram
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
);
4236 case OPCODE_INDEX_MASK
:
4237 (*ctx
->Exec
->IndexMask
)( n
[1].ui
);
4239 case OPCODE_INIT_NAMES
:
4240 (*ctx
->Exec
->InitNames
)();
4249 (*ctx
->Exec
->Lightfv
)( n
[1].e
, n
[2].e
, p
);
4252 case OPCODE_LIGHT_MODEL
:
4259 (*ctx
->Exec
->LightModelfv
)( n
[1].e
, p
);
4262 case OPCODE_LINE_STIPPLE
:
4263 (*ctx
->Exec
->LineStipple
)( n
[1].i
, n
[2].us
);
4265 case OPCODE_LINE_WIDTH
:
4266 (*ctx
->Exec
->LineWidth
)( n
[1].f
);
4268 case OPCODE_LIST_BASE
:
4269 (*ctx
->Exec
->ListBase
)( n
[1].ui
);
4271 case OPCODE_LOAD_IDENTITY
:
4272 (*ctx
->Exec
->LoadIdentity
)();
4274 case OPCODE_LOAD_MATRIX
:
4275 if (sizeof(Node
)==sizeof(GLfloat
)) {
4276 (*ctx
->Exec
->LoadMatrixf
)( &n
[1].f
);
4281 for (i
=0;i
<16;i
++) {
4284 (*ctx
->Exec
->LoadMatrixf
)( m
);
4287 case OPCODE_LOAD_NAME
:
4288 (*ctx
->Exec
->LoadName
)( n
[1].ui
);
4290 case OPCODE_LOGIC_OP
:
4291 (*ctx
->Exec
->LogicOp
)( n
[1].e
);
4295 GLenum target
= n
[1].e
;
4296 GLint ustride
= _mesa_evaluator_components(target
);
4297 GLint uorder
= n
[5].i
;
4298 GLfloat u1
= n
[2].f
;
4299 GLfloat u2
= n
[3].f
;
4300 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, ustride
, uorder
,
4301 (GLfloat
*) n
[6].data
);
4306 GLenum target
= n
[1].e
;
4307 GLfloat u1
= n
[2].f
;
4308 GLfloat u2
= n
[3].f
;
4309 GLfloat v1
= n
[4].f
;
4310 GLfloat v2
= n
[5].f
;
4311 GLint ustride
= n
[6].i
;
4312 GLint vstride
= n
[7].i
;
4313 GLint uorder
= n
[8].i
;
4314 GLint vorder
= n
[9].i
;
4315 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
4316 v1
, v2
, vstride
, vorder
,
4317 (GLfloat
*) n
[10].data
);
4320 case OPCODE_MAPGRID1
:
4321 (*ctx
->Exec
->MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
4323 case OPCODE_MAPGRID2
:
4324 (*ctx
->Exec
->MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
4326 case OPCODE_MATRIX_MODE
:
4327 (*ctx
->Exec
->MatrixMode
)( n
[1].e
);
4329 case OPCODE_MIN_MAX
:
4330 (*ctx
->Exec
->Minmax
)(n
[1].e
, n
[2].e
, n
[3].b
);
4332 case OPCODE_MULT_MATRIX
:
4333 if (sizeof(Node
)==sizeof(GLfloat
)) {
4334 (*ctx
->Exec
->MultMatrixf
)( &n
[1].f
);
4339 for (i
=0;i
<16;i
++) {
4342 (*ctx
->Exec
->MultMatrixf
)( m
);
4346 (*ctx
->Exec
->Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4348 case OPCODE_PASSTHROUGH
:
4349 (*ctx
->Exec
->PassThrough
)( n
[1].f
);
4351 case OPCODE_PIXEL_MAP
:
4352 (*ctx
->Exec
->PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
4354 case OPCODE_PIXEL_TRANSFER
:
4355 (*ctx
->Exec
->PixelTransferf
)( n
[1].e
, n
[2].f
);
4357 case OPCODE_PIXEL_ZOOM
:
4358 (*ctx
->Exec
->PixelZoom
)( n
[1].f
, n
[2].f
);
4360 case OPCODE_POINT_SIZE
:
4361 (*ctx
->Exec
->PointSize
)( n
[1].f
);
4363 case OPCODE_POINT_PARAMETERS
:
4369 (*ctx
->Exec
->PointParameterfvEXT
)( n
[1].e
, params
);
4372 case OPCODE_POLYGON_MODE
:
4373 (*ctx
->Exec
->PolygonMode
)( n
[1].e
, n
[2].e
);
4375 case OPCODE_POLYGON_STIPPLE
:
4376 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) n
[1].data
);
4378 case OPCODE_POLYGON_OFFSET
:
4379 (*ctx
->Exec
->PolygonOffset
)( n
[1].f
, n
[2].f
);
4381 case OPCODE_POP_ATTRIB
:
4382 (*ctx
->Exec
->PopAttrib
)();
4384 case OPCODE_POP_MATRIX
:
4385 (*ctx
->Exec
->PopMatrix
)();
4387 case OPCODE_POP_NAME
:
4388 (*ctx
->Exec
->PopName
)();
4390 case OPCODE_PRIORITIZE_TEXTURE
:
4391 (*ctx
->Exec
->PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
4393 case OPCODE_PUSH_ATTRIB
:
4394 (*ctx
->Exec
->PushAttrib
)( n
[1].bf
);
4396 case OPCODE_PUSH_MATRIX
:
4397 (*ctx
->Exec
->PushMatrix
)();
4399 case OPCODE_PUSH_NAME
:
4400 (*ctx
->Exec
->PushName
)( n
[1].ui
);
4402 case OPCODE_RASTER_POS
:
4403 (*ctx
->Exec
->RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4405 case OPCODE_READ_BUFFER
:
4406 (*ctx
->Exec
->ReadBuffer
)( n
[1].e
);
4408 case OPCODE_RESET_HISTOGRAM
:
4409 (*ctx
->Exec
->ResetHistogram
)( n
[1].e
);
4411 case OPCODE_RESET_MIN_MAX
:
4412 (*ctx
->Exec
->ResetMinmax
)( n
[1].e
);
4415 (*ctx
->Exec
->Rotatef
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4418 (*ctx
->Exec
->Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4420 case OPCODE_SCISSOR
:
4421 (*ctx
->Exec
->Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
4423 case OPCODE_SHADE_MODEL
:
4424 (*ctx
->Exec
->ShadeModel
)( n
[1].e
);
4426 case OPCODE_STENCIL_FUNC
:
4427 (*ctx
->Exec
->StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
4429 case OPCODE_STENCIL_MASK
:
4430 (*ctx
->Exec
->StencilMask
)( n
[1].ui
);
4432 case OPCODE_STENCIL_OP
:
4433 (*ctx
->Exec
->StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
4442 (*ctx
->Exec
->TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
4452 (*ctx
->Exec
->TexGenfv
)( n
[1].e
, n
[2].e
, params
);
4455 case OPCODE_TEXPARAMETER
:
4462 (*ctx
->Exec
->TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
4465 case OPCODE_TEX_IMAGE1D
:
4467 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4468 ctx
->Unpack
= _mesa_native_packing
;
4469 (*ctx
->Exec
->TexImage1D
)(
4470 n
[1].e
, /* target */
4472 n
[3].i
, /* components */
4474 n
[5].e
, /* border */
4475 n
[6].e
, /* format */
4478 ctx
->Unpack
= save
; /* restore */
4481 case OPCODE_TEX_IMAGE2D
:
4483 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4484 ctx
->Unpack
= _mesa_native_packing
;
4485 (*ctx
->Exec
->TexImage2D
)(
4486 n
[1].e
, /* target */
4488 n
[3].i
, /* components */
4490 n
[5].i
, /* height */
4491 n
[6].e
, /* border */
4492 n
[7].e
, /* format */
4495 ctx
->Unpack
= save
; /* restore */
4498 case OPCODE_TEX_IMAGE3D
:
4500 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4501 ctx
->Unpack
= _mesa_native_packing
;
4502 (*ctx
->Exec
->TexImage3D
)(
4503 n
[1].e
, /* target */
4505 n
[3].i
, /* components */
4507 n
[5].i
, /* height */
4509 n
[7].e
, /* border */
4510 n
[8].e
, /* format */
4513 ctx
->Unpack
= save
; /* restore */
4516 case OPCODE_TEX_SUB_IMAGE1D
:
4518 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4519 ctx
->Unpack
= _mesa_native_packing
;
4520 (*ctx
->Exec
->TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4522 n
[6].e
, n
[7].data
);
4523 ctx
->Unpack
= save
; /* restore */
4526 case OPCODE_TEX_SUB_IMAGE2D
:
4528 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4529 ctx
->Unpack
= _mesa_native_packing
;
4530 (*ctx
->Exec
->TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4532 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
4533 ctx
->Unpack
= save
; /* restore */
4536 case OPCODE_TEX_SUB_IMAGE3D
:
4538 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4539 ctx
->Unpack
= _mesa_native_packing
;
4540 (*ctx
->Exec
->TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4541 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
4542 n
[8].i
, n
[9].e
, n
[10].e
,
4544 ctx
->Unpack
= save
; /* restore */
4547 case OPCODE_TRANSLATE
:
4548 (*ctx
->Exec
->Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4550 case OPCODE_VIEWPORT
:
4551 (*ctx
->Exec
->Viewport
)(n
[1].i
, n
[2].i
,
4552 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
4554 case OPCODE_WINDOW_POS
:
4555 (*ctx
->Exec
->WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4557 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
4558 (*ctx
->Exec
->ActiveTextureARB
)( n
[1].e
);
4560 case OPCODE_CLIENT_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
4561 (*ctx
->Exec
->ClientActiveTextureARB
)( n
[1].e
);
4563 case OPCODE_PIXEL_TEXGEN_SGIX
: /* GL_SGIX_pixel_texture */
4564 (*ctx
->Exec
->PixelTexGenSGIX
)( n
[1].e
);
4566 case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
: /* GL_SGIS_pixel_texture */
4567 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( n
[1].e
, n
[2].i
);
4569 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
4570 (*ctx
->Exec
->CompressedTexImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4571 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].data
);
4573 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
4574 (*ctx
->Exec
->CompressedTexImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4575 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].data
);
4577 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
4578 (*ctx
->Exec
->CompressedTexImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4579 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].data
);
4581 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
4582 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4583 n
[4].i
, n
[5].e
, n
[6].i
, n
[7].data
);
4585 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
4586 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4587 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
, n
[9].data
);
4589 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
4590 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4591 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
4592 n
[9].e
, n
[10].i
, n
[11].data
);
4594 case OPCODE_CONTINUE
:
4595 n
= (Node
*) n
[1].next
;
4597 case OPCODE_END_OF_LIST
:
4603 sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
4604 gl_problem( ctx
, msg
);
4609 /* increment n to point to next compiled command */
4610 if (opcode
!=OPCODE_CONTINUE
) {
4611 n
+= InstSize
[opcode
];
4617 if (ctx
->Driver
.EndCallList
)
4618 ctx
->Driver
.EndCallList( ctx
);
4625 /**********************************************************************/
4627 /**********************************************************************/
4633 * Test if a display list number is valid.
4636 _mesa_IsList( GLuint list
)
4638 GET_CURRENT_CONTEXT(ctx
);
4639 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4640 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
4641 return islist(ctx
, list
);
4646 * Delete a sequence of consecutive display lists.
4649 _mesa_DeleteLists( GLuint list
, GLsizei range
)
4651 GET_CURRENT_CONTEXT(ctx
);
4653 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4654 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4657 gl_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
4660 for (i
=list
;i
<list
+range
;i
++) {
4661 gl_destroy_list( ctx
, i
);
4668 * Return a display list number, n, such that lists n through n+range-1
4672 _mesa_GenLists(GLsizei range
)
4674 GET_CURRENT_CONTEXT(ctx
);
4676 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4677 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
4680 gl_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
4688 * Make this an atomic operation
4690 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
4692 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
4694 /* reserve the list IDs by with empty/dummy lists */
4696 for (i
=0; i
<range
; i
++) {
4697 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
4701 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
4709 * Begin a new display list.
4712 _mesa_NewList( GLuint list
, GLenum mode
)
4714 GET_CURRENT_CONTEXT(ctx
);
4715 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
4716 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4718 if (MESA_VERBOSE
&VERBOSE_API
)
4719 fprintf(stderr
, "glNewList %u %s\n", list
, gl_lookup_enum_by_nr(mode
));
4722 gl_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
4726 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
4727 gl_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
4731 if (ctx
->CurrentListPtr
) {
4732 /* already compiling a display list */
4733 gl_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
4737 /* Allocate new display list */
4738 ctx
->CurrentListNum
= list
;
4739 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
4740 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
4741 ctx
->CurrentPos
= 0;
4742 ctx
->CompileFlag
= GL_TRUE
;
4743 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
4745 ctx
->Driver
.NewList( ctx
, list
, mode
);
4747 ctx
->CurrentDispatch
= ctx
->Save
;
4748 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4754 * End definition of current display list. Is the current
4755 * ASSERT_OUTSIDE_BEGIN_END strong enough to really guarentee that
4756 * we are outside begin/end calls?
4759 _mesa_EndList( void )
4761 GET_CURRENT_CONTEXT(ctx
);
4762 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
4763 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4764 if (MESA_VERBOSE
&VERBOSE_API
)
4765 fprintf(stderr
, "glEndList\n");
4767 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
); /* ??? */
4769 /* Check that a list is under construction */
4770 if (!ctx
->CurrentListPtr
) {
4771 gl_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
4775 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_END_OF_LIST
, 0 );
4777 /* Destroy old list, if any */
4778 gl_destroy_list(ctx
, ctx
->CurrentListNum
);
4779 /* Install the list */
4780 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
4783 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
4784 mesa_print_display_list(ctx
->CurrentListNum
);
4786 ctx
->CurrentListNum
= 0;
4787 ctx
->CurrentListPtr
= NULL
;
4788 ctx
->ExecuteFlag
= GL_TRUE
;
4789 ctx
->CompileFlag
= GL_FALSE
;
4791 ctx
->Driver
.EndList( ctx
);
4793 ctx
->CurrentDispatch
= ctx
->Exec
;
4794 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4801 _mesa_CallList( GLuint list
)
4803 GLboolean save_compile_flag
;
4804 GET_CURRENT_CONTEXT(ctx
);
4805 FLUSH_CURRENT(ctx
, 0);
4806 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
4807 /* execute the display list, and restore the CompileFlag. */
4809 /* mesa_print_display_list( list ); */
4811 save_compile_flag
= ctx
->CompileFlag
;
4812 if (save_compile_flag
) {
4813 ctx
->CompileFlag
= GL_FALSE
;
4816 execute_list( ctx
, list
);
4817 ctx
->CompileFlag
= save_compile_flag
;
4819 /* also restore API function pointers to point to "save" versions */
4820 if (save_compile_flag
) {
4821 ctx
->CurrentDispatch
= ctx
->Save
;
4822 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4829 * Execute glCallLists: call multiple display lists.
4832 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
4834 GET_CURRENT_CONTEXT(ctx
);
4837 GLboolean save_compile_flag
;
4839 /* Save the CompileFlag status, turn it off, execute display list,
4840 * and restore the CompileFlag.
4842 save_compile_flag
= ctx
->CompileFlag
;
4843 ctx
->CompileFlag
= GL_FALSE
;
4846 list
= translate_id( i
, type
, lists
);
4847 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
4850 ctx
->CompileFlag
= save_compile_flag
;
4852 /* also restore API function pointers to point to "save" versions */
4853 if (save_compile_flag
) {
4854 ctx
->CurrentDispatch
= ctx
->Save
;
4855 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4862 * Set the offset added to list numbers in glCallLists.
4865 _mesa_ListBase( GLuint base
)
4867 GET_CURRENT_CONTEXT(ctx
);
4868 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4869 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4870 ctx
->List
.ListBase
= base
;
4874 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
4876 static void exec_Finish( void )
4878 GET_CURRENT_CONTEXT(ctx
);
4879 FLUSH_VERTICES(ctx
, 0);
4880 ctx
->Exec
->Finish();
4883 static void exec_Flush( void )
4885 GET_CURRENT_CONTEXT(ctx
);
4886 FLUSH_VERTICES(ctx
, 0);
4887 ctx
->Exec
->Flush( );
4890 static void exec_GetBooleanv( GLenum pname
, GLboolean
*params
)
4892 GET_CURRENT_CONTEXT(ctx
);
4893 FLUSH_VERTICES(ctx
, 0);
4894 ctx
->Exec
->GetBooleanv( pname
, params
);
4897 static void exec_GetClipPlane( GLenum plane
, GLdouble
*equation
)
4899 GET_CURRENT_CONTEXT(ctx
);
4900 FLUSH_VERTICES(ctx
, 0);
4901 ctx
->Exec
->GetClipPlane( plane
, equation
);
4904 static void exec_GetDoublev( GLenum pname
, GLdouble
*params
)
4906 GET_CURRENT_CONTEXT(ctx
);
4907 FLUSH_VERTICES(ctx
, 0);
4908 ctx
->Exec
->GetDoublev( pname
, params
);
4911 static GLenum
exec_GetError( void )
4913 GET_CURRENT_CONTEXT(ctx
);
4914 FLUSH_VERTICES(ctx
, 0);
4915 return ctx
->Exec
->GetError( );
4918 static void exec_GetFloatv( GLenum pname
, GLfloat
*params
)
4920 GET_CURRENT_CONTEXT(ctx
);
4921 FLUSH_VERTICES(ctx
, 0);
4922 ctx
->Exec
->GetFloatv( pname
, params
);
4925 static void exec_GetIntegerv( GLenum pname
, GLint
*params
)
4927 GET_CURRENT_CONTEXT(ctx
);
4928 FLUSH_VERTICES(ctx
, 0);
4929 ctx
->Exec
->GetIntegerv( pname
, params
);
4932 static void exec_GetLightfv( GLenum light
, GLenum pname
, GLfloat
*params
)
4934 GET_CURRENT_CONTEXT(ctx
);
4935 FLUSH_VERTICES(ctx
, 0);
4936 ctx
->Exec
->GetLightfv( light
, pname
, params
);
4939 static void exec_GetLightiv( GLenum light
, GLenum pname
, GLint
*params
)
4941 GET_CURRENT_CONTEXT(ctx
);
4942 FLUSH_VERTICES(ctx
, 0);
4943 ctx
->Exec
->GetLightiv( light
, pname
, params
);
4946 static void exec_GetMapdv( GLenum target
, GLenum query
, GLdouble
*v
)
4948 GET_CURRENT_CONTEXT(ctx
);
4949 FLUSH_VERTICES(ctx
, 0);
4950 ctx
->Exec
->GetMapdv( target
, query
, v
);
4953 static void exec_GetMapfv( GLenum target
, GLenum query
, GLfloat
*v
)
4955 GET_CURRENT_CONTEXT(ctx
);
4956 FLUSH_VERTICES(ctx
, 0);
4957 ctx
->Exec
->GetMapfv( target
, query
, v
);
4960 static void exec_GetMapiv( GLenum target
, GLenum query
, GLint
*v
)
4962 GET_CURRENT_CONTEXT(ctx
);
4963 FLUSH_VERTICES(ctx
, 0);
4964 ctx
->Exec
->GetMapiv( target
, query
, v
);
4967 static void exec_GetMaterialfv( GLenum face
, GLenum pname
, GLfloat
*params
)
4969 GET_CURRENT_CONTEXT(ctx
);
4970 FLUSH_VERTICES(ctx
, 0);
4971 ctx
->Exec
->GetMaterialfv( face
, pname
, params
);
4974 static void exec_GetMaterialiv( GLenum face
, GLenum pname
, GLint
*params
)
4976 GET_CURRENT_CONTEXT(ctx
);
4977 FLUSH_VERTICES(ctx
, 0);
4978 ctx
->Exec
->GetMaterialiv( face
, pname
, params
);
4981 static void exec_GetPixelMapfv( GLenum map
, GLfloat
*values
)
4983 GET_CURRENT_CONTEXT(ctx
);
4984 FLUSH_VERTICES(ctx
, 0);
4985 ctx
->Exec
->GetPixelMapfv( map
, values
);
4988 static void exec_GetPixelMapuiv( GLenum map
, GLuint
*values
)
4990 GET_CURRENT_CONTEXT(ctx
);
4991 FLUSH_VERTICES(ctx
, 0);
4992 ctx
->Exec
->GetPixelMapuiv( map
, values
);
4995 static void exec_GetPixelMapusv( GLenum map
, GLushort
*values
)
4997 GET_CURRENT_CONTEXT(ctx
);
4998 FLUSH_VERTICES(ctx
, 0);
4999 ctx
->Exec
->GetPixelMapusv( map
, values
);
5002 static void exec_GetPolygonStipple( GLubyte
*dest
)
5004 GET_CURRENT_CONTEXT(ctx
);
5005 FLUSH_VERTICES(ctx
, 0);
5006 ctx
->Exec
->GetPolygonStipple( dest
);
5009 static const GLubyte
*exec_GetString( GLenum name
)
5011 GET_CURRENT_CONTEXT(ctx
);
5012 FLUSH_VERTICES(ctx
, 0);
5013 return ctx
->Exec
->GetString( name
);
5016 static void exec_GetTexEnvfv( GLenum target
, GLenum pname
, GLfloat
*params
)
5018 GET_CURRENT_CONTEXT(ctx
);
5019 FLUSH_VERTICES(ctx
, 0);
5020 ctx
->Exec
->GetTexEnvfv( target
, pname
, params
);
5023 static void exec_GetTexEnviv( GLenum target
, GLenum pname
, GLint
*params
)
5025 GET_CURRENT_CONTEXT(ctx
);
5026 FLUSH_VERTICES(ctx
, 0);
5027 ctx
->Exec
->GetTexEnviv( target
, pname
, params
);
5030 static void exec_GetTexGendv( GLenum coord
, GLenum pname
, GLdouble
*params
)
5032 GET_CURRENT_CONTEXT(ctx
);
5033 FLUSH_VERTICES(ctx
, 0);
5034 ctx
->Exec
->GetTexGendv( coord
, pname
, params
);
5037 static void exec_GetTexGenfv( GLenum coord
, GLenum pname
, GLfloat
*params
)
5039 GET_CURRENT_CONTEXT(ctx
);
5040 FLUSH_VERTICES(ctx
, 0);
5041 ctx
->Exec
->GetTexGenfv( coord
, pname
, params
);
5044 static void exec_GetTexGeniv( GLenum coord
, GLenum pname
, GLint
*params
)
5046 GET_CURRENT_CONTEXT(ctx
);
5047 FLUSH_VERTICES(ctx
, 0);
5048 ctx
->Exec
->GetTexGeniv( coord
, pname
, params
);
5051 static void exec_GetTexImage( GLenum target
, GLint level
, GLenum format
,
5052 GLenum type
, GLvoid
*pixels
)
5054 GET_CURRENT_CONTEXT(ctx
);
5055 FLUSH_VERTICES(ctx
, 0);
5056 ctx
->Exec
->GetTexImage( target
, level
, format
, type
, pixels
);
5059 static void exec_GetTexLevelParameterfv( GLenum target
, GLint level
,
5060 GLenum pname
, GLfloat
*params
)
5062 GET_CURRENT_CONTEXT(ctx
);
5063 FLUSH_VERTICES(ctx
, 0);
5064 ctx
->Exec
->GetTexLevelParameterfv( target
, level
, pname
, params
);
5067 static void exec_GetTexLevelParameteriv( GLenum target
, GLint level
,
5068 GLenum pname
, GLint
*params
)
5070 GET_CURRENT_CONTEXT(ctx
);
5071 FLUSH_VERTICES(ctx
, 0);
5072 ctx
->Exec
->GetTexLevelParameteriv( target
, level
, pname
, params
);
5075 static void exec_GetTexParameterfv( GLenum target
, GLenum pname
,
5078 GET_CURRENT_CONTEXT(ctx
);
5079 FLUSH_VERTICES(ctx
, 0);
5080 ctx
->Exec
->GetTexParameterfv( target
, pname
, params
);
5083 static void exec_GetTexParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
5085 GET_CURRENT_CONTEXT(ctx
);
5086 FLUSH_VERTICES(ctx
, 0);
5087 ctx
->Exec
->GetTexParameteriv( target
, pname
, params
);
5090 static GLboolean
exec_IsEnabled( GLenum cap
)
5092 GET_CURRENT_CONTEXT(ctx
);
5093 FLUSH_VERTICES(ctx
, 0);
5094 return ctx
->Exec
->IsEnabled( cap
);
5097 static void exec_PixelStoref( GLenum pname
, GLfloat param
)
5099 GET_CURRENT_CONTEXT(ctx
);
5100 FLUSH_VERTICES(ctx
, 0);
5101 ctx
->Exec
->PixelStoref( pname
, param
);
5104 static void exec_PixelStorei( GLenum pname
, GLint param
)
5106 GET_CURRENT_CONTEXT(ctx
);
5107 FLUSH_VERTICES(ctx
, 0);
5108 ctx
->Exec
->PixelStorei( pname
, param
);
5111 static void exec_ReadPixels( GLint x
, GLint y
, GLsizei width
, GLsizei height
,
5112 GLenum format
, GLenum type
, GLvoid
*pixels
)
5114 GET_CURRENT_CONTEXT(ctx
);
5115 FLUSH_VERTICES(ctx
, 0);
5116 ctx
->Exec
->ReadPixels( x
, y
, width
, height
, format
, type
, pixels
);
5119 static GLint
exec_RenderMode( GLenum mode
)
5121 GET_CURRENT_CONTEXT(ctx
);
5122 FLUSH_VERTICES(ctx
, 0);
5123 return ctx
->Exec
->RenderMode( mode
);
5126 static void exec_FeedbackBuffer( GLsizei size
, GLenum type
, GLfloat
*buffer
)
5128 GET_CURRENT_CONTEXT(ctx
);
5129 FLUSH_VERTICES(ctx
, 0);
5130 ctx
->Exec
->FeedbackBuffer( size
, type
, buffer
);
5133 static void exec_SelectBuffer( GLsizei size
, GLuint
*buffer
)
5135 GET_CURRENT_CONTEXT(ctx
);
5136 FLUSH_VERTICES(ctx
, 0);
5137 ctx
->Exec
->SelectBuffer( size
, buffer
);
5140 static GLboolean
exec_AreTexturesResident(GLsizei n
, const GLuint
*texName
,
5141 GLboolean
*residences
)
5143 GET_CURRENT_CONTEXT(ctx
);
5144 FLUSH_VERTICES(ctx
, 0);
5145 return ctx
->Exec
->AreTexturesResident( n
, texName
, residences
);
5148 static void exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
,
5151 GET_CURRENT_CONTEXT(ctx
);
5152 FLUSH_VERTICES(ctx
, 0);
5153 ctx
->Exec
->ColorPointer( size
, type
, stride
, ptr
);
5156 static void exec_DeleteTextures( GLsizei n
, const GLuint
*texName
)
5158 GET_CURRENT_CONTEXT(ctx
);
5159 FLUSH_VERTICES(ctx
, 0);
5160 ctx
->Exec
->DeleteTextures( n
, texName
);
5163 static void exec_DisableClientState( GLenum cap
)
5165 GET_CURRENT_CONTEXT(ctx
);
5166 FLUSH_VERTICES(ctx
, 0);
5167 ctx
->Exec
->DisableClientState( cap
);
5170 static void exec_EdgeFlagPointer(GLsizei stride
, const void *vptr
)
5172 GET_CURRENT_CONTEXT(ctx
);
5173 FLUSH_VERTICES(ctx
, 0);
5174 ctx
->Exec
->EdgeFlagPointer( stride
, vptr
);
5177 static void exec_EnableClientState( GLenum cap
)
5179 GET_CURRENT_CONTEXT(ctx
);
5180 FLUSH_VERTICES(ctx
, 0);
5181 ctx
->Exec
->EnableClientState( cap
);
5184 static void exec_GenTextures( GLsizei n
, GLuint
*texName
)
5186 GET_CURRENT_CONTEXT(ctx
);
5187 FLUSH_VERTICES(ctx
, 0);
5188 ctx
->Exec
->GenTextures( n
, texName
);
5191 static void exec_GetPointerv( GLenum pname
, GLvoid
**params
)
5193 GET_CURRENT_CONTEXT(ctx
);
5194 FLUSH_VERTICES(ctx
, 0);
5195 ctx
->Exec
->GetPointerv( pname
, params
);
5198 static void exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5200 GET_CURRENT_CONTEXT(ctx
);
5201 FLUSH_VERTICES(ctx
, 0);
5202 ctx
->Exec
->IndexPointer( type
, stride
, ptr
);
5205 static void exec_InterleavedArrays(GLenum format
, GLsizei stride
,
5206 const GLvoid
*pointer
)
5208 GET_CURRENT_CONTEXT(ctx
);
5209 FLUSH_VERTICES(ctx
, 0);
5210 ctx
->Exec
->InterleavedArrays( format
, stride
, pointer
);
5213 static GLboolean
exec_IsTexture( GLuint texture
)
5215 GET_CURRENT_CONTEXT(ctx
);
5216 FLUSH_VERTICES(ctx
, 0);
5217 return ctx
->Exec
->IsTexture( texture
);
5220 static void exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5222 GET_CURRENT_CONTEXT(ctx
);
5223 FLUSH_VERTICES(ctx
, 0);
5224 ctx
->Exec
->NormalPointer( type
, stride
, ptr
);
5227 static void exec_PopClientAttrib(void)
5229 GET_CURRENT_CONTEXT(ctx
);
5230 FLUSH_VERTICES(ctx
, 0);
5231 ctx
->Exec
->PopClientAttrib();
5234 static void exec_PushClientAttrib(GLbitfield mask
)
5236 GET_CURRENT_CONTEXT(ctx
);
5237 FLUSH_VERTICES(ctx
, 0);
5238 ctx
->Exec
->PushClientAttrib( mask
);
5241 static void exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
5244 GET_CURRENT_CONTEXT(ctx
);
5245 FLUSH_VERTICES(ctx
, 0);
5246 ctx
->Exec
->TexCoordPointer( size
, type
, stride
, ptr
);
5249 static void exec_GetCompressedTexImageARB(GLenum target
, GLint level
,
5252 GET_CURRENT_CONTEXT(ctx
);
5253 FLUSH_VERTICES(ctx
, 0);
5254 ctx
->Exec
->GetCompressedTexImageARB( target
, level
, img
);
5257 static void exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
5260 GET_CURRENT_CONTEXT(ctx
);
5261 FLUSH_VERTICES(ctx
, 0);
5262 ctx
->Exec
->VertexPointer( size
, type
, stride
, ptr
);
5265 static void exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
5266 GLint x
, GLint y
, GLsizei width
)
5268 GET_CURRENT_CONTEXT(ctx
);
5269 FLUSH_VERTICES(ctx
, 0);
5270 ctx
->Exec
->CopyConvolutionFilter1D( target
, internalFormat
, x
, y
, width
);
5273 static void exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
5274 GLint x
, GLint y
, GLsizei width
,
5277 GET_CURRENT_CONTEXT(ctx
);
5278 FLUSH_VERTICES(ctx
, 0);
5279 ctx
->Exec
->CopyConvolutionFilter2D( target
, internalFormat
, x
, y
, width
,
5283 static void exec_GetColorTable( GLenum target
, GLenum format
,
5284 GLenum type
, GLvoid
*data
)
5286 GET_CURRENT_CONTEXT(ctx
);
5287 FLUSH_VERTICES(ctx
, 0);
5288 ctx
->Exec
->GetColorTable( target
, format
, type
, data
);
5291 static void exec_GetColorTableParameterfv( GLenum target
, GLenum pname
,
5294 GET_CURRENT_CONTEXT(ctx
);
5295 FLUSH_VERTICES(ctx
, 0);
5296 ctx
->Exec
->GetColorTableParameterfv( target
, pname
, params
);
5299 static void exec_GetColorTableParameteriv( GLenum target
, GLenum pname
,
5302 GET_CURRENT_CONTEXT(ctx
);
5303 FLUSH_VERTICES(ctx
, 0);
5304 ctx
->Exec
->GetColorTableParameteriv( target
, pname
, params
);
5307 static void exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
5310 GET_CURRENT_CONTEXT(ctx
);
5311 FLUSH_VERTICES(ctx
, 0);
5312 ctx
->Exec
->GetConvolutionFilter( target
, format
, type
, image
);
5315 static void exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
,
5318 GET_CURRENT_CONTEXT(ctx
);
5319 FLUSH_VERTICES(ctx
, 0);
5320 ctx
->Exec
->GetConvolutionParameterfv( target
, pname
, params
);
5323 static void exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
,
5326 GET_CURRENT_CONTEXT(ctx
);
5327 FLUSH_VERTICES(ctx
, 0);
5328 ctx
->Exec
->GetConvolutionParameteriv( target
, pname
, params
);
5331 static void exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
5332 GLenum type
, GLvoid
*values
)
5334 GET_CURRENT_CONTEXT(ctx
);
5335 FLUSH_VERTICES(ctx
, 0);
5336 ctx
->Exec
->GetHistogram( target
, reset
, format
, type
, values
);
5339 static void exec_GetHistogramParameterfv(GLenum target
, GLenum pname
,
5342 GET_CURRENT_CONTEXT(ctx
);
5343 FLUSH_VERTICES(ctx
, 0);
5344 ctx
->Exec
->GetHistogramParameterfv( target
, pname
, params
);
5347 static void exec_GetHistogramParameteriv(GLenum target
, GLenum pname
,
5350 GET_CURRENT_CONTEXT(ctx
);
5351 FLUSH_VERTICES(ctx
, 0);
5352 ctx
->Exec
->GetHistogramParameteriv( target
, pname
, params
);
5355 static void exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
5356 GLenum type
, GLvoid
*values
)
5358 GET_CURRENT_CONTEXT(ctx
);
5359 FLUSH_VERTICES(ctx
, 0);
5360 ctx
->Exec
->GetMinmax( target
, reset
, format
, type
, values
);
5363 static void exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
,
5366 GET_CURRENT_CONTEXT(ctx
);
5367 FLUSH_VERTICES(ctx
, 0);
5368 ctx
->Exec
->GetMinmaxParameterfv( target
, pname
, params
);
5371 static void exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
,
5374 GET_CURRENT_CONTEXT(ctx
);
5375 FLUSH_VERTICES(ctx
, 0);
5376 ctx
->Exec
->GetMinmaxParameteriv( target
, pname
, params
);
5379 static void exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
5380 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
5382 GET_CURRENT_CONTEXT(ctx
);
5383 FLUSH_VERTICES(ctx
, 0);
5384 ctx
->Exec
->GetSeparableFilter( target
, format
, type
, row
, column
, span
);
5387 static void exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
5388 GLsizei width
, GLsizei height
, GLenum format
,
5389 GLenum type
, const GLvoid
*row
,
5390 const GLvoid
*column
)
5392 GET_CURRENT_CONTEXT(ctx
);
5393 FLUSH_VERTICES(ctx
, 0);
5394 ctx
->Exec
->SeparableFilter2D( target
, internalFormat
, width
, height
, format
,
5398 static void exec_GetPixelTexGenParameterivSGIS(GLenum target
, GLint
*value
)
5400 GET_CURRENT_CONTEXT(ctx
);
5401 FLUSH_VERTICES(ctx
, 0);
5402 ctx
->Exec
->GetPixelTexGenParameterivSGIS( target
, value
);
5405 static void exec_GetPixelTexGenParameterfvSGIS(GLenum target
, GLfloat
*value
)
5407 GET_CURRENT_CONTEXT(ctx
);
5408 FLUSH_VERTICES(ctx
, 0);
5409 ctx
->Exec
->GetPixelTexGenParameterfvSGIS( target
, value
);
5412 static void exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5413 GLsizei count
, const GLvoid
*ptr
)
5415 GET_CURRENT_CONTEXT(ctx
);
5416 FLUSH_VERTICES(ctx
, 0);
5417 ctx
->Exec
->ColorPointerEXT( size
, type
, stride
, count
, ptr
);
5420 static void exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
,
5421 const GLboolean
*ptr
)
5423 GET_CURRENT_CONTEXT(ctx
);
5424 FLUSH_VERTICES(ctx
, 0);
5425 ctx
->Exec
->EdgeFlagPointerEXT( stride
, count
, ptr
);
5428 static void exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
5431 GET_CURRENT_CONTEXT(ctx
);
5432 FLUSH_VERTICES(ctx
, 0);
5433 ctx
->Exec
->IndexPointerEXT( type
, stride
, count
, ptr
);
5436 static void exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
5439 GET_CURRENT_CONTEXT(ctx
);
5440 FLUSH_VERTICES(ctx
, 0);
5441 ctx
->Exec
->NormalPointerEXT( type
, stride
, count
, ptr
);
5444 static void exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5445 GLsizei count
, const GLvoid
*ptr
)
5447 GET_CURRENT_CONTEXT(ctx
);
5448 FLUSH_VERTICES(ctx
, 0);
5449 ctx
->Exec
->TexCoordPointerEXT( size
, type
, stride
, count
, ptr
);
5452 static void exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5453 GLsizei count
, const GLvoid
*ptr
)
5455 GET_CURRENT_CONTEXT(ctx
);
5456 FLUSH_VERTICES(ctx
, 0);
5457 ctx
->Exec
->VertexPointerEXT( size
, type
, stride
, count
, ptr
);
5460 static void exec_LockArraysEXT(GLint first
, GLsizei count
)
5462 GET_CURRENT_CONTEXT(ctx
);
5463 FLUSH_VERTICES(ctx
, 0);
5464 ctx
->Exec
->LockArraysEXT( first
, count
);
5467 static void exec_UnlockArraysEXT( void )
5469 GET_CURRENT_CONTEXT(ctx
);
5470 FLUSH_VERTICES(ctx
, 0);
5471 ctx
->Exec
->UnlockArraysEXT( );
5474 static void exec_ResizeBuffersMESA( void )
5476 GET_CURRENT_CONTEXT(ctx
);
5477 FLUSH_VERTICES(ctx
, 0);
5478 ctx
->Exec
->ResizeBuffersMESA( );
5481 static void exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
5482 GLsizei stride
, const GLvoid
*ptr
)
5484 GET_CURRENT_CONTEXT(ctx
);
5485 FLUSH_VERTICES(ctx
, 0);
5486 ctx
->Exec
->SecondaryColorPointerEXT( size
, type
, stride
, ptr
);
5489 static void exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
,
5492 GET_CURRENT_CONTEXT(ctx
);
5493 FLUSH_VERTICES(ctx
, 0);
5494 ctx
->Exec
->FogCoordPointerEXT( type
, stride
, ptr
);
5499 * Assign all the pointers in <table> to point to Mesa's display list
5500 * building functions.
5502 * This does not include any of the tnl functions - they are
5503 * initialized from _mesa_init_api_defaults and from the active vtxfmt
5507 _mesa_init_dlist_table( struct _glapi_table
*table
, GLuint tableSize
)
5509 _mesa_init_no_op_table(table
, tableSize
);
5511 _mesa_loopback_init_api_table( table
, GL_FALSE
);
5514 table
->Accum
= save_Accum
;
5515 table
->AlphaFunc
= save_AlphaFunc
;
5516 table
->Bitmap
= save_Bitmap
;
5517 table
->BlendFunc
= save_BlendFunc
;
5518 table
->CallList
= _mesa_save_CallList
;
5519 table
->CallLists
= _mesa_save_CallLists
;
5520 table
->Clear
= save_Clear
;
5521 table
->ClearAccum
= save_ClearAccum
;
5522 table
->ClearColor
= save_ClearColor
;
5523 table
->ClearDepth
= save_ClearDepth
;
5524 table
->ClearIndex
= save_ClearIndex
;
5525 table
->ClearStencil
= save_ClearStencil
;
5526 table
->ClipPlane
= save_ClipPlane
;
5527 table
->ColorMask
= save_ColorMask
;
5528 table
->ColorMaterial
= save_ColorMaterial
;
5529 table
->CopyPixels
= save_CopyPixels
;
5530 table
->CullFace
= save_CullFace
;
5531 table
->DeleteLists
= _mesa_DeleteLists
;
5532 table
->DepthFunc
= save_DepthFunc
;
5533 table
->DepthMask
= save_DepthMask
;
5534 table
->DepthRange
= save_DepthRange
;
5535 table
->Disable
= save_Disable
;
5536 table
->DrawBuffer
= save_DrawBuffer
;
5537 table
->DrawPixels
= save_DrawPixels
;
5538 table
->Enable
= save_Enable
;
5539 table
->EndList
= _mesa_EndList
;
5540 table
->EvalMesh1
= _mesa_save_EvalMesh1
;
5541 table
->EvalMesh2
= _mesa_save_EvalMesh2
;
5542 table
->Finish
= exec_Finish
;
5543 table
->Flush
= exec_Flush
;
5544 table
->Fogf
= save_Fogf
;
5545 table
->Fogfv
= save_Fogfv
;
5546 table
->Fogi
= save_Fogi
;
5547 table
->Fogiv
= save_Fogiv
;
5548 table
->FrontFace
= save_FrontFace
;
5549 table
->Frustum
= save_Frustum
;
5550 table
->GenLists
= _mesa_GenLists
;
5551 table
->GetBooleanv
= exec_GetBooleanv
;
5552 table
->GetClipPlane
= exec_GetClipPlane
;
5553 table
->GetDoublev
= exec_GetDoublev
;
5554 table
->GetError
= exec_GetError
;
5555 table
->GetFloatv
= exec_GetFloatv
;
5556 table
->GetIntegerv
= exec_GetIntegerv
;
5557 table
->GetLightfv
= exec_GetLightfv
;
5558 table
->GetLightiv
= exec_GetLightiv
;
5559 table
->GetMapdv
= exec_GetMapdv
;
5560 table
->GetMapfv
= exec_GetMapfv
;
5561 table
->GetMapiv
= exec_GetMapiv
;
5562 table
->GetMaterialfv
= exec_GetMaterialfv
;
5563 table
->GetMaterialiv
= exec_GetMaterialiv
;
5564 table
->GetPixelMapfv
= exec_GetPixelMapfv
;
5565 table
->GetPixelMapuiv
= exec_GetPixelMapuiv
;
5566 table
->GetPixelMapusv
= exec_GetPixelMapusv
;
5567 table
->GetPolygonStipple
= exec_GetPolygonStipple
;
5568 table
->GetString
= exec_GetString
;
5569 table
->GetTexEnvfv
= exec_GetTexEnvfv
;
5570 table
->GetTexEnviv
= exec_GetTexEnviv
;
5571 table
->GetTexGendv
= exec_GetTexGendv
;
5572 table
->GetTexGenfv
= exec_GetTexGenfv
;
5573 table
->GetTexGeniv
= exec_GetTexGeniv
;
5574 table
->GetTexImage
= exec_GetTexImage
;
5575 table
->GetTexLevelParameterfv
= exec_GetTexLevelParameterfv
;
5576 table
->GetTexLevelParameteriv
= exec_GetTexLevelParameteriv
;
5577 table
->GetTexParameterfv
= exec_GetTexParameterfv
;
5578 table
->GetTexParameteriv
= exec_GetTexParameteriv
;
5579 table
->Hint
= save_Hint
;
5580 table
->IndexMask
= save_IndexMask
;
5581 table
->InitNames
= save_InitNames
;
5582 table
->IsEnabled
= exec_IsEnabled
;
5583 table
->IsList
= _mesa_IsList
;
5584 table
->LightModelf
= save_LightModelf
;
5585 table
->LightModelfv
= save_LightModelfv
;
5586 table
->LightModeli
= save_LightModeli
;
5587 table
->LightModeliv
= save_LightModeliv
;
5588 table
->Lightf
= save_Lightf
;
5589 table
->Lightfv
= save_Lightfv
;
5590 table
->Lighti
= save_Lighti
;
5591 table
->Lightiv
= save_Lightiv
;
5592 table
->LineStipple
= save_LineStipple
;
5593 table
->LineWidth
= save_LineWidth
;
5594 table
->ListBase
= save_ListBase
;
5595 table
->LoadIdentity
= save_LoadIdentity
;
5596 table
->LoadMatrixd
= save_LoadMatrixd
;
5597 table
->LoadMatrixf
= save_LoadMatrixf
;
5598 table
->LoadName
= save_LoadName
;
5599 table
->LogicOp
= save_LogicOp
;
5600 table
->Map1d
= save_Map1d
;
5601 table
->Map1f
= save_Map1f
;
5602 table
->Map2d
= save_Map2d
;
5603 table
->Map2f
= save_Map2f
;
5604 table
->MapGrid1d
= save_MapGrid1d
;
5605 table
->MapGrid1f
= save_MapGrid1f
;
5606 table
->MapGrid2d
= save_MapGrid2d
;
5607 table
->MapGrid2f
= save_MapGrid2f
;
5608 table
->MatrixMode
= save_MatrixMode
;
5609 table
->MultMatrixd
= save_MultMatrixd
;
5610 table
->MultMatrixf
= save_MultMatrixf
;
5611 table
->NewList
= save_NewList
;
5612 table
->Ortho
= save_Ortho
;
5613 table
->PassThrough
= save_PassThrough
;
5614 table
->PixelMapfv
= save_PixelMapfv
;
5615 table
->PixelMapuiv
= save_PixelMapuiv
;
5616 table
->PixelMapusv
= save_PixelMapusv
;
5617 table
->PixelStoref
= exec_PixelStoref
;
5618 table
->PixelStorei
= exec_PixelStorei
;
5619 table
->PixelTransferf
= save_PixelTransferf
;
5620 table
->PixelTransferi
= save_PixelTransferi
;
5621 table
->PixelZoom
= save_PixelZoom
;
5622 table
->PointSize
= save_PointSize
;
5623 table
->PolygonMode
= save_PolygonMode
;
5624 table
->PolygonOffset
= save_PolygonOffset
;
5625 table
->PolygonStipple
= save_PolygonStipple
;
5626 table
->PopAttrib
= save_PopAttrib
;
5627 table
->PopMatrix
= save_PopMatrix
;
5628 table
->PopName
= save_PopName
;
5629 table
->PushAttrib
= save_PushAttrib
;
5630 table
->PushMatrix
= save_PushMatrix
;
5631 table
->PushName
= save_PushName
;
5632 table
->RasterPos2d
= save_RasterPos2d
;
5633 table
->RasterPos2dv
= save_RasterPos2dv
;
5634 table
->RasterPos2f
= save_RasterPos2f
;
5635 table
->RasterPos2fv
= save_RasterPos2fv
;
5636 table
->RasterPos2i
= save_RasterPos2i
;
5637 table
->RasterPos2iv
= save_RasterPos2iv
;
5638 table
->RasterPos2s
= save_RasterPos2s
;
5639 table
->RasterPos2sv
= save_RasterPos2sv
;
5640 table
->RasterPos3d
= save_RasterPos3d
;
5641 table
->RasterPos3dv
= save_RasterPos3dv
;
5642 table
->RasterPos3f
= save_RasterPos3f
;
5643 table
->RasterPos3fv
= save_RasterPos3fv
;
5644 table
->RasterPos3i
= save_RasterPos3i
;
5645 table
->RasterPos3iv
= save_RasterPos3iv
;
5646 table
->RasterPos3s
= save_RasterPos3s
;
5647 table
->RasterPos3sv
= save_RasterPos3sv
;
5648 table
->RasterPos4d
= save_RasterPos4d
;
5649 table
->RasterPos4dv
= save_RasterPos4dv
;
5650 table
->RasterPos4f
= save_RasterPos4f
;
5651 table
->RasterPos4fv
= save_RasterPos4fv
;
5652 table
->RasterPos4i
= save_RasterPos4i
;
5653 table
->RasterPos4iv
= save_RasterPos4iv
;
5654 table
->RasterPos4s
= save_RasterPos4s
;
5655 table
->RasterPos4sv
= save_RasterPos4sv
;
5656 table
->ReadBuffer
= save_ReadBuffer
;
5657 table
->ReadPixels
= exec_ReadPixels
;
5658 table
->RenderMode
= exec_RenderMode
;
5659 table
->Rotated
= save_Rotated
;
5660 table
->Rotatef
= save_Rotatef
;
5661 table
->Scaled
= save_Scaled
;
5662 table
->Scalef
= save_Scalef
;
5663 table
->Scissor
= save_Scissor
;
5664 table
->FeedbackBuffer
= exec_FeedbackBuffer
;
5665 table
->SelectBuffer
= exec_SelectBuffer
;
5666 table
->ShadeModel
= save_ShadeModel
;
5667 table
->StencilFunc
= save_StencilFunc
;
5668 table
->StencilMask
= save_StencilMask
;
5669 table
->StencilOp
= save_StencilOp
;
5670 table
->TexEnvf
= save_TexEnvf
;
5671 table
->TexEnvfv
= save_TexEnvfv
;
5672 table
->TexEnvi
= save_TexEnvi
;
5673 table
->TexEnviv
= save_TexEnviv
;
5674 table
->TexGend
= save_TexGend
;
5675 table
->TexGendv
= save_TexGendv
;
5676 table
->TexGenf
= save_TexGenf
;
5677 table
->TexGenfv
= save_TexGenfv
;
5678 table
->TexGeni
= save_TexGeni
;
5679 table
->TexGeniv
= save_TexGeniv
;
5680 table
->TexImage1D
= save_TexImage1D
;
5681 table
->TexImage2D
= save_TexImage2D
;
5682 table
->TexParameterf
= save_TexParameterf
;
5683 table
->TexParameterfv
= save_TexParameterfv
;
5684 table
->TexParameteri
= save_TexParameteri
;
5685 table
->TexParameteriv
= save_TexParameteriv
;
5686 table
->Translated
= save_Translated
;
5687 table
->Translatef
= save_Translatef
;
5688 table
->Viewport
= save_Viewport
;
5691 table
->AreTexturesResident
= exec_AreTexturesResident
;
5692 table
->BindTexture
= save_BindTexture
;
5693 table
->ColorPointer
= exec_ColorPointer
;
5694 table
->CopyTexImage1D
= save_CopyTexImage1D
;
5695 table
->CopyTexImage2D
= save_CopyTexImage2D
;
5696 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
5697 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
5698 table
->DeleteTextures
= exec_DeleteTextures
;
5699 table
->DisableClientState
= exec_DisableClientState
;
5700 table
->EdgeFlagPointer
= exec_EdgeFlagPointer
;
5701 table
->EnableClientState
= exec_EnableClientState
;
5702 table
->GenTextures
= exec_GenTextures
;
5703 table
->GetPointerv
= exec_GetPointerv
;
5704 table
->IndexPointer
= exec_IndexPointer
;
5705 table
->InterleavedArrays
= exec_InterleavedArrays
;
5706 table
->IsTexture
= exec_IsTexture
;
5707 table
->NormalPointer
= exec_NormalPointer
;
5708 table
->PopClientAttrib
= exec_PopClientAttrib
;
5709 table
->PrioritizeTextures
= save_PrioritizeTextures
;
5710 table
->PushClientAttrib
= exec_PushClientAttrib
;
5711 table
->TexCoordPointer
= exec_TexCoordPointer
;
5712 table
->TexSubImage1D
= save_TexSubImage1D
;
5713 table
->TexSubImage2D
= save_TexSubImage2D
;
5714 table
->VertexPointer
= exec_VertexPointer
;
5717 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
5718 table
->TexImage3D
= save_TexImage3D
;
5719 table
->TexSubImage3D
= save_TexSubImage3D
;
5721 /* GL_ARB_imaging */
5722 /* Not all are supported */
5723 table
->BlendColor
= save_BlendColor
;
5724 table
->BlendEquation
= save_BlendEquation
;
5725 table
->ColorSubTable
= save_ColorSubTable
;
5726 table
->ColorTable
= save_ColorTable
;
5727 table
->ColorTableParameterfv
= save_ColorTableParameterfv
;
5728 table
->ColorTableParameteriv
= save_ColorTableParameteriv
;
5729 table
->ConvolutionFilter1D
= save_ConvolutionFilter1D
;
5730 table
->ConvolutionFilter2D
= save_ConvolutionFilter2D
;
5731 table
->ConvolutionParameterf
= save_ConvolutionParameterf
;
5732 table
->ConvolutionParameterfv
= save_ConvolutionParameterfv
;
5733 table
->ConvolutionParameteri
= save_ConvolutionParameteri
;
5734 table
->ConvolutionParameteriv
= save_ConvolutionParameteriv
;
5735 table
->CopyColorSubTable
= save_CopyColorSubTable
;
5736 table
->CopyColorTable
= save_CopyColorTable
;
5737 table
->CopyConvolutionFilter1D
= exec_CopyConvolutionFilter1D
;
5738 table
->CopyConvolutionFilter2D
= exec_CopyConvolutionFilter2D
;
5739 table
->GetColorTable
= exec_GetColorTable
;
5740 table
->GetColorTableParameterfv
= exec_GetColorTableParameterfv
;
5741 table
->GetColorTableParameteriv
= exec_GetColorTableParameteriv
;
5742 table
->GetConvolutionFilter
= exec_GetConvolutionFilter
;
5743 table
->GetConvolutionParameterfv
= exec_GetConvolutionParameterfv
;
5744 table
->GetConvolutionParameteriv
= exec_GetConvolutionParameteriv
;
5745 table
->GetHistogram
= exec_GetHistogram
;
5746 table
->GetHistogramParameterfv
= exec_GetHistogramParameterfv
;
5747 table
->GetHistogramParameteriv
= exec_GetHistogramParameteriv
;
5748 table
->GetMinmax
= exec_GetMinmax
;
5749 table
->GetMinmaxParameterfv
= exec_GetMinmaxParameterfv
;
5750 table
->GetMinmaxParameteriv
= exec_GetMinmaxParameteriv
;
5751 table
->GetSeparableFilter
= exec_GetSeparableFilter
;
5752 table
->Histogram
= save_Histogram
;
5753 table
->Minmax
= save_Minmax
;
5754 table
->ResetHistogram
= save_ResetHistogram
;
5755 table
->ResetMinmax
= save_ResetMinmax
;
5756 table
->SeparableFilter2D
= exec_SeparableFilter2D
;
5758 /* 2. GL_EXT_blend_color */
5760 table
->BlendColorEXT
= save_BlendColorEXT
;
5763 /* 3. GL_EXT_polygon_offset */
5764 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
5766 /* 6. GL_EXT_texture3d */
5768 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
5769 table
->TexImage3DEXT
= save_TexImage3DEXT
;
5770 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
5773 /* 15. GL_SGIX_pixel_texture */
5774 table
->PixelTexGenSGIX
= save_PixelTexGenSGIX
;
5776 /* 15. GL_SGIS_pixel_texture */
5777 table
->PixelTexGenParameteriSGIS
= save_PixelTexGenParameteriSGIS
;
5778 table
->PixelTexGenParameterfSGIS
= save_PixelTexGenParameterfSGIS
;
5779 table
->PixelTexGenParameterivSGIS
= save_PixelTexGenParameterivSGIS
;
5780 table
->PixelTexGenParameterfvSGIS
= save_PixelTexGenParameterfvSGIS
;
5781 table
->GetPixelTexGenParameterivSGIS
= exec_GetPixelTexGenParameterivSGIS
;
5782 table
->GetPixelTexGenParameterfvSGIS
= exec_GetPixelTexGenParameterfvSGIS
;
5784 /* 30. GL_EXT_vertex_array */
5785 table
->ColorPointerEXT
= exec_ColorPointerEXT
;
5786 table
->EdgeFlagPointerEXT
= exec_EdgeFlagPointerEXT
;
5787 table
->IndexPointerEXT
= exec_IndexPointerEXT
;
5788 table
->NormalPointerEXT
= exec_NormalPointerEXT
;
5789 table
->TexCoordPointerEXT
= exec_TexCoordPointerEXT
;
5790 table
->VertexPointerEXT
= exec_VertexPointerEXT
;
5792 /* 37. GL_EXT_blend_minmax */
5794 table
->BlendEquationEXT
= save_BlendEquationEXT
;
5797 /* 54. GL_EXT_point_parameters */
5798 table
->PointParameterfEXT
= save_PointParameterfEXT
;
5799 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
5801 /* 78. GL_EXT_paletted_texture */
5803 table
->ColorTableEXT
= save_ColorTable
;
5804 table
->ColorSubTableEXT
= save_ColorSubTable
;
5806 table
->GetColorTableEXT
= exec_GetColorTable
;
5807 table
->GetColorTableParameterfvEXT
= exec_GetColorTableParameterfv
;
5808 table
->GetColorTableParameterivEXT
= exec_GetColorTableParameteriv
;
5810 /* 97. GL_EXT_compiled_vertex_array */
5811 table
->LockArraysEXT
= exec_LockArraysEXT
;
5812 table
->UnlockArraysEXT
= exec_UnlockArraysEXT
;
5814 /* GL_ARB_multitexture */
5815 table
->ActiveTextureARB
= save_ActiveTextureARB
;
5816 table
->ClientActiveTextureARB
= save_ClientActiveTextureARB
;
5818 /* GL_EXT_blend_func_separate */
5819 table
->BlendFuncSeparateEXT
= save_BlendFuncSeparateEXT
;
5821 /* GL_MESA_window_pos */
5822 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
5823 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
5824 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
5825 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
5826 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
5827 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
5828 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
5829 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
5830 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
5831 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
5832 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
5833 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
5834 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
5835 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
5836 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
5837 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
5838 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
5839 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
5840 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
5841 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
5842 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
5843 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
5844 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
5845 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
5847 /* GL_MESA_resize_buffers */
5848 table
->ResizeBuffersMESA
= exec_ResizeBuffersMESA
;
5850 /* GL_ARB_transpose_matrix */
5851 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
5852 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
5853 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
5854 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
5856 /* ARB 12. GL_ARB_texture_compression */
5857 table
->CompressedTexImage3DARB
= save_CompressedTexImage3DARB
;
5858 table
->CompressedTexImage2DARB
= save_CompressedTexImage2DARB
;
5859 table
->CompressedTexImage1DARB
= save_CompressedTexImage1DARB
;
5860 table
->CompressedTexSubImage3DARB
= save_CompressedTexSubImage3DARB
;
5861 table
->CompressedTexSubImage2DARB
= save_CompressedTexSubImage2DARB
;
5862 table
->CompressedTexSubImage1DARB
= save_CompressedTexSubImage1DARB
;
5863 table
->GetCompressedTexImageARB
= exec_GetCompressedTexImageARB
;
5865 /* GL_EXT_secondary_color */
5866 table
->SecondaryColorPointerEXT
= exec_SecondaryColorPointerEXT
;
5868 /* GL_EXT_fog_coord */
5869 table
->FogCoordPointerEXT
= exec_FogCoordPointerEXT
;
5877 static const char *enum_string( GLenum k
)
5879 return gl_lookup_enum_by_nr( k
);
5884 * Print the commands in a display list. For debugging only.
5885 * TODO: many commands aren't handled yet.
5887 static void print_list( GLcontext
*ctx
, FILE *f
, GLuint list
)
5892 if (!glIsList(list
)) {
5893 fprintf(f
,"%u is not a display list ID\n",list
);
5897 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
5899 fprintf( f
, "START-LIST %u, address %p\n", list
, (void*)n
);
5901 done
= n
? GL_FALSE
: GL_TRUE
;
5903 OpCode opcode
= n
[0].opcode
;
5904 int i
= (int)n
[0].opcode
- (int)OPCODE_DRV_0
;
5906 if (i
>= 0 && i
< ctx
->listext
.nr_opcodes
) {
5907 ctx
->listext
.opcode
[i
].print(ctx
, &n
[1]);
5908 n
+= ctx
->listext
.opcode
[i
].size
;
5912 fprintf(f
,"accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
5915 fprintf(f
,"Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
5916 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
5918 case OPCODE_CALL_LIST
:
5919 fprintf(f
,"CallList %d\n", (int) n
[1].ui
);
5921 case OPCODE_CALL_LIST_OFFSET
:
5922 fprintf(f
,"CallList %d + offset %u = %u\n", (int) n
[1].ui
,
5923 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
5925 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5926 fprintf(f
,"ColorTableParameterfv %s %s %f %f %f %f\n",
5927 enum_string(n
[1].e
), enum_string(n
[2].e
),
5928 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5930 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5931 fprintf(f
,"ColorTableParameteriv %s %s %d %d %d %d\n",
5932 enum_string(n
[1].e
), enum_string(n
[2].e
),
5933 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
5935 case OPCODE_DISABLE
:
5936 fprintf(f
,"Disable %s\n", enum_string(n
[1].e
));
5939 fprintf(f
,"Enable %s\n", enum_string(n
[1].e
));
5941 case OPCODE_FRUSTUM
:
5942 fprintf(f
,"Frustum %g %g %g %g %g %g\n",
5943 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5945 case OPCODE_LINE_STIPPLE
:
5946 fprintf(f
,"LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
5948 case OPCODE_LOAD_IDENTITY
:
5949 fprintf(f
,"LoadIdentity\n");
5951 case OPCODE_LOAD_MATRIX
:
5952 fprintf(f
,"LoadMatrix\n");
5953 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
5954 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
5955 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
5956 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
5958 case OPCODE_MULT_MATRIX
:
5959 fprintf(f
,"MultMatrix (or Rotate)\n");
5960 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
5961 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
5962 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
5963 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
5966 fprintf(f
,"Ortho %g %g %g %g %g %g\n",
5967 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5969 case OPCODE_POP_ATTRIB
:
5970 fprintf(f
,"PopAttrib\n");
5972 case OPCODE_POP_MATRIX
:
5973 fprintf(f
,"PopMatrix\n");
5975 case OPCODE_POP_NAME
:
5976 fprintf(f
,"PopName\n");
5978 case OPCODE_PUSH_ATTRIB
:
5979 fprintf(f
,"PushAttrib %x\n", n
[1].bf
);
5981 case OPCODE_PUSH_MATRIX
:
5982 fprintf(f
,"PushMatrix\n");
5984 case OPCODE_PUSH_NAME
:
5985 fprintf(f
,"PushName %d\n", (int) n
[1].ui
);
5987 case OPCODE_RASTER_POS
:
5988 fprintf(f
,"RasterPos %g %g %g %g\n", n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
5991 fprintf(f
,"Rotate %g %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
5994 fprintf(f
,"Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
5996 case OPCODE_TRANSLATE
:
5997 fprintf(f
,"Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
5999 case OPCODE_BIND_TEXTURE
:
6000 fprintf(f
,"BindTexture %s %d\n", gl_lookup_enum_by_nr(n
[1].ui
),
6003 case OPCODE_SHADE_MODEL
:
6004 fprintf(f
,"ShadeModel %s\n", gl_lookup_enum_by_nr(n
[1].ui
));
6008 * meta opcodes/commands
6011 fprintf(f
,"Error: %s %s\n", enum_string(n
[1].e
), (const char *)n
[2].data
);
6013 case OPCODE_CONTINUE
:
6014 fprintf(f
,"DISPLAY-LIST-CONTINUE\n");
6015 n
= (Node
*) n
[1].next
;
6017 case OPCODE_END_OF_LIST
:
6018 fprintf(f
,"END-LIST %u\n", list
);
6022 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
6023 fprintf(f
,"ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
6028 fprintf(f
,"command %d, %u operands\n",opcode
,InstSize
[opcode
]);
6031 /* increment n to point to next compiled command */
6032 if (opcode
!=OPCODE_CONTINUE
) {
6033 n
+= InstSize
[opcode
];
6042 * Clients may call this function to help debug display list problems.
6043 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
6044 * changed, or break in the future without notice.
6046 void mesa_print_display_list( GLuint list
)
6048 GET_CURRENT_CONTEXT(ctx
);
6049 print_list( ctx
, stderr
, list
);