1 /* $Id: dlist.c,v 1.90 2002/06/15 02:38:15 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.
32 #include "api_loopback.h"
46 #include "extensions.h"
51 #include "histogram.h"
70 #include "math/m_matrix.h"
71 #include "math/m_xform.h"
78 Functions which aren't compiled but executed immediately:
82 glEndList --- BUT: call ctx->Driver.EndList at end of list execution?
93 Functions which cause errors if called while compiling a display list:
100 * Display list instructions are stored as sequences of "nodes". Nodes
101 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
102 * are linked together with a pointer.
106 /* How many nodes to allocate at a time:
107 * - reduced now that we hold vertices etc. elsewhere.
109 #define BLOCK_SIZE 256
113 * Display list opcodes.
115 * The fact that these identifiers are assigned consecutive
116 * integer values starting at 0 is very important, see InstSize array usage)
125 OPCODE_BLEND_EQUATION
,
127 OPCODE_BLEND_FUNC_SEPARATE
,
129 OPCODE_CALL_LIST_OFFSET
,
135 OPCODE_CLEAR_STENCIL
,
138 OPCODE_COLOR_MATERIAL
,
140 OPCODE_COLOR_TABLE_PARAMETER_FV
,
141 OPCODE_COLOR_TABLE_PARAMETER_IV
,
142 OPCODE_COLOR_SUB_TABLE
,
143 OPCODE_CONVOLUTION_FILTER_1D
,
144 OPCODE_CONVOLUTION_FILTER_2D
,
145 OPCODE_CONVOLUTION_PARAMETER_I
,
146 OPCODE_CONVOLUTION_PARAMETER_IV
,
147 OPCODE_CONVOLUTION_PARAMETER_F
,
148 OPCODE_CONVOLUTION_PARAMETER_FV
,
149 OPCODE_COPY_COLOR_SUB_TABLE
,
150 OPCODE_COPY_COLOR_TABLE
,
152 OPCODE_COPY_TEX_IMAGE1D
,
153 OPCODE_COPY_TEX_IMAGE2D
,
154 OPCODE_COPY_TEX_SUB_IMAGE1D
,
155 OPCODE_COPY_TEX_SUB_IMAGE2D
,
156 OPCODE_COPY_TEX_SUB_IMAGE3D
,
179 OPCODE_LOAD_IDENTITY
,
193 OPCODE_PIXEL_TRANSFER
,
196 OPCODE_POINT_PARAMETERS
,
198 OPCODE_POLYGON_STIPPLE
,
199 OPCODE_POLYGON_OFFSET
,
203 OPCODE_PRIORITIZE_TEXTURE
,
209 OPCODE_RESET_HISTOGRAM
,
210 OPCODE_RESET_MIN_MAX
,
214 OPCODE_SELECT_TEXTURE_SGIS
,
215 OPCODE_SELECT_TEXTURE_COORD_SET
,
226 OPCODE_TEX_SUB_IMAGE1D
,
227 OPCODE_TEX_SUB_IMAGE2D
,
228 OPCODE_TEX_SUB_IMAGE3D
,
232 /* GL_ARB_multitexture */
233 OPCODE_ACTIVE_TEXTURE
,
234 /* GL_SGIX/SGIS_pixel_texture */
235 OPCODE_PIXEL_TEXGEN_SGIX
,
236 OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
,
237 /* GL_ARB_texture_compression */
238 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
239 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
240 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
241 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
242 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
243 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
244 /* GL_ARB_multisample */
245 OPCODE_SAMPLE_COVERAGE
,
246 /* GL_ARB_window_pos */
247 OPCODE_WINDOW_POS_ARB
,
248 /* GL_NV_vertex_program */
249 OPCODE_BIND_PROGRAM_NV
,
250 OPCODE_EXECUTE_PROGRAM_NV
,
251 OPCODE_REQUEST_PROGRAMS_RESIDENT_NV
,
252 OPCODE_LOAD_PROGRAM_NV
,
253 OPCODE_PROGRAM_PARAMETER4F_NV
,
254 OPCODE_PROGRAM_PARAMETERS4FV_NV
,
255 OPCODE_TRACK_MATRIX_NV
,
256 /* The following three are meta instructions */
257 OPCODE_ERROR
, /* raise compiled-in error */
265 * Each instruction in the display list is stored as a sequence of
266 * contiguous nodes in memory.
267 * Each node is the union of a variety of datatypes.
281 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
286 /* Number of nodes of storage needed for each instruction. Sizes for
287 * dynamically allocated opcodes are stored in the context struct.
289 static GLuint InstSize
[ OPCODE_END_OF_LIST
+1 ];
291 void mesa_print_display_list( GLuint list
);
294 /**********************************************************************/
295 /***** Private *****/
296 /**********************************************************************/
303 * Make an empty display list. This is used by glGenLists() to
304 * reserver display list IDs.
306 static Node
*make_empty_list( void )
308 Node
*n
= (Node
*) MALLOC( sizeof(Node
) );
309 n
[0].opcode
= OPCODE_END_OF_LIST
;
316 * Destroy all nodes in a display list.
317 * Input: list - display list number
319 void _mesa_destroy_list( GLcontext
*ctx
, GLuint list
)
327 block
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
330 done
= block
? GL_FALSE
: GL_TRUE
;
333 /* check for extension opcodes first */
335 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_DRV_0
;
336 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
337 ctx
->listext
.opcode
[i
].destroy(ctx
, &n
[1]);
338 n
+= ctx
->listext
.opcode
[i
].size
;
341 switch (n
[0].opcode
) {
344 n
+= InstSize
[n
[0].opcode
];
348 n
+= InstSize
[n
[0].opcode
];
350 case OPCODE_DRAW_PIXELS
:
352 n
+= InstSize
[n
[0].opcode
];
356 n
+= InstSize
[n
[0].opcode
];
358 case OPCODE_COLOR_TABLE
:
360 n
+= InstSize
[n
[0].opcode
];
362 case OPCODE_COLOR_SUB_TABLE
:
364 n
+= InstSize
[n
[0].opcode
];
366 case OPCODE_CONVOLUTION_FILTER_1D
:
368 n
+= InstSize
[n
[0].opcode
];
370 case OPCODE_CONVOLUTION_FILTER_2D
:
372 n
+= InstSize
[n
[0].opcode
];
374 case OPCODE_POLYGON_STIPPLE
:
376 n
+= InstSize
[n
[0].opcode
];
378 case OPCODE_TEX_IMAGE1D
:
380 n
+= InstSize
[n
[0].opcode
];
382 case OPCODE_TEX_IMAGE2D
:
384 n
+= InstSize
[n
[0].opcode
];
386 case OPCODE_TEX_IMAGE3D
:
388 n
+= InstSize
[n
[0].opcode
];
390 case OPCODE_TEX_SUB_IMAGE1D
:
392 n
+= InstSize
[n
[0].opcode
];
394 case OPCODE_TEX_SUB_IMAGE2D
:
396 n
+= InstSize
[n
[0].opcode
];
398 case OPCODE_TEX_SUB_IMAGE3D
:
400 n
+= InstSize
[n
[0].opcode
];
402 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
404 n
+= InstSize
[n
[0].opcode
];
406 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
408 n
+= InstSize
[n
[0].opcode
];
410 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
412 n
+= InstSize
[n
[0].opcode
];
414 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
416 n
+= InstSize
[n
[0].opcode
];
418 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
420 n
+= InstSize
[n
[0].opcode
];
422 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
424 n
+= InstSize
[n
[0].opcode
];
426 case OPCODE_CONTINUE
:
427 n
= (Node
*) n
[1].next
;
431 case OPCODE_END_OF_LIST
:
436 /* Most frequent case */
437 n
+= InstSize
[n
[0].opcode
];
443 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
449 * Translate the nth element of list from type to GLuint.
451 static GLuint
translate_id( GLsizei n
, GLenum type
, const GLvoid
*list
)
463 bptr
= (GLbyte
*) list
;
464 return (GLuint
) *(bptr
+n
);
465 case GL_UNSIGNED_BYTE
:
466 ubptr
= (GLubyte
*) list
;
467 return (GLuint
) *(ubptr
+n
);
469 sptr
= (GLshort
*) list
;
470 return (GLuint
) *(sptr
+n
);
471 case GL_UNSIGNED_SHORT
:
472 usptr
= (GLushort
*) list
;
473 return (GLuint
) *(usptr
+n
);
475 iptr
= (GLint
*) list
;
476 return (GLuint
) *(iptr
+n
);
477 case GL_UNSIGNED_INT
:
478 uiptr
= (GLuint
*) list
;
479 return (GLuint
) *(uiptr
+n
);
481 fptr
= (GLfloat
*) list
;
482 return (GLuint
) *(fptr
+n
);
484 ubptr
= ((GLubyte
*) list
) + 2*n
;
485 return (GLuint
) *ubptr
* 256 + (GLuint
) *(ubptr
+1);
487 ubptr
= ((GLubyte
*) list
) + 3*n
;
488 return (GLuint
) *ubptr
* 65536
489 + (GLuint
) *(ubptr
+1) * 256
490 + (GLuint
) *(ubptr
+2);
492 ubptr
= ((GLubyte
*) list
) + 4*n
;
493 return (GLuint
) *ubptr
* 16777216
494 + (GLuint
) *(ubptr
+1) * 65536
495 + (GLuint
) *(ubptr
+2) * 256
496 + (GLuint
) *(ubptr
+3);
505 /**********************************************************************/
507 /**********************************************************************/
509 void _mesa_init_lists( void )
511 static int init_flag
= 0;
514 InstSize
[OPCODE_ACCUM
] = 3;
515 InstSize
[OPCODE_ALPHA_FUNC
] = 3;
516 InstSize
[OPCODE_BIND_TEXTURE
] = 3;
517 InstSize
[OPCODE_BITMAP
] = 8;
518 InstSize
[OPCODE_BLEND_COLOR
] = 5;
519 InstSize
[OPCODE_BLEND_EQUATION
] = 2;
520 InstSize
[OPCODE_BLEND_FUNC
] = 3;
521 InstSize
[OPCODE_BLEND_FUNC_SEPARATE
] = 5;
522 InstSize
[OPCODE_CALL_LIST
] = 2;
523 InstSize
[OPCODE_CALL_LIST_OFFSET
] = 2;
524 InstSize
[OPCODE_CLEAR
] = 2;
525 InstSize
[OPCODE_CLEAR_ACCUM
] = 5;
526 InstSize
[OPCODE_CLEAR_COLOR
] = 5;
527 InstSize
[OPCODE_CLEAR_DEPTH
] = 2;
528 InstSize
[OPCODE_CLEAR_INDEX
] = 2;
529 InstSize
[OPCODE_CLEAR_STENCIL
] = 2;
530 InstSize
[OPCODE_CLIP_PLANE
] = 6;
531 InstSize
[OPCODE_COLOR_MASK
] = 5;
532 InstSize
[OPCODE_COLOR_MATERIAL
] = 3;
533 InstSize
[OPCODE_COLOR_TABLE
] = 7;
534 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_FV
] = 7;
535 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_IV
] = 7;
536 InstSize
[OPCODE_COLOR_SUB_TABLE
] = 7;
537 InstSize
[OPCODE_CONVOLUTION_FILTER_1D
] = 7;
538 InstSize
[OPCODE_CONVOLUTION_FILTER_2D
] = 8;
539 InstSize
[OPCODE_CONVOLUTION_PARAMETER_I
] = 4;
540 InstSize
[OPCODE_CONVOLUTION_PARAMETER_IV
] = 7;
541 InstSize
[OPCODE_CONVOLUTION_PARAMETER_F
] = 4;
542 InstSize
[OPCODE_CONVOLUTION_PARAMETER_FV
] = 7;
543 InstSize
[OPCODE_COPY_PIXELS
] = 6;
544 InstSize
[OPCODE_COPY_COLOR_SUB_TABLE
] = 6;
545 InstSize
[OPCODE_COPY_COLOR_TABLE
] = 6;
546 InstSize
[OPCODE_COPY_TEX_IMAGE1D
] = 8;
547 InstSize
[OPCODE_COPY_TEX_IMAGE2D
] = 9;
548 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE1D
] = 7;
549 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE2D
] = 9;
550 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE3D
] = 10;
551 InstSize
[OPCODE_CULL_FACE
] = 2;
552 InstSize
[OPCODE_DEPTH_FUNC
] = 2;
553 InstSize
[OPCODE_DEPTH_MASK
] = 2;
554 InstSize
[OPCODE_DEPTH_RANGE
] = 3;
555 InstSize
[OPCODE_DISABLE
] = 2;
556 InstSize
[OPCODE_DRAW_BUFFER
] = 2;
557 InstSize
[OPCODE_DRAW_PIXELS
] = 6;
558 InstSize
[OPCODE_ENABLE
] = 2;
559 InstSize
[OPCODE_EVALMESH1
] = 4;
560 InstSize
[OPCODE_EVALMESH2
] = 6;
561 InstSize
[OPCODE_FOG
] = 6;
562 InstSize
[OPCODE_FRONT_FACE
] = 2;
563 InstSize
[OPCODE_FRUSTUM
] = 7;
564 InstSize
[OPCODE_HINT
] = 3;
565 InstSize
[OPCODE_HISTOGRAM
] = 5;
566 InstSize
[OPCODE_INDEX_MASK
] = 2;
567 InstSize
[OPCODE_INIT_NAMES
] = 1;
568 InstSize
[OPCODE_LIGHT
] = 7;
569 InstSize
[OPCODE_LIGHT_MODEL
] = 6;
570 InstSize
[OPCODE_LINE_STIPPLE
] = 3;
571 InstSize
[OPCODE_LINE_WIDTH
] = 2;
572 InstSize
[OPCODE_LIST_BASE
] = 2;
573 InstSize
[OPCODE_LOAD_IDENTITY
] = 1;
574 InstSize
[OPCODE_LOAD_MATRIX
] = 17;
575 InstSize
[OPCODE_LOAD_NAME
] = 2;
576 InstSize
[OPCODE_LOGIC_OP
] = 2;
577 InstSize
[OPCODE_MAP1
] = 7;
578 InstSize
[OPCODE_MAP2
] = 11;
579 InstSize
[OPCODE_MAPGRID1
] = 4;
580 InstSize
[OPCODE_MAPGRID2
] = 7;
581 InstSize
[OPCODE_MATRIX_MODE
] = 2;
582 InstSize
[OPCODE_MIN_MAX
] = 4;
583 InstSize
[OPCODE_MULT_MATRIX
] = 17;
584 InstSize
[OPCODE_ORTHO
] = 7;
585 InstSize
[OPCODE_PASSTHROUGH
] = 2;
586 InstSize
[OPCODE_PIXEL_MAP
] = 4;
587 InstSize
[OPCODE_PIXEL_TRANSFER
] = 3;
588 InstSize
[OPCODE_PIXEL_ZOOM
] = 3;
589 InstSize
[OPCODE_POINT_SIZE
] = 2;
590 InstSize
[OPCODE_POINT_PARAMETERS
] = 5;
591 InstSize
[OPCODE_POLYGON_MODE
] = 3;
592 InstSize
[OPCODE_POLYGON_STIPPLE
] = 2;
593 InstSize
[OPCODE_POLYGON_OFFSET
] = 3;
594 InstSize
[OPCODE_POP_ATTRIB
] = 1;
595 InstSize
[OPCODE_POP_MATRIX
] = 1;
596 InstSize
[OPCODE_POP_NAME
] = 1;
597 InstSize
[OPCODE_PRIORITIZE_TEXTURE
] = 3;
598 InstSize
[OPCODE_PUSH_ATTRIB
] = 2;
599 InstSize
[OPCODE_PUSH_MATRIX
] = 1;
600 InstSize
[OPCODE_PUSH_NAME
] = 2;
601 InstSize
[OPCODE_RASTER_POS
] = 5;
602 InstSize
[OPCODE_READ_BUFFER
] = 2;
603 InstSize
[OPCODE_RESET_HISTOGRAM
] = 2;
604 InstSize
[OPCODE_RESET_MIN_MAX
] = 2;
605 InstSize
[OPCODE_ROTATE
] = 5;
606 InstSize
[OPCODE_SCALE
] = 4;
607 InstSize
[OPCODE_SCISSOR
] = 5;
608 InstSize
[OPCODE_STENCIL_FUNC
] = 4;
609 InstSize
[OPCODE_STENCIL_MASK
] = 2;
610 InstSize
[OPCODE_STENCIL_OP
] = 4;
611 InstSize
[OPCODE_SHADE_MODEL
] = 2;
612 InstSize
[OPCODE_TEXENV
] = 7;
613 InstSize
[OPCODE_TEXGEN
] = 7;
614 InstSize
[OPCODE_TEXPARAMETER
] = 7;
615 InstSize
[OPCODE_TEX_IMAGE1D
] = 9;
616 InstSize
[OPCODE_TEX_IMAGE2D
] = 10;
617 InstSize
[OPCODE_TEX_IMAGE3D
] = 11;
618 InstSize
[OPCODE_TEX_SUB_IMAGE1D
] = 8;
619 InstSize
[OPCODE_TEX_SUB_IMAGE2D
] = 10;
620 InstSize
[OPCODE_TEX_SUB_IMAGE3D
] = 12;
621 InstSize
[OPCODE_TRANSLATE
] = 4;
622 InstSize
[OPCODE_VIEWPORT
] = 5;
623 InstSize
[OPCODE_WINDOW_POS
] = 5;
624 InstSize
[OPCODE_CONTINUE
] = 2;
625 InstSize
[OPCODE_ERROR
] = 3;
626 InstSize
[OPCODE_END_OF_LIST
] = 1;
627 /* GL_SGIX/SGIS_pixel_texture */
628 InstSize
[OPCODE_PIXEL_TEXGEN_SGIX
] = 2;
629 InstSize
[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
] = 3;
630 /* GL_ARB_texture_compression */
631 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_1D
] = 8;
632 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_2D
] = 9;
633 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_3D
] = 10;
634 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
] = 8;
635 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
] = 10;
636 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
] = 12;
637 /* GL_ARB_multisample */
638 InstSize
[OPCODE_SAMPLE_COVERAGE
] = 3;
639 /* GL_ARB_multitexture */
640 InstSize
[OPCODE_ACTIVE_TEXTURE
] = 2;
641 /* GL_ARB_window_pos */
642 InstSize
[OPCODE_WINDOW_POS_ARB
] = 4;
643 /* GL_NV_vertex_program */
644 InstSize
[OPCODE_BIND_PROGRAM_NV
] = 3;
645 InstSize
[OPCODE_EXECUTE_PROGRAM_NV
] = 7;
646 InstSize
[OPCODE_REQUEST_PROGRAMS_RESIDENT_NV
] = 2;
647 InstSize
[OPCODE_LOAD_PROGRAM_NV
] = 4;
648 InstSize
[OPCODE_PROGRAM_PARAMETER4F_NV
] = 7;
649 InstSize
[OPCODE_PROGRAM_PARAMETERS4FV_NV
] = 4;
650 InstSize
[OPCODE_TRACK_MATRIX_NV
] = 5;
657 * Allocate space for a display list instruction.
658 * Input: opcode - type of instruction
659 * argcount - size in bytes of data required.
660 * Return: pointer to the usable data area (not including the internal
664 _mesa_alloc_instruction( GLcontext
*ctx
, int opcode
, GLint sz
)
667 GLuint count
= 1 + (sz
+ sizeof(Node
) - 1) / sizeof(Node
);
670 if (opcode
< (int) OPCODE_DRV_0
) {
671 assert( count
== InstSize
[opcode
] );
675 if (ctx
->CurrentPos
+ count
+ 2 > BLOCK_SIZE
) {
676 /* This block is full. Allocate a new block and chain to it */
677 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
678 n
[0].opcode
= OPCODE_CONTINUE
;
679 newblock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
681 _mesa_error( ctx
, GL_OUT_OF_MEMORY
, "Building display list" );
684 n
[1].next
= (Node
*) newblock
;
685 ctx
->CurrentBlock
= newblock
;
689 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
690 ctx
->CurrentPos
+= count
;
692 n
[0].opcode
= (OpCode
) opcode
;
694 return (void *)&n
[1];
698 /* Allow modules and drivers to get their own opcodes.
701 _mesa_alloc_opcode( GLcontext
*ctx
,
703 void (*execute
)( GLcontext
*, void * ),
704 void (*destroy
)( GLcontext
*, void * ),
705 void (*print
)( GLcontext
*, void * ) )
707 if (ctx
->listext
.nr_opcodes
< GL_MAX_EXT_OPCODES
) {
708 GLuint i
= ctx
->listext
.nr_opcodes
++;
709 ctx
->listext
.opcode
[i
].size
= 1 + (sz
+ sizeof(Node
) - 1)/sizeof(Node
);
710 ctx
->listext
.opcode
[i
].execute
= execute
;
711 ctx
->listext
.opcode
[i
].destroy
= destroy
;
712 ctx
->listext
.opcode
[i
].print
= print
;
713 return i
+ OPCODE_DRV_0
;
720 /* Mimic the old behaviour of alloc_instruction:
721 * - sz is in units of sizeof(Node)
722 * - return value a pointer to sizeof(Node) before the actual
725 #define ALLOC_INSTRUCTION(ctx, opcode, sz) \
726 ((Node *)_mesa_alloc_instruction(ctx, opcode, sz*sizeof(Node)) - 1)
731 * Display List compilation functions
733 static void save_Accum( GLenum op
, GLfloat value
)
735 GET_CURRENT_CONTEXT(ctx
);
737 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
738 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACCUM
, 2 );
743 if (ctx
->ExecuteFlag
) {
744 (*ctx
->Exec
->Accum
)( op
, value
);
749 static void save_AlphaFunc( GLenum func
, GLclampf ref
)
751 GET_CURRENT_CONTEXT(ctx
);
753 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
754 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ALPHA_FUNC
, 2 );
757 n
[2].f
= (GLfloat
) ref
;
759 if (ctx
->ExecuteFlag
) {
760 (*ctx
->Exec
->AlphaFunc
)( func
, ref
);
765 static void save_BindTexture( GLenum target
, GLuint texture
)
767 GET_CURRENT_CONTEXT(ctx
);
769 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
770 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_TEXTURE
, 2 );
775 if (ctx
->ExecuteFlag
) {
776 (*ctx
->Exec
->BindTexture
)( target
, texture
);
781 static void save_Bitmap( GLsizei width
, GLsizei height
,
782 GLfloat xorig
, GLfloat yorig
,
783 GLfloat xmove
, GLfloat ymove
,
784 const GLubyte
*pixels
)
786 GET_CURRENT_CONTEXT(ctx
);
787 GLvoid
*image
= _mesa_unpack_bitmap( width
, height
, pixels
, &ctx
->Unpack
);
789 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
790 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BITMAP
, 7 );
792 n
[1].i
= (GLint
) width
;
793 n
[2].i
= (GLint
) height
;
803 if (ctx
->ExecuteFlag
) {
804 (*ctx
->Exec
->Bitmap
)( width
, height
,
805 xorig
, yorig
, xmove
, ymove
, pixels
);
810 static void save_BlendEquation( GLenum mode
)
812 GET_CURRENT_CONTEXT(ctx
);
814 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
815 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_EQUATION
, 1 );
819 if (ctx
->ExecuteFlag
) {
820 (*ctx
->Exec
->BlendEquation
)( mode
);
825 static void save_BlendFunc( GLenum sfactor
, GLenum dfactor
)
827 GET_CURRENT_CONTEXT(ctx
);
829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
830 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_FUNC
, 2 );
835 if (ctx
->ExecuteFlag
) {
836 (*ctx
->Exec
->BlendFunc
)( sfactor
, dfactor
);
841 static void save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
842 GLenum sfactorA
, GLenum dfactorA
)
844 GET_CURRENT_CONTEXT(ctx
);
846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
847 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4 );
854 if (ctx
->ExecuteFlag
) {
855 (*ctx
->Exec
->BlendFuncSeparateEXT
)( sfactorRGB
, dfactorRGB
,
861 static void save_BlendColor( GLfloat red
, GLfloat green
,
862 GLfloat blue
, GLfloat alpha
)
864 GET_CURRENT_CONTEXT(ctx
);
866 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
867 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_COLOR
, 4 );
874 if (ctx
->ExecuteFlag
) {
875 (*ctx
->Exec
->BlendColor
)( red
, green
, blue
, alpha
);
880 void _mesa_save_CallList( GLuint list
)
882 GET_CURRENT_CONTEXT(ctx
);
884 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
885 FLUSH_CURRENT(ctx
, 0);
887 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CALL_LIST
, 1 );
891 if (ctx
->ExecuteFlag
) {
892 (*ctx
->Exec
->CallList
)( list
);
897 void _mesa_save_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
899 GET_CURRENT_CONTEXT(ctx
);
901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
902 FLUSH_CURRENT(ctx
, 0);
905 GLuint list
= translate_id( i
, type
, lists
);
906 Node
*n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CALL_LIST_OFFSET
, 1 );
911 if (ctx
->ExecuteFlag
) {
912 (*ctx
->Exec
->CallLists
)( n
, type
, lists
);
917 static void save_Clear( GLbitfield mask
)
919 GET_CURRENT_CONTEXT(ctx
);
921 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
922 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR
, 1 );
926 if (ctx
->ExecuteFlag
) {
927 (*ctx
->Exec
->Clear
)( mask
);
932 static void save_ClearAccum( GLfloat red
, GLfloat green
,
933 GLfloat blue
, GLfloat alpha
)
935 GET_CURRENT_CONTEXT(ctx
);
937 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
938 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_ACCUM
, 4 );
945 if (ctx
->ExecuteFlag
) {
946 (*ctx
->Exec
->ClearAccum
)( red
, green
, blue
, alpha
);
951 static void save_ClearColor( GLclampf red
, GLclampf green
,
952 GLclampf blue
, GLclampf alpha
)
954 GET_CURRENT_CONTEXT(ctx
);
956 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
957 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_COLOR
, 4 );
964 if (ctx
->ExecuteFlag
) {
965 (*ctx
->Exec
->ClearColor
)( red
, green
, blue
, alpha
);
970 static void save_ClearDepth( GLclampd depth
)
972 GET_CURRENT_CONTEXT(ctx
);
974 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
975 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_DEPTH
, 1 );
977 n
[1].f
= (GLfloat
) depth
;
979 if (ctx
->ExecuteFlag
) {
980 (*ctx
->Exec
->ClearDepth
)( depth
);
985 static void save_ClearIndex( GLfloat c
)
987 GET_CURRENT_CONTEXT(ctx
);
989 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
990 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_INDEX
, 1 );
994 if (ctx
->ExecuteFlag
) {
995 (*ctx
->Exec
->ClearIndex
)( c
);
1000 static void save_ClearStencil( GLint s
)
1002 GET_CURRENT_CONTEXT(ctx
);
1004 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1005 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_STENCIL
, 1 );
1009 if (ctx
->ExecuteFlag
) {
1010 (*ctx
->Exec
->ClearStencil
)( s
);
1015 static void save_ClipPlane( GLenum plane
, const GLdouble
*equ
)
1017 GET_CURRENT_CONTEXT(ctx
);
1019 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1020 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLIP_PLANE
, 5 );
1023 n
[2].f
= (GLfloat
) equ
[0];
1024 n
[3].f
= (GLfloat
) equ
[1];
1025 n
[4].f
= (GLfloat
) equ
[2];
1026 n
[5].f
= (GLfloat
) equ
[3];
1028 if (ctx
->ExecuteFlag
) {
1029 (*ctx
->Exec
->ClipPlane
)( plane
, equ
);
1035 static void save_ColorMask( GLboolean red
, GLboolean green
,
1036 GLboolean blue
, GLboolean alpha
)
1038 GET_CURRENT_CONTEXT(ctx
);
1040 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1041 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_MASK
, 4 );
1048 if (ctx
->ExecuteFlag
) {
1049 (*ctx
->Exec
->ColorMask
)( red
, green
, blue
, alpha
);
1054 static void save_ColorMaterial( GLenum face
, GLenum mode
)
1056 GET_CURRENT_CONTEXT(ctx
);
1058 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1059 FLUSH_CURRENT(ctx
, 0);
1061 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_MATERIAL
, 2 );
1066 if (ctx
->ExecuteFlag
) {
1067 (*ctx
->Exec
->ColorMaterial
)( face
, mode
);
1072 static void save_ColorTable( GLenum target
, GLenum internalFormat
,
1073 GLsizei width
, GLenum format
, GLenum type
,
1074 const GLvoid
*table
)
1076 GET_CURRENT_CONTEXT(ctx
);
1077 if (target
== GL_PROXY_TEXTURE_1D
||
1078 target
== GL_PROXY_TEXTURE_2D
||
1079 target
== GL_PROXY_TEXTURE_3D
||
1080 target
== GL_PROXY_TEXTURE_CUBE_MAP_ARB
) {
1081 /* execute immediately */
1082 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1083 format
, type
, table
);
1086 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, table
,
1089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1090 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE
, 6 );
1093 n
[2].e
= internalFormat
;
1102 if (ctx
->ExecuteFlag
) {
1103 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1104 format
, type
, table
);
1112 save_ColorTableParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1114 GET_CURRENT_CONTEXT(ctx
);
1117 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1119 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6 );
1124 if (pname
== GL_COLOR_TABLE_SGI
||
1125 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1126 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
) {
1133 if (ctx
->ExecuteFlag
) {
1134 (*ctx
->Exec
->ColorTableParameterfv
)( target
, pname
, params
);
1140 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1142 GET_CURRENT_CONTEXT(ctx
);
1145 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1147 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6 );
1152 if (pname
== GL_COLOR_TABLE_SGI
||
1153 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1154 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
) {
1161 if (ctx
->ExecuteFlag
) {
1162 (*ctx
->Exec
->ColorTableParameteriv
)( target
, pname
, params
);
1168 static void save_ColorSubTable( GLenum target
, GLsizei start
, GLsizei count
,
1169 GLenum format
, GLenum type
,
1170 const GLvoid
*table
)
1172 GET_CURRENT_CONTEXT(ctx
);
1173 GLvoid
*image
= _mesa_unpack_image(count
, 1, 1, format
, type
, table
,
1176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1177 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_SUB_TABLE
, 6 );
1189 if (ctx
->ExecuteFlag
) {
1190 (*ctx
->Exec
->ColorSubTable
)(target
, start
, count
, format
, type
, table
);
1196 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1197 GLint x
, GLint y
, GLsizei width
)
1199 GET_CURRENT_CONTEXT(ctx
);
1202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1203 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5 );
1211 if (ctx
->ExecuteFlag
) {
1212 (*ctx
->Exec
->CopyColorSubTable
)(target
, start
, x
, y
, width
);
1218 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1219 GLint x
, GLint y
, GLsizei width
)
1221 GET_CURRENT_CONTEXT(ctx
);
1224 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1225 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_TABLE
, 5 );
1228 n
[2].e
= internalformat
;
1233 if (ctx
->ExecuteFlag
) {
1234 (*ctx
->Exec
->CopyColorTable
)(target
, internalformat
, x
, y
, width
);
1240 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1241 GLenum format
, GLenum type
, const GLvoid
*filter
)
1243 GET_CURRENT_CONTEXT(ctx
);
1244 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, filter
,
1247 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1248 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6 );
1251 n
[2].e
= internalFormat
;
1260 if (ctx
->ExecuteFlag
) {
1261 (*ctx
->Exec
->ConvolutionFilter1D
)( target
, internalFormat
, width
,
1262 format
, type
, filter
);
1268 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1269 GLsizei width
, GLsizei height
, GLenum format
,
1270 GLenum type
, const GLvoid
*filter
)
1272 GET_CURRENT_CONTEXT(ctx
);
1273 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
, filter
,
1276 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1277 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7 );
1280 n
[2].e
= internalFormat
;
1290 if (ctx
->ExecuteFlag
) {
1291 (*ctx
->Exec
->ConvolutionFilter2D
)( target
, internalFormat
, width
, height
,
1292 format
, type
, filter
);
1298 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1300 GET_CURRENT_CONTEXT(ctx
);
1302 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1303 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3 );
1309 if (ctx
->ExecuteFlag
) {
1310 (*ctx
->Exec
->ConvolutionParameteri
)( target
, pname
, param
);
1316 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1318 GET_CURRENT_CONTEXT(ctx
);
1320 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1321 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6 );
1326 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1327 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1328 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1334 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1337 if (ctx
->ExecuteFlag
) {
1338 (*ctx
->Exec
->ConvolutionParameteriv
)( target
, pname
, params
);
1344 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1346 GET_CURRENT_CONTEXT(ctx
);
1348 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1349 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3 );
1355 if (ctx
->ExecuteFlag
) {
1356 (*ctx
->Exec
->ConvolutionParameterf
)( target
, pname
, param
);
1362 save_ConvolutionParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1364 GET_CURRENT_CONTEXT(ctx
);
1366 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1367 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6 );
1372 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1373 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1374 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1380 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1383 if (ctx
->ExecuteFlag
) {
1384 (*ctx
->Exec
->ConvolutionParameterfv
)( target
, pname
, params
);
1390 save_CopyPixels( GLint x
, GLint y
,
1391 GLsizei width
, GLsizei height
, GLenum type
)
1393 GET_CURRENT_CONTEXT(ctx
);
1395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1396 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_PIXELS
, 5 );
1400 n
[3].i
= (GLint
) width
;
1401 n
[4].i
= (GLint
) height
;
1404 if (ctx
->ExecuteFlag
) {
1405 (*ctx
->Exec
->CopyPixels
)( x
, y
, width
, height
, type
);
1412 save_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
1413 GLint x
, GLint y
, GLsizei width
, GLint border
)
1415 GET_CURRENT_CONTEXT(ctx
);
1417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1418 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7 );
1422 n
[3].e
= internalformat
;
1428 if (ctx
->ExecuteFlag
) {
1429 (*ctx
->Exec
->CopyTexImage1D
)( target
, level
, internalformat
,
1430 x
, y
, width
, border
);
1436 save_CopyTexImage2D( GLenum target
, GLint level
,
1437 GLenum internalformat
,
1438 GLint x
, GLint y
, GLsizei width
,
1439 GLsizei height
, GLint border
)
1441 GET_CURRENT_CONTEXT(ctx
);
1443 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1444 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8 );
1448 n
[3].e
= internalformat
;
1455 if (ctx
->ExecuteFlag
) {
1456 (*ctx
->Exec
->CopyTexImage2D
)( target
, level
, internalformat
,
1457 x
, y
, width
, height
, border
);
1464 save_CopyTexSubImage1D( GLenum target
, GLint level
,
1465 GLint xoffset
, GLint x
, GLint y
,
1468 GET_CURRENT_CONTEXT(ctx
);
1470 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1471 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6 );
1480 if (ctx
->ExecuteFlag
) {
1481 (*ctx
->Exec
->CopyTexSubImage1D
)( target
, level
, xoffset
, x
, y
, width
);
1487 save_CopyTexSubImage2D( GLenum target
, GLint level
,
1488 GLint xoffset
, GLint yoffset
,
1490 GLsizei width
, GLint height
)
1492 GET_CURRENT_CONTEXT(ctx
);
1494 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1495 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8 );
1506 if (ctx
->ExecuteFlag
) {
1507 (*ctx
->Exec
->CopyTexSubImage2D
)( target
, level
, xoffset
, yoffset
,
1508 x
, y
, width
, height
);
1514 save_CopyTexSubImage3D( GLenum target
, GLint level
,
1515 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1517 GLsizei width
, GLint height
)
1519 GET_CURRENT_CONTEXT(ctx
);
1521 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1522 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9 );
1534 if (ctx
->ExecuteFlag
) {
1535 (*ctx
->Exec
->CopyTexSubImage3D
)( target
, level
,
1536 xoffset
, yoffset
, zoffset
,
1537 x
, y
, width
, height
);
1542 static void save_CullFace( GLenum mode
)
1544 GET_CURRENT_CONTEXT(ctx
);
1546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1547 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CULL_FACE
, 1 );
1551 if (ctx
->ExecuteFlag
) {
1552 (*ctx
->Exec
->CullFace
)( mode
);
1557 static void save_DepthFunc( GLenum func
)
1559 GET_CURRENT_CONTEXT(ctx
);
1561 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1562 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_FUNC
, 1 );
1566 if (ctx
->ExecuteFlag
) {
1567 (*ctx
->Exec
->DepthFunc
)( func
);
1572 static void save_DepthMask( GLboolean mask
)
1574 GET_CURRENT_CONTEXT(ctx
);
1576 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1577 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_MASK
, 1 );
1581 if (ctx
->ExecuteFlag
) {
1582 (*ctx
->Exec
->DepthMask
)( mask
);
1587 static void save_DepthRange( GLclampd nearval
, GLclampd farval
)
1589 GET_CURRENT_CONTEXT(ctx
);
1591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1592 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_RANGE
, 2 );
1594 n
[1].f
= (GLfloat
) nearval
;
1595 n
[2].f
= (GLfloat
) farval
;
1597 if (ctx
->ExecuteFlag
) {
1598 (*ctx
->Exec
->DepthRange
)( nearval
, farval
);
1603 static void save_Disable( GLenum cap
)
1605 GET_CURRENT_CONTEXT(ctx
);
1607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1608 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DISABLE
, 1 );
1612 if (ctx
->ExecuteFlag
) {
1613 (*ctx
->Exec
->Disable
)( cap
);
1618 static void save_DrawBuffer( GLenum mode
)
1620 GET_CURRENT_CONTEXT(ctx
);
1622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1623 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_BUFFER
, 1 );
1627 if (ctx
->ExecuteFlag
) {
1628 (*ctx
->Exec
->DrawBuffer
)( mode
);
1633 static void save_DrawPixels( GLsizei width
, GLsizei height
,
1634 GLenum format
, GLenum type
,
1635 const GLvoid
*pixels
)
1637 GET_CURRENT_CONTEXT(ctx
);
1638 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
1639 pixels
, &ctx
->Unpack
);
1641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1642 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_PIXELS
, 5 );
1653 if (ctx
->ExecuteFlag
) {
1654 (*ctx
->Exec
->DrawPixels
)( width
, height
, format
, type
, pixels
);
1660 static void save_Enable( GLenum cap
)
1662 GET_CURRENT_CONTEXT(ctx
);
1664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1665 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ENABLE
, 1 );
1669 if (ctx
->ExecuteFlag
) {
1670 (*ctx
->Exec
->Enable
)( cap
);
1676 void _mesa_save_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
1678 GET_CURRENT_CONTEXT(ctx
);
1680 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1681 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH1
, 3 );
1687 if (ctx
->ExecuteFlag
) {
1688 (*ctx
->Exec
->EvalMesh1
)( mode
, i1
, i2
);
1693 void _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1695 GET_CURRENT_CONTEXT(ctx
);
1697 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1698 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH2
, 5 );
1706 if (ctx
->ExecuteFlag
) {
1707 (*ctx
->Exec
->EvalMesh2
)( mode
, i1
, i2
, j1
, j2
);
1714 static void save_Fogfv( GLenum pname
, const GLfloat
*params
)
1716 GET_CURRENT_CONTEXT(ctx
);
1718 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1719 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FOG
, 5 );
1727 if (ctx
->ExecuteFlag
) {
1728 (*ctx
->Exec
->Fogfv
)( pname
, params
);
1733 static void save_Fogf( GLenum pname
, GLfloat param
)
1735 save_Fogfv(pname
, ¶m
);
1739 static void save_Fogiv(GLenum pname
, const GLint
*params
)
1744 case GL_FOG_DENSITY
:
1748 p
[0] = (GLfloat
) *params
;
1751 p
[0] = INT_TO_FLOAT( params
[0] );
1752 p
[1] = INT_TO_FLOAT( params
[1] );
1753 p
[2] = INT_TO_FLOAT( params
[2] );
1754 p
[3] = INT_TO_FLOAT( params
[3] );
1757 /* Error will be caught later in gl_Fogfv */
1760 save_Fogfv(pname
, p
);
1764 static void save_Fogi(GLenum pname
, GLint param
)
1766 save_Fogiv(pname
, ¶m
);
1770 static void save_FrontFace( GLenum mode
)
1772 GET_CURRENT_CONTEXT(ctx
);
1774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1775 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRONT_FACE
, 1 );
1779 if (ctx
->ExecuteFlag
) {
1780 (*ctx
->Exec
->FrontFace
)( mode
);
1785 static void save_Frustum( GLdouble left
, GLdouble right
,
1786 GLdouble bottom
, GLdouble top
,
1787 GLdouble nearval
, GLdouble farval
)
1789 GET_CURRENT_CONTEXT(ctx
);
1791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1792 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRUSTUM
, 6 );
1794 n
[1].f
= (GLfloat
) left
;
1795 n
[2].f
= (GLfloat
) right
;
1796 n
[3].f
= (GLfloat
) bottom
;
1797 n
[4].f
= (GLfloat
) top
;
1798 n
[5].f
= (GLfloat
) nearval
;
1799 n
[6].f
= (GLfloat
) farval
;
1801 if (ctx
->ExecuteFlag
) {
1802 (*ctx
->Exec
->Frustum
)( left
, right
, bottom
, top
, nearval
, farval
);
1807 static void save_Hint( GLenum target
, GLenum mode
)
1809 GET_CURRENT_CONTEXT(ctx
);
1811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1812 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HINT
, 2 );
1817 if (ctx
->ExecuteFlag
) {
1818 (*ctx
->Exec
->Hint
)( target
, mode
);
1824 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
, GLboolean sink
)
1826 GET_CURRENT_CONTEXT(ctx
);
1829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1830 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HISTOGRAM
, 4 );
1834 n
[3].e
= internalFormat
;
1837 if (ctx
->ExecuteFlag
) {
1838 (*ctx
->Exec
->Histogram
)( target
, width
, internalFormat
, sink
);
1843 static void save_IndexMask( GLuint mask
)
1845 GET_CURRENT_CONTEXT(ctx
);
1847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1848 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_INDEX_MASK
, 1 );
1852 if (ctx
->ExecuteFlag
) {
1853 (*ctx
->Exec
->IndexMask
)( mask
);
1858 static void save_InitNames( void )
1860 GET_CURRENT_CONTEXT(ctx
);
1861 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1862 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_INIT_NAMES
, 0 );
1863 if (ctx
->ExecuteFlag
) {
1864 (*ctx
->Exec
->InitNames
)();
1869 static void save_Lightfv( GLenum light
, GLenum pname
, const GLfloat
*params
)
1871 GET_CURRENT_CONTEXT(ctx
);
1873 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1874 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT
, 6 );
1892 case GL_SPOT_DIRECTION
:
1895 case GL_SPOT_EXPONENT
:
1898 case GL_SPOT_CUTOFF
:
1901 case GL_CONSTANT_ATTENUATION
:
1904 case GL_LINEAR_ATTENUATION
:
1907 case GL_QUADRATIC_ATTENUATION
:
1913 for (i
= 0; i
< nParams
; i
++) {
1914 n
[3+i
].f
= params
[i
];
1917 if (ctx
->ExecuteFlag
) {
1918 (*ctx
->Exec
->Lightfv
)( light
, pname
, params
);
1923 static void save_Lightf( GLenum light
, GLenum pname
, GLfloat params
)
1925 save_Lightfv(light
, pname
, ¶ms
);
1929 static void save_Lightiv( GLenum light
, GLenum pname
, const GLint
*params
)
1936 fparam
[0] = INT_TO_FLOAT( params
[0] );
1937 fparam
[1] = INT_TO_FLOAT( params
[1] );
1938 fparam
[2] = INT_TO_FLOAT( params
[2] );
1939 fparam
[3] = INT_TO_FLOAT( params
[3] );
1942 fparam
[0] = (GLfloat
) params
[0];
1943 fparam
[1] = (GLfloat
) params
[1];
1944 fparam
[2] = (GLfloat
) params
[2];
1945 fparam
[3] = (GLfloat
) params
[3];
1947 case GL_SPOT_DIRECTION
:
1948 fparam
[0] = (GLfloat
) params
[0];
1949 fparam
[1] = (GLfloat
) params
[1];
1950 fparam
[2] = (GLfloat
) params
[2];
1952 case GL_SPOT_EXPONENT
:
1953 case GL_SPOT_CUTOFF
:
1954 case GL_CONSTANT_ATTENUATION
:
1955 case GL_LINEAR_ATTENUATION
:
1956 case GL_QUADRATIC_ATTENUATION
:
1957 fparam
[0] = (GLfloat
) params
[0];
1960 /* error will be caught later in gl_Lightfv */
1963 save_Lightfv( light
, pname
, fparam
);
1967 static void save_Lighti( GLenum light
, GLenum pname
, GLint param
)
1969 save_Lightiv( light
, pname
, ¶m
);
1973 static void save_LightModelfv( GLenum pname
, const GLfloat
*params
)
1975 GET_CURRENT_CONTEXT(ctx
);
1977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1978 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT_MODEL
, 5 );
1986 if (ctx
->ExecuteFlag
) {
1987 (*ctx
->Exec
->LightModelfv
)( pname
, params
);
1992 static void save_LightModelf( GLenum pname
, GLfloat param
)
1994 save_LightModelfv(pname
, ¶m
);
1998 static void save_LightModeliv( GLenum pname
, const GLint
*params
)
2002 case GL_LIGHT_MODEL_AMBIENT
:
2003 fparam
[0] = INT_TO_FLOAT( params
[0] );
2004 fparam
[1] = INT_TO_FLOAT( params
[1] );
2005 fparam
[2] = INT_TO_FLOAT( params
[2] );
2006 fparam
[3] = INT_TO_FLOAT( params
[3] );
2008 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2009 case GL_LIGHT_MODEL_TWO_SIDE
:
2010 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2011 fparam
[0] = (GLfloat
) params
[0];
2014 /* Error will be caught later in gl_LightModelfv */
2017 save_LightModelfv(pname
, fparam
);
2021 static void save_LightModeli( GLenum pname
, GLint param
)
2023 save_LightModeliv(pname
, ¶m
);
2027 static void save_LineStipple( GLint factor
, GLushort pattern
)
2029 GET_CURRENT_CONTEXT(ctx
);
2031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2032 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_STIPPLE
, 2 );
2037 if (ctx
->ExecuteFlag
) {
2038 (*ctx
->Exec
->LineStipple
)( factor
, pattern
);
2043 static void save_LineWidth( GLfloat width
)
2045 GET_CURRENT_CONTEXT(ctx
);
2047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2048 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_WIDTH
, 1 );
2052 if (ctx
->ExecuteFlag
) {
2053 (*ctx
->Exec
->LineWidth
)( width
);
2058 static void save_ListBase( GLuint base
)
2060 GET_CURRENT_CONTEXT(ctx
);
2062 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2063 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIST_BASE
, 1 );
2067 if (ctx
->ExecuteFlag
) {
2068 (*ctx
->Exec
->ListBase
)( base
);
2073 static void save_LoadIdentity( void )
2075 GET_CURRENT_CONTEXT(ctx
);
2076 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2077 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_IDENTITY
, 0 );
2078 if (ctx
->ExecuteFlag
) {
2079 (*ctx
->Exec
->LoadIdentity
)();
2084 static void save_LoadMatrixf( const GLfloat
*m
)
2086 GET_CURRENT_CONTEXT(ctx
);
2088 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2089 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_MATRIX
, 16 );
2092 for (i
=0;i
<16;i
++) {
2096 if (ctx
->ExecuteFlag
) {
2097 (*ctx
->Exec
->LoadMatrixf
)( m
);
2102 static void save_LoadMatrixd( const GLdouble
*m
)
2106 for (i
= 0; i
< 16; i
++) {
2107 f
[i
] = (GLfloat
) m
[i
];
2109 save_LoadMatrixf(f
);
2113 static void save_LoadName( GLuint name
)
2115 GET_CURRENT_CONTEXT(ctx
);
2117 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2118 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_NAME
, 1 );
2122 if (ctx
->ExecuteFlag
) {
2123 (*ctx
->Exec
->LoadName
)( name
);
2128 static void save_LogicOp( GLenum opcode
)
2130 GET_CURRENT_CONTEXT(ctx
);
2132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2133 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOGIC_OP
, 1 );
2137 if (ctx
->ExecuteFlag
) {
2138 (*ctx
->Exec
->LogicOp
)( opcode
);
2143 static void save_Map1d( GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2144 GLint order
, const GLdouble
*points
)
2146 GET_CURRENT_CONTEXT(ctx
);
2148 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2149 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2151 GLfloat
*pnts
= _mesa_copy_map_points1d( target
, stride
, order
, points
);
2153 n
[2].f
= (GLfloat
) u1
;
2154 n
[3].f
= (GLfloat
) u2
;
2155 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2157 n
[6].data
= (void *) pnts
;
2159 if (ctx
->ExecuteFlag
) {
2160 (*ctx
->Exec
->Map1d
)( target
, u1
, u2
, stride
, order
, points
);
2164 static void save_Map1f( GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2165 GLint order
, const GLfloat
*points
)
2167 GET_CURRENT_CONTEXT(ctx
);
2169 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2170 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2172 GLfloat
*pnts
= _mesa_copy_map_points1f( target
, stride
, order
, points
);
2176 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2178 n
[6].data
= (void *) pnts
;
2180 if (ctx
->ExecuteFlag
) {
2181 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, stride
, order
, points
);
2186 static void save_Map2d( GLenum target
,
2187 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2188 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2189 const GLdouble
*points
)
2191 GET_CURRENT_CONTEXT(ctx
);
2193 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2194 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2196 GLfloat
*pnts
= _mesa_copy_map_points2d( target
, ustride
, uorder
,
2197 vstride
, vorder
, points
);
2199 n
[2].f
= (GLfloat
) u1
;
2200 n
[3].f
= (GLfloat
) u2
;
2201 n
[4].f
= (GLfloat
) v1
;
2202 n
[5].f
= (GLfloat
) v2
;
2203 /* XXX verify these strides are correct */
2204 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2205 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2208 n
[10].data
= (void *) pnts
;
2210 if (ctx
->ExecuteFlag
) {
2211 (*ctx
->Exec
->Map2d
)( target
,
2212 u1
, u2
, ustride
, uorder
,
2213 v1
, v2
, vstride
, vorder
, points
);
2218 static void save_Map2f( GLenum target
,
2219 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2220 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2221 const GLfloat
*points
)
2223 GET_CURRENT_CONTEXT(ctx
);
2225 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2226 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2228 GLfloat
*pnts
= _mesa_copy_map_points2f( target
, ustride
, uorder
,
2229 vstride
, vorder
, points
);
2235 /* XXX verify these strides are correct */
2236 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2237 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2240 n
[10].data
= (void *) pnts
;
2242 if (ctx
->ExecuteFlag
) {
2243 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
2244 v1
, v2
, vstride
, vorder
, points
);
2249 static void save_MapGrid1f( GLint un
, GLfloat u1
, GLfloat u2
)
2251 GET_CURRENT_CONTEXT(ctx
);
2253 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2254 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID1
, 3 );
2260 if (ctx
->ExecuteFlag
) {
2261 (*ctx
->Exec
->MapGrid1f
)( un
, u1
, u2
);
2266 static void save_MapGrid1d( GLint un
, GLdouble u1
, GLdouble u2
)
2268 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2272 static void save_MapGrid2f( GLint un
, GLfloat u1
, GLfloat u2
,
2273 GLint vn
, GLfloat v1
, GLfloat v2
)
2275 GET_CURRENT_CONTEXT(ctx
);
2277 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2278 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID2
, 6 );
2287 if (ctx
->ExecuteFlag
) {
2288 (*ctx
->Exec
->MapGrid2f
)( un
, u1
, u2
, vn
, v1
, v2
);
2294 static void save_MapGrid2d( GLint un
, GLdouble u1
, GLdouble u2
,
2295 GLint vn
, GLdouble v1
, GLdouble v2
)
2297 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2298 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2302 static void save_MatrixMode( GLenum mode
)
2304 GET_CURRENT_CONTEXT(ctx
);
2306 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2307 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MATRIX_MODE
, 1 );
2311 if (ctx
->ExecuteFlag
) {
2312 (*ctx
->Exec
->MatrixMode
)( mode
);
2318 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2320 GET_CURRENT_CONTEXT(ctx
);
2323 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2324 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MIN_MAX
, 3 );
2327 n
[2].e
= internalFormat
;
2330 if (ctx
->ExecuteFlag
) {
2331 (*ctx
->Exec
->Minmax
)( target
, internalFormat
, sink
);
2336 static void save_MultMatrixf( const GLfloat
*m
)
2338 GET_CURRENT_CONTEXT(ctx
);
2340 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2341 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MULT_MATRIX
, 16 );
2344 for (i
=0;i
<16;i
++) {
2348 if (ctx
->ExecuteFlag
) {
2349 (*ctx
->Exec
->MultMatrixf
)( m
);
2354 static void save_MultMatrixd( const GLdouble
*m
)
2358 for (i
= 0; i
< 16; i
++) {
2359 f
[i
] = (GLfloat
) m
[i
];
2361 save_MultMatrixf(f
);
2365 static void save_NewList( GLuint list
, GLenum mode
)
2367 GET_CURRENT_CONTEXT(ctx
);
2368 /* It's an error to call this function while building a display list */
2369 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
2376 static void save_Ortho( GLdouble left
, GLdouble right
,
2377 GLdouble bottom
, GLdouble top
,
2378 GLdouble nearval
, GLdouble farval
)
2380 GET_CURRENT_CONTEXT(ctx
);
2382 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2383 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ORTHO
, 6 );
2385 n
[1].f
= (GLfloat
) left
;
2386 n
[2].f
= (GLfloat
) right
;
2387 n
[3].f
= (GLfloat
) bottom
;
2388 n
[4].f
= (GLfloat
) top
;
2389 n
[5].f
= (GLfloat
) nearval
;
2390 n
[6].f
= (GLfloat
) farval
;
2392 if (ctx
->ExecuteFlag
) {
2393 (*ctx
->Exec
->Ortho
)( left
, right
, bottom
, top
, nearval
, farval
);
2399 save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
2401 GET_CURRENT_CONTEXT(ctx
);
2403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2404 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_MAP
, 3 );
2408 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
2409 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
2411 if (ctx
->ExecuteFlag
) {
2412 (*ctx
->Exec
->PixelMapfv
)( map
, mapsize
, values
);
2418 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2420 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2422 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2423 for (i
=0;i
<mapsize
;i
++) {
2424 fvalues
[i
] = (GLfloat
) values
[i
];
2428 for (i
=0;i
<mapsize
;i
++) {
2429 fvalues
[i
] = UINT_TO_FLOAT( values
[i
] );
2432 save_PixelMapfv(map
, mapsize
, fvalues
);
2437 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2439 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2441 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2442 for (i
=0;i
<mapsize
;i
++) {
2443 fvalues
[i
] = (GLfloat
) values
[i
];
2447 for (i
=0;i
<mapsize
;i
++) {
2448 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2451 save_PixelMapfv(map
, mapsize
, fvalues
);
2456 save_PixelTransferf( GLenum pname
, GLfloat param
)
2458 GET_CURRENT_CONTEXT(ctx
);
2460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2461 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2466 if (ctx
->ExecuteFlag
) {
2467 (*ctx
->Exec
->PixelTransferf
)( pname
, param
);
2473 save_PixelTransferi( GLenum pname
, GLint param
)
2475 save_PixelTransferf( pname
, (GLfloat
) param
);
2480 save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2482 GET_CURRENT_CONTEXT(ctx
);
2484 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2485 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2490 if (ctx
->ExecuteFlag
) {
2491 (*ctx
->Exec
->PixelZoom
)( xfactor
, yfactor
);
2497 save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2499 GET_CURRENT_CONTEXT(ctx
);
2501 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2502 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2509 if (ctx
->ExecuteFlag
) {
2510 (*ctx
->Exec
->PointParameterfvEXT
)( pname
, params
);
2515 static void save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2517 save_PointParameterfvEXT(pname
, ¶m
);
2520 static void save_PointParameteriNV( GLenum pname
, GLint param
)
2522 GLfloat p
= (GLfloat
) param
;
2523 save_PointParameterfvEXT(pname
, &p
);
2526 static void save_PointParameterivNV( GLenum pname
, const GLint
*param
)
2528 GLfloat p
= (GLfloat
) param
[0];
2529 save_PointParameterfvEXT(pname
, &p
);
2533 static void save_PointSize( GLfloat size
)
2535 GET_CURRENT_CONTEXT(ctx
);
2537 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2538 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_SIZE
, 1 );
2542 if (ctx
->ExecuteFlag
) {
2543 (*ctx
->Exec
->PointSize
)( size
);
2548 static void save_PolygonMode( GLenum face
, GLenum mode
)
2550 GET_CURRENT_CONTEXT(ctx
);
2552 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2553 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_MODE
, 2 );
2558 if (ctx
->ExecuteFlag
) {
2559 (*ctx
->Exec
->PolygonMode
)( face
, mode
);
2565 * Polygon stipple must have been upacked already!
2567 static void save_PolygonStipple( const GLubyte
*pattern
)
2569 GET_CURRENT_CONTEXT(ctx
);
2571 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2572 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2575 n
[1].data
= MALLOC( 32 * 4 );
2576 data
= n
[1].data
; /* This needed for Acorn compiler */
2577 MEMCPY( data
, pattern
, 32 * 4 );
2579 if (ctx
->ExecuteFlag
) {
2580 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) pattern
);
2585 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2587 GET_CURRENT_CONTEXT(ctx
);
2589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2590 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2595 if (ctx
->ExecuteFlag
) {
2596 (*ctx
->Exec
->PolygonOffset
)( factor
, units
);
2601 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2603 GET_CURRENT_CONTEXT(ctx
);
2604 save_PolygonOffset(factor
, ctx
->DepthMaxF
* bias
);
2608 static void save_PopAttrib( void )
2610 GET_CURRENT_CONTEXT(ctx
);
2611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2612 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_ATTRIB
, 0 );
2613 if (ctx
->ExecuteFlag
) {
2614 (*ctx
->Exec
->PopAttrib
)();
2619 static void save_PopMatrix( void )
2621 GET_CURRENT_CONTEXT(ctx
);
2622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2623 FLUSH_CURRENT(ctx
, 0);
2624 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_MATRIX
, 0 );
2625 if (ctx
->ExecuteFlag
) {
2626 (*ctx
->Exec
->PopMatrix
)();
2631 static void save_PopName( void )
2633 GET_CURRENT_CONTEXT(ctx
);
2634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2635 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_NAME
, 0 );
2636 if (ctx
->ExecuteFlag
) {
2637 (*ctx
->Exec
->PopName
)();
2642 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2643 const GLclampf
*priorities
)
2645 GET_CURRENT_CONTEXT(ctx
);
2647 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2649 for (i
=0;i
<num
;i
++) {
2651 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2653 n
[1].ui
= textures
[i
];
2654 n
[2].f
= priorities
[i
];
2657 if (ctx
->ExecuteFlag
) {
2658 (*ctx
->Exec
->PrioritizeTextures
)( num
, textures
, priorities
);
2663 static void save_PushAttrib( GLbitfield mask
)
2665 GET_CURRENT_CONTEXT(ctx
);
2667 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2668 FLUSH_CURRENT(ctx
, 0);
2669 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2673 if (ctx
->ExecuteFlag
) {
2674 (*ctx
->Exec
->PushAttrib
)( mask
);
2679 static void save_PushMatrix( void )
2681 GET_CURRENT_CONTEXT(ctx
);
2682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2683 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2684 if (ctx
->ExecuteFlag
) {
2685 (*ctx
->Exec
->PushMatrix
)();
2690 static void save_PushName( GLuint name
)
2692 GET_CURRENT_CONTEXT(ctx
);
2694 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2695 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_NAME
, 1 );
2699 if (ctx
->ExecuteFlag
) {
2700 (*ctx
->Exec
->PushName
)( name
);
2705 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2707 GET_CURRENT_CONTEXT(ctx
);
2709 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2710 FLUSH_CURRENT(ctx
, 0);
2711 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RASTER_POS
, 4 );
2718 if (ctx
->ExecuteFlag
) {
2719 (*ctx
->Exec
->RasterPos4f
)( x
, y
, z
, w
);
2723 static void save_RasterPos2d(GLdouble x
, GLdouble y
)
2725 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2728 static void save_RasterPos2f(GLfloat x
, GLfloat y
)
2730 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2733 static void save_RasterPos2i(GLint x
, GLint y
)
2735 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2738 static void save_RasterPos2s(GLshort x
, GLshort y
)
2740 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2743 static void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2745 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2748 static void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2750 save_RasterPos4f(x
, y
, z
, 1.0F
);
2753 static void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2755 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2758 static void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2760 save_RasterPos4f(x
, y
, z
, 1.0F
);
2763 static void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2765 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2768 static void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2770 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2773 static void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2775 save_RasterPos4f(x
, y
, z
, w
);
2778 static void save_RasterPos2dv(const GLdouble
*v
)
2780 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2783 static void save_RasterPos2fv(const GLfloat
*v
)
2785 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2788 static void save_RasterPos2iv(const GLint
*v
)
2790 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2793 static void save_RasterPos2sv(const GLshort
*v
)
2795 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2798 static void save_RasterPos3dv(const GLdouble
*v
)
2800 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2803 static void save_RasterPos3fv(const GLfloat
*v
)
2805 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2808 static void save_RasterPos3iv(const GLint
*v
)
2810 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2813 static void save_RasterPos3sv(const GLshort
*v
)
2815 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2818 static void save_RasterPos4dv(const GLdouble
*v
)
2820 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
2821 (GLfloat
) v
[2], (GLfloat
) v
[3]);
2824 static void save_RasterPos4fv(const GLfloat
*v
)
2826 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2829 static void save_RasterPos4iv(const GLint
*v
)
2831 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
2832 (GLfloat
) v
[2], (GLfloat
) v
[3]);
2835 static void save_RasterPos4sv(const GLshort
*v
)
2837 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2841 static void save_PassThrough( GLfloat token
)
2843 GET_CURRENT_CONTEXT(ctx
);
2845 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2846 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PASSTHROUGH
, 1 );
2850 if (ctx
->ExecuteFlag
) {
2851 (*ctx
->Exec
->PassThrough
)( token
);
2856 static void save_ReadBuffer( GLenum mode
)
2858 GET_CURRENT_CONTEXT(ctx
);
2860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2861 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_READ_BUFFER
, 1 );
2865 if (ctx
->ExecuteFlag
) {
2866 (*ctx
->Exec
->ReadBuffer
)( mode
);
2872 save_ResetHistogram(GLenum target
)
2874 GET_CURRENT_CONTEXT(ctx
);
2876 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2877 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_HISTOGRAM
, 1 );
2881 if (ctx
->ExecuteFlag
) {
2882 (*ctx
->Exec
->ResetHistogram
)( target
);
2888 save_ResetMinmax(GLenum target
)
2890 GET_CURRENT_CONTEXT(ctx
);
2892 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2893 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_MIN_MAX
, 1 );
2897 if (ctx
->ExecuteFlag
) {
2898 (*ctx
->Exec
->ResetMinmax
)( target
);
2903 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2905 GET_CURRENT_CONTEXT(ctx
);
2907 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2908 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ROTATE
, 4 );
2915 if (ctx
->ExecuteFlag
) {
2916 (*ctx
->Exec
->Rotatef
)( angle
, x
, y
, z
);
2921 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2923 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
2927 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2929 GET_CURRENT_CONTEXT(ctx
);
2931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2932 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCALE
, 3 );
2938 if (ctx
->ExecuteFlag
) {
2939 (*ctx
->Exec
->Scalef
)( x
, y
, z
);
2944 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
2946 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
2950 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
2952 GET_CURRENT_CONTEXT(ctx
);
2954 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2955 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCISSOR
, 4 );
2962 if (ctx
->ExecuteFlag
) {
2963 (*ctx
->Exec
->Scissor
)( x
, y
, width
, height
);
2968 static void save_ShadeModel( GLenum mode
)
2970 GET_CURRENT_CONTEXT(ctx
);
2972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2973 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SHADE_MODEL
, 1 );
2977 if (ctx
->ExecuteFlag
) {
2978 (*ctx
->Exec
->ShadeModel
)( mode
);
2983 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
2985 GET_CURRENT_CONTEXT(ctx
);
2987 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2988 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_FUNC
, 3 );
2994 if (ctx
->ExecuteFlag
) {
2995 (*ctx
->Exec
->StencilFunc
)( func
, ref
, mask
);
3000 static void save_StencilMask( GLuint mask
)
3002 GET_CURRENT_CONTEXT(ctx
);
3004 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3005 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_MASK
, 1 );
3009 if (ctx
->ExecuteFlag
) {
3010 (*ctx
->Exec
->StencilMask
)( mask
);
3015 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
3017 GET_CURRENT_CONTEXT(ctx
);
3019 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3020 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_OP
, 3 );
3026 if (ctx
->ExecuteFlag
) {
3027 (*ctx
->Exec
->StencilOp
)( fail
, zfail
, zpass
);
3032 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
3034 GET_CURRENT_CONTEXT(ctx
);
3036 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3037 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXENV
, 6 );
3046 if (ctx
->ExecuteFlag
) {
3047 (*ctx
->Exec
->TexEnvfv
)( target
, pname
, params
);
3052 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
3054 save_TexEnvfv( target
, pname
, ¶m
);
3058 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
3061 p
[0] = (GLfloat
) param
;
3062 p
[1] = p
[2] = p
[3] = 0.0;
3063 save_TexEnvfv( target
, pname
, p
);
3067 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
3070 p
[0] = INT_TO_FLOAT( param
[0] );
3071 p
[1] = INT_TO_FLOAT( param
[1] );
3072 p
[2] = INT_TO_FLOAT( param
[2] );
3073 p
[3] = INT_TO_FLOAT( param
[3] );
3074 save_TexEnvfv( target
, pname
, p
);
3078 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
3080 GET_CURRENT_CONTEXT(ctx
);
3082 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3083 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXGEN
, 6 );
3092 if (ctx
->ExecuteFlag
) {
3093 (*ctx
->Exec
->TexGenfv
)( coord
, pname
, params
);
3098 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3101 p
[0] = (GLfloat
) params
[0];
3102 p
[1] = (GLfloat
) params
[1];
3103 p
[2] = (GLfloat
) params
[2];
3104 p
[3] = (GLfloat
) params
[3];
3105 save_TexGenfv(coord
, pname
, p
);
3109 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3111 GLfloat p
= (GLfloat
) param
;
3112 save_TexGenfv( coord
, pname
, &p
);
3116 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3119 p
[0] = (GLfloat
) params
[0];
3120 p
[1] = (GLfloat
) params
[1];
3121 p
[2] = (GLfloat
) params
[2];
3122 p
[3] = (GLfloat
) params
[3];
3123 save_TexGenfv( coord
, pname
, p
);
3127 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
3129 save_TexGenfv(coord
, pname
, ¶m
);
3133 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
3135 save_TexGeniv( coord
, pname
, ¶m
);
3139 static void save_TexParameterfv( GLenum target
,
3140 GLenum pname
, const GLfloat
*params
)
3142 GET_CURRENT_CONTEXT(ctx
);
3144 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3145 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXPARAMETER
, 6 );
3154 if (ctx
->ExecuteFlag
) {
3155 (*ctx
->Exec
->TexParameterfv
)( target
, pname
, params
);
3160 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
3162 save_TexParameterfv(target
, pname
, ¶m
);
3166 static void save_TexParameteri( GLenum target
, GLenum pname
, GLint param
)
3169 fparam
[0] = (GLfloat
) param
;
3170 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3171 save_TexParameterfv(target
, pname
, fparam
);
3175 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
3178 fparam
[0] = (GLfloat
) params
[0];
3179 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3180 save_TexParameterfv(target
, pname
, fparam
);
3184 static void save_TexImage1D( GLenum target
,
3185 GLint level
, GLint components
,
3186 GLsizei width
, GLint border
,
3187 GLenum format
, GLenum type
,
3188 const GLvoid
*pixels
)
3190 GET_CURRENT_CONTEXT(ctx
);
3191 if (target
== GL_PROXY_TEXTURE_1D
) {
3192 /* don't compile, execute immediately */
3193 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3194 border
, format
, type
, pixels
);
3197 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3198 pixels
, &ctx
->Unpack
);
3200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3201 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
3205 n
[3].i
= components
;
3206 n
[4].i
= (GLint
) width
;
3215 if (ctx
->ExecuteFlag
) {
3216 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3217 border
, format
, type
, pixels
);
3223 static void save_TexImage2D( GLenum target
,
3224 GLint level
, GLint components
,
3225 GLsizei width
, GLsizei height
, GLint border
,
3226 GLenum format
, GLenum type
,
3227 const GLvoid
*pixels
)
3229 GET_CURRENT_CONTEXT(ctx
);
3230 if (target
== GL_PROXY_TEXTURE_2D
) {
3231 /* don't compile, execute immediately */
3232 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3233 height
, border
, format
, type
, pixels
);
3236 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3237 pixels
, &ctx
->Unpack
);
3239 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3240 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
3244 n
[3].i
= components
;
3245 n
[4].i
= (GLint
) width
;
3246 n
[5].i
= (GLint
) height
;
3255 if (ctx
->ExecuteFlag
) {
3256 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3257 height
, border
, format
, type
, pixels
);
3263 static void save_TexImage3D( GLenum target
,
3264 GLint level
, GLint internalFormat
,
3265 GLsizei width
, GLsizei height
, GLsizei depth
,
3267 GLenum format
, GLenum type
,
3268 const GLvoid
*pixels
)
3270 GET_CURRENT_CONTEXT(ctx
);
3271 if (target
== GL_PROXY_TEXTURE_3D
) {
3272 /* don't compile, execute immediately */
3273 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3274 height
, depth
, border
, format
, type
, pixels
);
3278 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3279 pixels
, &ctx
->Unpack
);
3280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3281 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
3285 n
[3].i
= (GLint
) internalFormat
;
3286 n
[4].i
= (GLint
) width
;
3287 n
[5].i
= (GLint
) height
;
3288 n
[6].i
= (GLint
) depth
;
3297 if (ctx
->ExecuteFlag
) {
3298 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3299 height
, depth
, border
, format
, type
, pixels
);
3305 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
3306 GLsizei width
, GLenum format
, GLenum type
,
3307 const GLvoid
*pixels
)
3309 GET_CURRENT_CONTEXT(ctx
);
3311 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3312 pixels
, &ctx
->Unpack
);
3313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3314 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
3319 n
[4].i
= (GLint
) width
;
3327 if (ctx
->ExecuteFlag
) {
3328 (*ctx
->Exec
->TexSubImage1D
)( target
, level
, xoffset
, width
,
3329 format
, type
, pixels
);
3334 static void save_TexSubImage2D( GLenum target
, GLint level
,
3335 GLint xoffset
, GLint yoffset
,
3336 GLsizei width
, GLsizei height
,
3337 GLenum format
, GLenum type
,
3338 const GLvoid
*pixels
)
3340 GET_CURRENT_CONTEXT(ctx
);
3342 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3343 pixels
, &ctx
->Unpack
);
3344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3345 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
3351 n
[5].i
= (GLint
) width
;
3352 n
[6].i
= (GLint
) height
;
3360 if (ctx
->ExecuteFlag
) {
3361 (*ctx
->Exec
->TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
3362 width
, height
, format
, type
, pixels
);
3367 static void save_TexSubImage3D( GLenum target
, GLint level
,
3368 GLint xoffset
, GLint yoffset
,GLint zoffset
,
3369 GLsizei width
, GLsizei height
, GLsizei depth
,
3370 GLenum format
, GLenum type
,
3371 const GLvoid
*pixels
)
3373 GET_CURRENT_CONTEXT(ctx
);
3375 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3376 pixels
, &ctx
->Unpack
);
3377 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3378 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
3385 n
[6].i
= (GLint
) width
;
3386 n
[7].i
= (GLint
) height
;
3387 n
[8].i
= (GLint
) depth
;
3395 if (ctx
->ExecuteFlag
) {
3396 (*ctx
->Exec
->TexSubImage3D
)( target
, level
,
3397 xoffset
, yoffset
, zoffset
,
3398 width
, height
, depth
, format
, type
, pixels
);
3403 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
3405 GET_CURRENT_CONTEXT(ctx
);
3407 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3408 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRANSLATE
, 3 );
3414 if (ctx
->ExecuteFlag
) {
3415 (*ctx
->Exec
->Translatef
)( x
, y
, z
);
3420 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3422 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3427 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3429 GET_CURRENT_CONTEXT(ctx
);
3431 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3432 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_VIEWPORT
, 4 );
3436 n
[3].i
= (GLint
) width
;
3437 n
[4].i
= (GLint
) height
;
3439 if (ctx
->ExecuteFlag
) {
3440 (*ctx
->Exec
->Viewport
)( x
, y
, width
, height
);
3445 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3447 GET_CURRENT_CONTEXT(ctx
);
3449 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3450 FLUSH_CURRENT(ctx
, 0);
3451 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_WINDOW_POS
, 4 );
3458 if (ctx
->ExecuteFlag
) {
3459 (*ctx
->Exec
->WindowPos4fMESA
)( x
, y
, z
, w
);
3463 static void save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3465 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3468 static void save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3470 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3473 static void save_WindowPos2iMESA(GLint x
, GLint y
)
3475 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3478 static void save_WindowPos2sMESA(GLshort x
, GLshort y
)
3480 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3483 static void save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3485 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3488 static void save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3490 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3493 static void save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3495 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3498 static void save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3500 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3503 static void save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3505 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3508 static void save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3510 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3513 static void save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3515 save_WindowPos4fMESA(x
, y
, z
, w
);
3518 static void save_WindowPos2dvMESA(const GLdouble
*v
)
3520 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3523 static void save_WindowPos2fvMESA(const GLfloat
*v
)
3525 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3528 static void save_WindowPos2ivMESA(const GLint
*v
)
3530 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3533 static void save_WindowPos2svMESA(const GLshort
*v
)
3535 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3538 static void save_WindowPos3dvMESA(const GLdouble
*v
)
3540 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3543 static void save_WindowPos3fvMESA(const GLfloat
*v
)
3545 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3548 static void save_WindowPos3ivMESA(const GLint
*v
)
3550 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3553 static void save_WindowPos3svMESA(const GLshort
*v
)
3555 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3558 static void save_WindowPos4dvMESA(const GLdouble
*v
)
3560 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3561 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3564 static void save_WindowPos4fvMESA(const GLfloat
*v
)
3566 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3569 static void save_WindowPos4ivMESA(const GLint
*v
)
3571 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3572 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3575 static void save_WindowPos4svMESA(const GLshort
*v
)
3577 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3582 /* GL_ARB_multitexture */
3583 static void save_ActiveTextureARB( GLenum target
)
3585 GET_CURRENT_CONTEXT(ctx
);
3587 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3588 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3592 if (ctx
->ExecuteFlag
) {
3593 (*ctx
->Exec
->ActiveTextureARB
)( target
);
3598 /* GL_ARB_transpose_matrix */
3600 static void save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3603 _math_transposefd(tm
, m
);
3604 save_LoadMatrixf(tm
);
3608 static void save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3611 _math_transposef(tm
, m
);
3612 save_LoadMatrixf(tm
);
3617 save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3620 _math_transposefd(tm
, m
);
3621 save_MultMatrixf(tm
);
3626 save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3629 _math_transposef(tm
, m
);
3630 save_MultMatrixf(tm
);
3635 save_PixelTexGenSGIX(GLenum mode
)
3637 GET_CURRENT_CONTEXT(ctx
);
3639 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3640 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_SGIX
, 1 );
3644 if (ctx
->ExecuteFlag
) {
3645 (*ctx
->Exec
->PixelTexGenSGIX
)( mode
);
3650 /* GL_ARB_texture_compression */
3652 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3653 GLenum internalFormat
, GLsizei width
,
3654 GLint border
, GLsizei imageSize
,
3657 GET_CURRENT_CONTEXT(ctx
);
3658 if (target
== GL_PROXY_TEXTURE_1D
) {
3659 /* don't compile, execute immediately */
3660 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3661 width
, border
, imageSize
, data
);
3666 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3667 /* make copy of image */
3668 image
= MALLOC(imageSize
);
3670 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3673 MEMCPY(image
, data
, imageSize
);
3674 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7 );
3678 n
[3].e
= internalFormat
;
3679 n
[4].i
= (GLint
) width
;
3687 if (ctx
->ExecuteFlag
) {
3688 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3689 width
, border
, imageSize
, data
);
3696 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
3697 GLenum internalFormat
, GLsizei width
,
3698 GLsizei height
, GLint border
, GLsizei imageSize
,
3701 GET_CURRENT_CONTEXT(ctx
);
3702 if (target
== GL_PROXY_TEXTURE_2D
) {
3703 /* don't compile, execute immediately */
3704 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3705 width
, height
, border
, imageSize
, data
);
3710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3711 /* make copy of image */
3712 image
= MALLOC(imageSize
);
3714 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
3717 MEMCPY(image
, data
, imageSize
);
3718 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8 );
3722 n
[3].e
= internalFormat
;
3723 n
[4].i
= (GLint
) width
;
3724 n
[5].i
= (GLint
) height
;
3732 if (ctx
->ExecuteFlag
) {
3733 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3734 width
, height
, border
, imageSize
, data
);
3741 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
3742 GLenum internalFormat
, GLsizei width
,
3743 GLsizei height
, GLsizei depth
, GLint border
,
3744 GLsizei imageSize
, const GLvoid
*data
)
3746 GET_CURRENT_CONTEXT(ctx
);
3747 if (target
== GL_PROXY_TEXTURE_3D
) {
3748 /* don't compile, execute immediately */
3749 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3750 width
, height
, depth
, border
, imageSize
, data
);
3755 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3756 /* make copy of image */
3757 image
= MALLOC(imageSize
);
3759 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
3762 MEMCPY(image
, data
, imageSize
);
3763 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9 );
3767 n
[3].e
= internalFormat
;
3768 n
[4].i
= (GLint
) width
;
3769 n
[5].i
= (GLint
) height
;
3770 n
[6].i
= (GLint
) depth
;
3778 if (ctx
->ExecuteFlag
) {
3779 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3780 width
, height
, depth
, border
, imageSize
, data
);
3787 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
3788 GLsizei width
, GLenum format
,
3789 GLsizei imageSize
, const GLvoid
*data
)
3794 GET_CURRENT_CONTEXT(ctx
);
3795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3797 /* make copy of image */
3798 image
= MALLOC(imageSize
);
3800 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
3803 MEMCPY(image
, data
, imageSize
);
3804 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7 );
3809 n
[4].i
= (GLint
) width
;
3817 if (ctx
->ExecuteFlag
) {
3818 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(target
, level
, xoffset
,
3819 width
, format
, imageSize
, data
);
3825 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
3826 GLint yoffset
, GLsizei width
, GLsizei height
,
3827 GLenum format
, GLsizei imageSize
,
3833 GET_CURRENT_CONTEXT(ctx
);
3834 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3836 /* make copy of image */
3837 image
= MALLOC(imageSize
);
3839 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
3842 MEMCPY(image
, data
, imageSize
);
3843 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9 );
3849 n
[5].i
= (GLint
) width
;
3850 n
[6].i
= (GLint
) height
;
3858 if (ctx
->ExecuteFlag
) {
3859 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(target
, level
, xoffset
, yoffset
,
3860 width
, height
, format
, imageSize
, data
);
3866 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
3867 GLint yoffset
, GLint zoffset
, GLsizei width
,
3868 GLsizei height
, GLsizei depth
, GLenum format
,
3869 GLsizei imageSize
, const GLvoid
*data
)
3874 GET_CURRENT_CONTEXT(ctx
);
3875 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3877 /* make copy of image */
3878 image
= MALLOC(imageSize
);
3880 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
3883 MEMCPY(image
, data
, imageSize
);
3884 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11 );
3891 n
[6].i
= (GLint
) width
;
3892 n
[7].i
= (GLint
) height
;
3893 n
[8].i
= (GLint
) depth
;
3895 n
[10].i
= imageSize
;
3901 if (ctx
->ExecuteFlag
) {
3902 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(target
, level
, xoffset
, yoffset
,
3903 zoffset
, width
, height
, depth
, format
, imageSize
, data
);
3908 /* GL_ARB_multisample */
3910 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
3912 GET_CURRENT_CONTEXT(ctx
);
3914 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3915 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SAMPLE_COVERAGE
, 2 );
3920 if (ctx
->ExecuteFlag
) {
3921 (*ctx
->Exec
->SampleCoverageARB
)( value
, invert
);
3926 /* GL_SGIS_pixel_texture */
3929 save_PixelTexGenParameteriSGIS(GLenum target
, GLint value
)
3931 GET_CURRENT_CONTEXT(ctx
);
3933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3934 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
, 2 );
3939 if (ctx
->ExecuteFlag
) {
3940 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( target
, value
);
3946 save_PixelTexGenParameterfSGIS(GLenum target
, GLfloat value
)
3948 save_PixelTexGenParameteriSGIS(target
, (GLint
) value
);
3953 save_PixelTexGenParameterivSGIS(GLenum target
, const GLint
*value
)
3955 save_PixelTexGenParameteriSGIS(target
, *value
);
3960 save_PixelTexGenParameterfvSGIS(GLenum target
, const GLfloat
*value
)
3962 save_PixelTexGenParameteriSGIS(target
, (GLint
) *value
);
3967 * GL_NV_vertex_program
3970 save_BindProgramNV(GLenum target
, GLuint id
)
3972 GET_CURRENT_CONTEXT(ctx
);
3974 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3975 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_PROGRAM_NV
, 2 );
3980 if (ctx
->ExecuteFlag
) {
3981 (*ctx
->Exec
->BindProgramNV
)( target
, id
);
3986 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
3988 GET_CURRENT_CONTEXT(ctx
);
3990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3991 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6 );
4000 if (ctx
->ExecuteFlag
) {
4001 (*ctx
->Exec
->ExecuteProgramNV
)(target
, id
, params
);
4007 save_ProgramParameter4fNV(GLenum target
, GLuint index
,
4008 GLfloat x
, GLfloat y
,
4009 GLfloat z
, GLfloat w
)
4011 GET_CURRENT_CONTEXT(ctx
);
4013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4014 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_PARAMETER4F_NV
, 6 );
4023 if (ctx
->ExecuteFlag
) {
4024 (*ctx
->Exec
->ProgramParameter4fNV
)(target
, index
, x
, y
, z
, w
);
4030 save_ProgramParameter4fvNV(GLenum target
, GLuint index
, const GLfloat
*params
)
4032 save_ProgramParameter4fNV(target
, index
, params
[0], params
[1],
4033 params
[2], params
[3]);
4038 save_ProgramParameter4dNV(GLenum target
, GLuint index
,
4039 GLdouble x
, GLdouble y
,
4040 GLdouble z
, GLdouble w
)
4042 save_ProgramParameter4fNV(target
, index
, (GLfloat
) x
, (GLfloat
) y
,
4043 (GLfloat
) z
, (GLfloat
) w
);
4048 save_ProgramParameter4dvNV(GLenum target
, GLuint index
,
4049 const GLdouble
*params
)
4051 save_ProgramParameter4fNV(target
, index
, (GLfloat
) params
[0],
4052 (GLfloat
) params
[1], (GLfloat
) params
[2],
4053 (GLfloat
) params
[3]);
4058 save_TrackMatrixNV(GLenum target
, GLuint address
,
4059 GLenum matrix
, GLenum transform
)
4061 GET_CURRENT_CONTEXT(ctx
);
4063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4064 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRACK_MATRIX_NV
, 4 );
4071 if (ctx
->ExecuteFlag
) {
4072 (*ctx
->Exec
->TrackMatrixNV
)(target
, address
, matrix
, transform
);
4079 /* KW: Compile commands
4081 * Will appear in the list before the vertex buffer containing the
4082 * command that provoked the error. I don't see this as a problem.
4085 _mesa_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
4088 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ERROR
, 2 );
4091 n
[2].data
= (void *) s
;
4093 /* execute already done */
4098 * Compile an error into current display list.
4101 _mesa_compile_error( GLcontext
*ctx
, GLenum error
, const char *s
)
4103 if (ctx
->CompileFlag
)
4104 _mesa_save_error( ctx
, error
, s
);
4106 if (ctx
->ExecuteFlag
)
4107 _mesa_error( ctx
, error
, s
);
4113 islist(GLcontext
*ctx
, GLuint list
)
4115 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
4125 /**********************************************************************/
4126 /* Display list execution */
4127 /**********************************************************************/
4131 * Execute a display list. Note that the ListBase offset must have already
4132 * been added before calling this function. I.e. the list argument is
4133 * the absolute list number, not relative to ListBase.
4134 * Input: list - display list number
4137 execute_list( GLcontext
*ctx
, GLuint list
)
4142 if (!islist(ctx
,list
))
4145 if (ctx
->Driver
.BeginCallList
)
4146 ctx
->Driver
.BeginCallList( ctx
, list
);
4150 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
4154 OpCode opcode
= n
[0].opcode
;
4155 int i
= (int)n
[0].opcode
- (int)OPCODE_DRV_0
;
4157 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
4158 ctx
->listext
.opcode
[i
].execute(ctx
, &n
[1]);
4159 n
+= ctx
->listext
.opcode
[i
].size
;
4164 _mesa_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
4167 (*ctx
->Exec
->Accum
)( n
[1].e
, n
[2].f
);
4169 case OPCODE_ALPHA_FUNC
:
4170 (*ctx
->Exec
->AlphaFunc
)( n
[1].e
, n
[2].f
);
4172 case OPCODE_BIND_TEXTURE
:
4173 (*ctx
->Exec
->BindTexture
)( n
[1].e
, n
[2].ui
);
4177 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4178 ctx
->Unpack
= _mesa_native_packing
;
4179 (*ctx
->Exec
->Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
4180 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (const GLubyte
*) n
[7].data
);
4181 ctx
->Unpack
= save
; /* restore */
4184 case OPCODE_BLEND_COLOR
:
4185 (*ctx
->Exec
->BlendColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4187 case OPCODE_BLEND_EQUATION
:
4188 (*ctx
->Exec
->BlendEquation
)( n
[1].e
);
4190 case OPCODE_BLEND_FUNC
:
4191 (*ctx
->Exec
->BlendFunc
)( n
[1].e
, n
[2].e
);
4193 case OPCODE_BLEND_FUNC_SEPARATE
:
4194 (*ctx
->Exec
->BlendFuncSeparateEXT
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
4196 case OPCODE_CALL_LIST
:
4197 /* Generated by glCallList(), don't add ListBase */
4198 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4199 execute_list( ctx
, n
[1].ui
);
4202 case OPCODE_CALL_LIST_OFFSET
:
4203 /* Generated by glCallLists() so we must add ListBase */
4204 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4205 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
4209 (*ctx
->Exec
->Clear
)( n
[1].bf
);
4211 case OPCODE_CLEAR_COLOR
:
4212 (*ctx
->Exec
->ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4214 case OPCODE_CLEAR_ACCUM
:
4215 (*ctx
->Exec
->ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4217 case OPCODE_CLEAR_DEPTH
:
4218 (*ctx
->Exec
->ClearDepth
)( (GLclampd
) n
[1].f
);
4220 case OPCODE_CLEAR_INDEX
:
4221 (*ctx
->Exec
->ClearIndex
)( (GLfloat
) n
[1].ui
);
4223 case OPCODE_CLEAR_STENCIL
:
4224 (*ctx
->Exec
->ClearStencil
)( n
[1].i
);
4226 case OPCODE_CLIP_PLANE
:
4233 (*ctx
->Exec
->ClipPlane
)( n
[1].e
, eq
);
4236 case OPCODE_COLOR_MASK
:
4237 (*ctx
->Exec
->ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
4239 case OPCODE_COLOR_MATERIAL
:
4240 (*ctx
->Exec
->ColorMaterial
)( n
[1].e
, n
[2].e
);
4242 case OPCODE_COLOR_TABLE
:
4244 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4245 ctx
->Unpack
= _mesa_native_packing
;
4246 (*ctx
->Exec
->ColorTable
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
4247 n
[5].e
, n
[6].data
);
4248 ctx
->Unpack
= save
; /* restore */
4251 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
4258 (*ctx
->Exec
->ColorTableParameterfv
)( n
[1].e
, n
[2].e
, params
);
4261 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
4268 (*ctx
->Exec
->ColorTableParameteriv
)( n
[1].e
, n
[2].e
, params
);
4271 case OPCODE_COLOR_SUB_TABLE
:
4273 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4274 ctx
->Unpack
= _mesa_native_packing
;
4275 (*ctx
->Exec
->ColorSubTable
)( n
[1].e
, n
[2].i
, n
[3].i
,
4276 n
[4].e
, n
[5].e
, n
[6].data
);
4277 ctx
->Unpack
= save
; /* restore */
4280 case OPCODE_CONVOLUTION_FILTER_1D
:
4282 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4283 ctx
->Unpack
= _mesa_native_packing
;
4284 (*ctx
->Exec
->ConvolutionFilter1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4285 n
[4].e
, n
[5].e
, n
[6].data
);
4286 ctx
->Unpack
= save
; /* restore */
4289 case OPCODE_CONVOLUTION_FILTER_2D
:
4291 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4292 ctx
->Unpack
= _mesa_native_packing
;
4293 (*ctx
->Exec
->ConvolutionFilter2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4294 n
[4].i
, n
[5].e
, n
[6].e
, n
[7].data
);
4295 ctx
->Unpack
= save
; /* restore */
4298 case OPCODE_CONVOLUTION_PARAMETER_I
:
4299 (*ctx
->Exec
->ConvolutionParameteri
)( n
[1].e
, n
[2].e
, n
[3].i
);
4301 case OPCODE_CONVOLUTION_PARAMETER_IV
:
4308 (*ctx
->Exec
->ConvolutionParameteriv
)( n
[1].e
, n
[2].e
, params
);
4311 case OPCODE_CONVOLUTION_PARAMETER_F
:
4312 (*ctx
->Exec
->ConvolutionParameterf
)( n
[1].e
, n
[2].e
, n
[3].f
);
4314 case OPCODE_CONVOLUTION_PARAMETER_FV
:
4321 (*ctx
->Exec
->ConvolutionParameterfv
)( n
[1].e
, n
[2].e
, params
);
4324 case OPCODE_COPY_COLOR_SUB_TABLE
:
4325 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4326 n
[3].i
, n
[4].i
, n
[5].i
);
4328 case OPCODE_COPY_COLOR_TABLE
:
4329 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4330 n
[3].i
, n
[4].i
, n
[5].i
);
4332 case OPCODE_COPY_PIXELS
:
4333 (*ctx
->Exec
->CopyPixels
)( n
[1].i
, n
[2].i
,
4334 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
4336 case OPCODE_COPY_TEX_IMAGE1D
:
4337 (*ctx
->Exec
->CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4338 n
[5].i
, n
[6].i
, n
[7].i
);
4340 case OPCODE_COPY_TEX_IMAGE2D
:
4341 (*ctx
->Exec
->CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4342 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4344 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
4345 (*ctx
->Exec
->CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4346 n
[4].i
, n
[5].i
, n
[6].i
);
4348 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
4349 (*ctx
->Exec
->CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4350 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4352 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
4353 (*ctx
->Exec
->CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4354 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
4356 case OPCODE_CULL_FACE
:
4357 (*ctx
->Exec
->CullFace
)( n
[1].e
);
4359 case OPCODE_DEPTH_FUNC
:
4360 (*ctx
->Exec
->DepthFunc
)( n
[1].e
);
4362 case OPCODE_DEPTH_MASK
:
4363 (*ctx
->Exec
->DepthMask
)( n
[1].b
);
4365 case OPCODE_DEPTH_RANGE
:
4366 (*ctx
->Exec
->DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
4368 case OPCODE_DISABLE
:
4369 (*ctx
->Exec
->Disable
)( n
[1].e
);
4371 case OPCODE_DRAW_BUFFER
:
4372 (*ctx
->Exec
->DrawBuffer
)( n
[1].e
);
4374 case OPCODE_DRAW_PIXELS
:
4376 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4377 ctx
->Unpack
= _mesa_native_packing
;
4378 (*ctx
->Exec
->DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
4380 ctx
->Unpack
= save
; /* restore */
4384 (*ctx
->Exec
->Enable
)( n
[1].e
);
4386 case OPCODE_EVALMESH1
:
4387 (*ctx
->Exec
->EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
4389 case OPCODE_EVALMESH2
:
4390 (*ctx
->Exec
->EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
4399 (*ctx
->Exec
->Fogfv
)( n
[1].e
, p
);
4402 case OPCODE_FRONT_FACE
:
4403 (*ctx
->Exec
->FrontFace
)( n
[1].e
);
4405 case OPCODE_FRUSTUM
:
4406 (*ctx
->Exec
->Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4409 (*ctx
->Exec
->Hint
)( n
[1].e
, n
[2].e
);
4411 case OPCODE_HISTOGRAM
:
4412 (*ctx
->Exec
->Histogram
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
);
4414 case OPCODE_INDEX_MASK
:
4415 (*ctx
->Exec
->IndexMask
)( n
[1].ui
);
4417 case OPCODE_INIT_NAMES
:
4418 (*ctx
->Exec
->InitNames
)();
4427 (*ctx
->Exec
->Lightfv
)( n
[1].e
, n
[2].e
, p
);
4430 case OPCODE_LIGHT_MODEL
:
4437 (*ctx
->Exec
->LightModelfv
)( n
[1].e
, p
);
4440 case OPCODE_LINE_STIPPLE
:
4441 (*ctx
->Exec
->LineStipple
)( n
[1].i
, n
[2].us
);
4443 case OPCODE_LINE_WIDTH
:
4444 (*ctx
->Exec
->LineWidth
)( n
[1].f
);
4446 case OPCODE_LIST_BASE
:
4447 (*ctx
->Exec
->ListBase
)( n
[1].ui
);
4449 case OPCODE_LOAD_IDENTITY
:
4450 (*ctx
->Exec
->LoadIdentity
)();
4452 case OPCODE_LOAD_MATRIX
:
4453 if (sizeof(Node
)==sizeof(GLfloat
)) {
4454 (*ctx
->Exec
->LoadMatrixf
)( &n
[1].f
);
4459 for (i
=0;i
<16;i
++) {
4462 (*ctx
->Exec
->LoadMatrixf
)( m
);
4465 case OPCODE_LOAD_NAME
:
4466 (*ctx
->Exec
->LoadName
)( n
[1].ui
);
4468 case OPCODE_LOGIC_OP
:
4469 (*ctx
->Exec
->LogicOp
)( n
[1].e
);
4473 GLenum target
= n
[1].e
;
4474 GLint ustride
= _mesa_evaluator_components(target
);
4475 GLint uorder
= n
[5].i
;
4476 GLfloat u1
= n
[2].f
;
4477 GLfloat u2
= n
[3].f
;
4478 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, ustride
, uorder
,
4479 (GLfloat
*) n
[6].data
);
4484 GLenum target
= n
[1].e
;
4485 GLfloat u1
= n
[2].f
;
4486 GLfloat u2
= n
[3].f
;
4487 GLfloat v1
= n
[4].f
;
4488 GLfloat v2
= n
[5].f
;
4489 GLint ustride
= n
[6].i
;
4490 GLint vstride
= n
[7].i
;
4491 GLint uorder
= n
[8].i
;
4492 GLint vorder
= n
[9].i
;
4493 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
4494 v1
, v2
, vstride
, vorder
,
4495 (GLfloat
*) n
[10].data
);
4498 case OPCODE_MAPGRID1
:
4499 (*ctx
->Exec
->MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
4501 case OPCODE_MAPGRID2
:
4502 (*ctx
->Exec
->MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
4504 case OPCODE_MATRIX_MODE
:
4505 (*ctx
->Exec
->MatrixMode
)( n
[1].e
);
4507 case OPCODE_MIN_MAX
:
4508 (*ctx
->Exec
->Minmax
)(n
[1].e
, n
[2].e
, n
[3].b
);
4510 case OPCODE_MULT_MATRIX
:
4511 if (sizeof(Node
)==sizeof(GLfloat
)) {
4512 (*ctx
->Exec
->MultMatrixf
)( &n
[1].f
);
4517 for (i
=0;i
<16;i
++) {
4520 (*ctx
->Exec
->MultMatrixf
)( m
);
4524 (*ctx
->Exec
->Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4526 case OPCODE_PASSTHROUGH
:
4527 (*ctx
->Exec
->PassThrough
)( n
[1].f
);
4529 case OPCODE_PIXEL_MAP
:
4530 (*ctx
->Exec
->PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
4532 case OPCODE_PIXEL_TRANSFER
:
4533 (*ctx
->Exec
->PixelTransferf
)( n
[1].e
, n
[2].f
);
4535 case OPCODE_PIXEL_ZOOM
:
4536 (*ctx
->Exec
->PixelZoom
)( n
[1].f
, n
[2].f
);
4538 case OPCODE_POINT_SIZE
:
4539 (*ctx
->Exec
->PointSize
)( n
[1].f
);
4541 case OPCODE_POINT_PARAMETERS
:
4547 (*ctx
->Exec
->PointParameterfvEXT
)( n
[1].e
, params
);
4550 case OPCODE_POLYGON_MODE
:
4551 (*ctx
->Exec
->PolygonMode
)( n
[1].e
, n
[2].e
);
4553 case OPCODE_POLYGON_STIPPLE
:
4554 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) n
[1].data
);
4556 case OPCODE_POLYGON_OFFSET
:
4557 (*ctx
->Exec
->PolygonOffset
)( n
[1].f
, n
[2].f
);
4559 case OPCODE_POP_ATTRIB
:
4560 (*ctx
->Exec
->PopAttrib
)();
4562 case OPCODE_POP_MATRIX
:
4563 (*ctx
->Exec
->PopMatrix
)();
4565 case OPCODE_POP_NAME
:
4566 (*ctx
->Exec
->PopName
)();
4568 case OPCODE_PRIORITIZE_TEXTURE
:
4569 (*ctx
->Exec
->PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
4571 case OPCODE_PUSH_ATTRIB
:
4572 (*ctx
->Exec
->PushAttrib
)( n
[1].bf
);
4574 case OPCODE_PUSH_MATRIX
:
4575 (*ctx
->Exec
->PushMatrix
)();
4577 case OPCODE_PUSH_NAME
:
4578 (*ctx
->Exec
->PushName
)( n
[1].ui
);
4580 case OPCODE_RASTER_POS
:
4581 (*ctx
->Exec
->RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4583 case OPCODE_READ_BUFFER
:
4584 (*ctx
->Exec
->ReadBuffer
)( n
[1].e
);
4586 case OPCODE_RESET_HISTOGRAM
:
4587 (*ctx
->Exec
->ResetHistogram
)( n
[1].e
);
4589 case OPCODE_RESET_MIN_MAX
:
4590 (*ctx
->Exec
->ResetMinmax
)( n
[1].e
);
4593 (*ctx
->Exec
->Rotatef
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4596 (*ctx
->Exec
->Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4598 case OPCODE_SCISSOR
:
4599 (*ctx
->Exec
->Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
4601 case OPCODE_SHADE_MODEL
:
4602 (*ctx
->Exec
->ShadeModel
)( n
[1].e
);
4604 case OPCODE_STENCIL_FUNC
:
4605 (*ctx
->Exec
->StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
4607 case OPCODE_STENCIL_MASK
:
4608 (*ctx
->Exec
->StencilMask
)( n
[1].ui
);
4610 case OPCODE_STENCIL_OP
:
4611 (*ctx
->Exec
->StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
4620 (*ctx
->Exec
->TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
4630 (*ctx
->Exec
->TexGenfv
)( n
[1].e
, n
[2].e
, params
);
4633 case OPCODE_TEXPARAMETER
:
4640 (*ctx
->Exec
->TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
4643 case OPCODE_TEX_IMAGE1D
:
4645 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4646 ctx
->Unpack
= _mesa_native_packing
;
4647 (*ctx
->Exec
->TexImage1D
)(
4648 n
[1].e
, /* target */
4650 n
[3].i
, /* components */
4652 n
[5].e
, /* border */
4653 n
[6].e
, /* format */
4656 ctx
->Unpack
= save
; /* restore */
4659 case OPCODE_TEX_IMAGE2D
:
4661 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4662 ctx
->Unpack
= _mesa_native_packing
;
4663 (*ctx
->Exec
->TexImage2D
)(
4664 n
[1].e
, /* target */
4666 n
[3].i
, /* components */
4668 n
[5].i
, /* height */
4669 n
[6].e
, /* border */
4670 n
[7].e
, /* format */
4673 ctx
->Unpack
= save
; /* restore */
4676 case OPCODE_TEX_IMAGE3D
:
4678 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4679 ctx
->Unpack
= _mesa_native_packing
;
4680 (*ctx
->Exec
->TexImage3D
)(
4681 n
[1].e
, /* target */
4683 n
[3].i
, /* components */
4685 n
[5].i
, /* height */
4687 n
[7].e
, /* border */
4688 n
[8].e
, /* format */
4691 ctx
->Unpack
= save
; /* restore */
4694 case OPCODE_TEX_SUB_IMAGE1D
:
4696 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4697 ctx
->Unpack
= _mesa_native_packing
;
4698 (*ctx
->Exec
->TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4700 n
[6].e
, n
[7].data
);
4701 ctx
->Unpack
= save
; /* restore */
4704 case OPCODE_TEX_SUB_IMAGE2D
:
4706 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4707 ctx
->Unpack
= _mesa_native_packing
;
4708 (*ctx
->Exec
->TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4710 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
4711 ctx
->Unpack
= save
; /* restore */
4714 case OPCODE_TEX_SUB_IMAGE3D
:
4716 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4717 ctx
->Unpack
= _mesa_native_packing
;
4718 (*ctx
->Exec
->TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4719 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
4720 n
[8].i
, n
[9].e
, n
[10].e
,
4722 ctx
->Unpack
= save
; /* restore */
4725 case OPCODE_TRANSLATE
:
4726 (*ctx
->Exec
->Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4728 case OPCODE_VIEWPORT
:
4729 (*ctx
->Exec
->Viewport
)(n
[1].i
, n
[2].i
,
4730 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
4732 case OPCODE_WINDOW_POS
:
4733 (*ctx
->Exec
->WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4735 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
4736 (*ctx
->Exec
->ActiveTextureARB
)( n
[1].e
);
4738 case OPCODE_PIXEL_TEXGEN_SGIX
: /* GL_SGIX_pixel_texture */
4739 (*ctx
->Exec
->PixelTexGenSGIX
)( n
[1].e
);
4741 case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
: /* GL_SGIS_pixel_texture */
4742 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( n
[1].e
, n
[2].i
);
4744 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
4745 (*ctx
->Exec
->CompressedTexImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4746 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].data
);
4748 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
4749 (*ctx
->Exec
->CompressedTexImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4750 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].data
);
4752 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
4753 (*ctx
->Exec
->CompressedTexImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4754 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].data
);
4756 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
4757 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4758 n
[4].i
, n
[5].e
, n
[6].i
, n
[7].data
);
4760 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
4761 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4762 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
, n
[9].data
);
4764 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
4765 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4766 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
4767 n
[9].e
, n
[10].i
, n
[11].data
);
4769 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
4770 (*ctx
->Exec
->SampleCoverageARB
)(n
[1].f
, n
[2].b
);
4772 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
4773 (*ctx
->Exec
->WindowPos3fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
);
4775 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
4776 (*ctx
->Exec
->BindProgramNV
)( n
[1].e
, n
[2].ui
);
4778 case OPCODE_EXECUTE_PROGRAM_NV
:
4785 (*ctx
->Exec
->ExecuteProgramNV
)(n
[1].e
, n
[2].ui
, v
);
4788 case OPCODE_REQUEST_PROGRAMS_RESIDENT_NV
:
4790 (*ctx->Exec->RequestResidentProgramsNV)();
4793 case OPCODE_LOAD_PROGRAM_NV
:
4795 (*ctx->Exec->LoadProgramNV)();
4798 case OPCODE_PROGRAM_PARAMETER4F_NV
:
4799 (*ctx
->Exec
->ProgramParameter4fNV
)(n
[1].e
, n
[2].ui
, n
[3].f
,
4800 n
[4].f
, n
[5].f
, n
[6].f
);
4802 case OPCODE_PROGRAM_PARAMETERS4FV_NV
:
4804 (*ctx->Exec->ProgramParameters4fvNV)();
4807 case OPCODE_TRACK_MATRIX_NV
:
4808 (*ctx
->Exec
->TrackMatrixNV
)(n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
);
4811 case OPCODE_CONTINUE
:
4812 n
= (Node
*) n
[1].next
;
4814 case OPCODE_END_OF_LIST
:
4820 sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
4821 _mesa_problem( ctx
, msg
);
4826 /* increment n to point to next compiled command */
4827 if (opcode
!=OPCODE_CONTINUE
) {
4828 n
+= InstSize
[opcode
];
4834 if (ctx
->Driver
.EndCallList
)
4835 ctx
->Driver
.EndCallList( ctx
);
4842 /**********************************************************************/
4844 /**********************************************************************/
4850 * Test if a display list number is valid.
4853 _mesa_IsList( GLuint list
)
4855 GET_CURRENT_CONTEXT(ctx
);
4856 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4857 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
4858 return islist(ctx
, list
);
4863 * Delete a sequence of consecutive display lists.
4866 _mesa_DeleteLists( GLuint list
, GLsizei range
)
4868 GET_CURRENT_CONTEXT(ctx
);
4870 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4871 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4874 _mesa_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
4877 for (i
=list
;i
<list
+range
;i
++) {
4878 _mesa_destroy_list( ctx
, i
);
4885 * Return a display list number, n, such that lists n through n+range-1
4889 _mesa_GenLists(GLsizei range
)
4891 GET_CURRENT_CONTEXT(ctx
);
4893 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4894 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
4897 _mesa_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
4905 * Make this an atomic operation
4907 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
4909 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
4911 /* reserve the list IDs by with empty/dummy lists */
4913 for (i
=0; i
<range
; i
++) {
4914 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
4918 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
4926 * Begin a new display list.
4929 _mesa_NewList( GLuint list
, GLenum mode
)
4931 GET_CURRENT_CONTEXT(ctx
);
4932 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
4933 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4935 if (MESA_VERBOSE
&VERBOSE_API
)
4936 _mesa_debug(ctx
, "glNewList %u %s\n", list
,
4937 _mesa_lookup_enum_by_nr(mode
));
4940 _mesa_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
4944 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
4945 _mesa_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
4949 if (ctx
->CurrentListPtr
) {
4950 /* already compiling a display list */
4951 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
4955 /* Allocate new display list */
4956 ctx
->CurrentListNum
= list
;
4957 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
4958 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
4959 ctx
->CurrentPos
= 0;
4960 ctx
->CompileFlag
= GL_TRUE
;
4961 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
4963 ctx
->Driver
.NewList( ctx
, list
, mode
);
4965 ctx
->CurrentDispatch
= ctx
->Save
;
4966 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4972 * End definition of current display list. Is the current
4973 * ASSERT_OUTSIDE_BEGIN_END strong enough to really guarentee that
4974 * we are outside begin/end calls?
4977 _mesa_EndList( void )
4979 GET_CURRENT_CONTEXT(ctx
);
4980 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
4981 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
4983 if (MESA_VERBOSE
&VERBOSE_API
)
4984 _mesa_debug(ctx
, "glEndList\n");
4986 /* Check that a list is under construction */
4987 if (!ctx
->CurrentListPtr
) {
4988 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
4992 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_END_OF_LIST
, 0 );
4994 /* Destroy old list, if any */
4995 _mesa_destroy_list(ctx
, ctx
->CurrentListNum
);
4996 /* Install the list */
4997 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
5000 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
5001 mesa_print_display_list(ctx
->CurrentListNum
);
5003 ctx
->CurrentListNum
= 0;
5004 ctx
->CurrentListPtr
= NULL
;
5005 ctx
->ExecuteFlag
= GL_TRUE
;
5006 ctx
->CompileFlag
= GL_FALSE
;
5008 ctx
->Driver
.EndList( ctx
);
5010 ctx
->CurrentDispatch
= ctx
->Exec
;
5011 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5017 _mesa_CallList( GLuint list
)
5019 GLboolean save_compile_flag
;
5020 GET_CURRENT_CONTEXT(ctx
);
5021 FLUSH_CURRENT(ctx
, 0);
5022 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
5023 /* execute the display list, and restore the CompileFlag. */
5026 if (MESA_VERBOSE
& VERBOSE_API
)
5027 _mesa_debug(ctx
, "_mesa_CallList %d\n", list
);
5029 /* mesa_print_display_list( list ); */
5031 save_compile_flag
= ctx
->CompileFlag
;
5032 if (save_compile_flag
) {
5033 ctx
->CompileFlag
= GL_FALSE
;
5036 execute_list( ctx
, list
);
5037 ctx
->CompileFlag
= save_compile_flag
;
5039 /* also restore API function pointers to point to "save" versions */
5040 if (save_compile_flag
) {
5041 ctx
->CurrentDispatch
= ctx
->Save
;
5042 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5049 * Execute glCallLists: call multiple display lists.
5052 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
5054 GET_CURRENT_CONTEXT(ctx
);
5057 GLboolean save_compile_flag
;
5059 if (MESA_VERBOSE
& VERBOSE_API
)
5060 _mesa_debug(ctx
, "_mesa_CallLists %d\n", n
);
5062 /* Save the CompileFlag status, turn it off, execute display list,
5063 * and restore the CompileFlag.
5065 save_compile_flag
= ctx
->CompileFlag
;
5066 ctx
->CompileFlag
= GL_FALSE
;
5069 list
= translate_id( i
, type
, lists
);
5070 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
5073 ctx
->CompileFlag
= save_compile_flag
;
5075 /* also restore API function pointers to point to "save" versions */
5076 if (save_compile_flag
) {
5077 ctx
->CurrentDispatch
= ctx
->Save
;
5078 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5085 * Set the offset added to list numbers in glCallLists.
5088 _mesa_ListBase( GLuint base
)
5090 GET_CURRENT_CONTEXT(ctx
);
5091 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
5092 ASSERT_OUTSIDE_BEGIN_END(ctx
);
5093 ctx
->List
.ListBase
= base
;
5097 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
5099 static void exec_Finish( void )
5101 GET_CURRENT_CONTEXT(ctx
);
5102 FLUSH_VERTICES(ctx
, 0);
5103 ctx
->Exec
->Finish();
5106 static void exec_Flush( void )
5108 GET_CURRENT_CONTEXT(ctx
);
5109 FLUSH_VERTICES(ctx
, 0);
5110 ctx
->Exec
->Flush( );
5113 static void exec_GetBooleanv( GLenum pname
, GLboolean
*params
)
5115 GET_CURRENT_CONTEXT(ctx
);
5116 FLUSH_VERTICES(ctx
, 0);
5117 ctx
->Exec
->GetBooleanv( pname
, params
);
5120 static void exec_GetClipPlane( GLenum plane
, GLdouble
*equation
)
5122 GET_CURRENT_CONTEXT(ctx
);
5123 FLUSH_VERTICES(ctx
, 0);
5124 ctx
->Exec
->GetClipPlane( plane
, equation
);
5127 static void exec_GetDoublev( GLenum pname
, GLdouble
*params
)
5129 GET_CURRENT_CONTEXT(ctx
);
5130 FLUSH_VERTICES(ctx
, 0);
5131 ctx
->Exec
->GetDoublev( pname
, params
);
5134 static GLenum
exec_GetError( void )
5136 GET_CURRENT_CONTEXT(ctx
);
5137 FLUSH_VERTICES(ctx
, 0);
5138 return ctx
->Exec
->GetError( );
5141 static void exec_GetFloatv( GLenum pname
, GLfloat
*params
)
5143 GET_CURRENT_CONTEXT(ctx
);
5144 FLUSH_VERTICES(ctx
, 0);
5145 ctx
->Exec
->GetFloatv( pname
, params
);
5148 static void exec_GetIntegerv( GLenum pname
, GLint
*params
)
5150 GET_CURRENT_CONTEXT(ctx
);
5151 FLUSH_VERTICES(ctx
, 0);
5152 ctx
->Exec
->GetIntegerv( pname
, params
);
5155 static void exec_GetLightfv( GLenum light
, GLenum pname
, GLfloat
*params
)
5157 GET_CURRENT_CONTEXT(ctx
);
5158 FLUSH_VERTICES(ctx
, 0);
5159 ctx
->Exec
->GetLightfv( light
, pname
, params
);
5162 static void exec_GetLightiv( GLenum light
, GLenum pname
, GLint
*params
)
5164 GET_CURRENT_CONTEXT(ctx
);
5165 FLUSH_VERTICES(ctx
, 0);
5166 ctx
->Exec
->GetLightiv( light
, pname
, params
);
5169 static void exec_GetMapdv( GLenum target
, GLenum query
, GLdouble
*v
)
5171 GET_CURRENT_CONTEXT(ctx
);
5172 FLUSH_VERTICES(ctx
, 0);
5173 ctx
->Exec
->GetMapdv( target
, query
, v
);
5176 static void exec_GetMapfv( GLenum target
, GLenum query
, GLfloat
*v
)
5178 GET_CURRENT_CONTEXT(ctx
);
5179 FLUSH_VERTICES(ctx
, 0);
5180 ctx
->Exec
->GetMapfv( target
, query
, v
);
5183 static void exec_GetMapiv( GLenum target
, GLenum query
, GLint
*v
)
5185 GET_CURRENT_CONTEXT(ctx
);
5186 FLUSH_VERTICES(ctx
, 0);
5187 ctx
->Exec
->GetMapiv( target
, query
, v
);
5190 static void exec_GetMaterialfv( GLenum face
, GLenum pname
, GLfloat
*params
)
5192 GET_CURRENT_CONTEXT(ctx
);
5193 FLUSH_VERTICES(ctx
, 0);
5194 ctx
->Exec
->GetMaterialfv( face
, pname
, params
);
5197 static void exec_GetMaterialiv( GLenum face
, GLenum pname
, GLint
*params
)
5199 GET_CURRENT_CONTEXT(ctx
);
5200 FLUSH_VERTICES(ctx
, 0);
5201 ctx
->Exec
->GetMaterialiv( face
, pname
, params
);
5204 static void exec_GetPixelMapfv( GLenum map
, GLfloat
*values
)
5206 GET_CURRENT_CONTEXT(ctx
);
5207 FLUSH_VERTICES(ctx
, 0);
5208 ctx
->Exec
->GetPixelMapfv( map
, values
);
5211 static void exec_GetPixelMapuiv( GLenum map
, GLuint
*values
)
5213 GET_CURRENT_CONTEXT(ctx
);
5214 FLUSH_VERTICES(ctx
, 0);
5215 ctx
->Exec
->GetPixelMapuiv( map
, values
);
5218 static void exec_GetPixelMapusv( GLenum map
, GLushort
*values
)
5220 GET_CURRENT_CONTEXT(ctx
);
5221 FLUSH_VERTICES(ctx
, 0);
5222 ctx
->Exec
->GetPixelMapusv( map
, values
);
5225 static void exec_GetPolygonStipple( GLubyte
*dest
)
5227 GET_CURRENT_CONTEXT(ctx
);
5228 FLUSH_VERTICES(ctx
, 0);
5229 ctx
->Exec
->GetPolygonStipple( dest
);
5232 static const GLubyte
*exec_GetString( GLenum name
)
5234 GET_CURRENT_CONTEXT(ctx
);
5235 FLUSH_VERTICES(ctx
, 0);
5236 return ctx
->Exec
->GetString( name
);
5239 static void exec_GetTexEnvfv( GLenum target
, GLenum pname
, GLfloat
*params
)
5241 GET_CURRENT_CONTEXT(ctx
);
5242 FLUSH_VERTICES(ctx
, 0);
5243 ctx
->Exec
->GetTexEnvfv( target
, pname
, params
);
5246 static void exec_GetTexEnviv( GLenum target
, GLenum pname
, GLint
*params
)
5248 GET_CURRENT_CONTEXT(ctx
);
5249 FLUSH_VERTICES(ctx
, 0);
5250 ctx
->Exec
->GetTexEnviv( target
, pname
, params
);
5253 static void exec_GetTexGendv( GLenum coord
, GLenum pname
, GLdouble
*params
)
5255 GET_CURRENT_CONTEXT(ctx
);
5256 FLUSH_VERTICES(ctx
, 0);
5257 ctx
->Exec
->GetTexGendv( coord
, pname
, params
);
5260 static void exec_GetTexGenfv( GLenum coord
, GLenum pname
, GLfloat
*params
)
5262 GET_CURRENT_CONTEXT(ctx
);
5263 FLUSH_VERTICES(ctx
, 0);
5264 ctx
->Exec
->GetTexGenfv( coord
, pname
, params
);
5267 static void exec_GetTexGeniv( GLenum coord
, GLenum pname
, GLint
*params
)
5269 GET_CURRENT_CONTEXT(ctx
);
5270 FLUSH_VERTICES(ctx
, 0);
5271 ctx
->Exec
->GetTexGeniv( coord
, pname
, params
);
5274 static void exec_GetTexImage( GLenum target
, GLint level
, GLenum format
,
5275 GLenum type
, GLvoid
*pixels
)
5277 GET_CURRENT_CONTEXT(ctx
);
5278 FLUSH_VERTICES(ctx
, 0);
5279 ctx
->Exec
->GetTexImage( target
, level
, format
, type
, pixels
);
5282 static void exec_GetTexLevelParameterfv( GLenum target
, GLint level
,
5283 GLenum pname
, GLfloat
*params
)
5285 GET_CURRENT_CONTEXT(ctx
);
5286 FLUSH_VERTICES(ctx
, 0);
5287 ctx
->Exec
->GetTexLevelParameterfv( target
, level
, pname
, params
);
5290 static void exec_GetTexLevelParameteriv( GLenum target
, GLint level
,
5291 GLenum pname
, GLint
*params
)
5293 GET_CURRENT_CONTEXT(ctx
);
5294 FLUSH_VERTICES(ctx
, 0);
5295 ctx
->Exec
->GetTexLevelParameteriv( target
, level
, pname
, params
);
5298 static void exec_GetTexParameterfv( GLenum target
, GLenum pname
,
5301 GET_CURRENT_CONTEXT(ctx
);
5302 FLUSH_VERTICES(ctx
, 0);
5303 ctx
->Exec
->GetTexParameterfv( target
, pname
, params
);
5306 static void exec_GetTexParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
5308 GET_CURRENT_CONTEXT(ctx
);
5309 FLUSH_VERTICES(ctx
, 0);
5310 ctx
->Exec
->GetTexParameteriv( target
, pname
, params
);
5313 static GLboolean
exec_IsEnabled( GLenum cap
)
5315 GET_CURRENT_CONTEXT(ctx
);
5316 FLUSH_VERTICES(ctx
, 0);
5317 return ctx
->Exec
->IsEnabled( cap
);
5320 static void exec_PixelStoref( GLenum pname
, GLfloat param
)
5322 GET_CURRENT_CONTEXT(ctx
);
5323 FLUSH_VERTICES(ctx
, 0);
5324 ctx
->Exec
->PixelStoref( pname
, param
);
5327 static void exec_PixelStorei( GLenum pname
, GLint param
)
5329 GET_CURRENT_CONTEXT(ctx
);
5330 FLUSH_VERTICES(ctx
, 0);
5331 ctx
->Exec
->PixelStorei( pname
, param
);
5334 static void exec_ReadPixels( GLint x
, GLint y
, GLsizei width
, GLsizei height
,
5335 GLenum format
, GLenum type
, GLvoid
*pixels
)
5337 GET_CURRENT_CONTEXT(ctx
);
5338 FLUSH_VERTICES(ctx
, 0);
5339 ctx
->Exec
->ReadPixels( x
, y
, width
, height
, format
, type
, pixels
);
5342 static GLint
exec_RenderMode( GLenum mode
)
5344 GET_CURRENT_CONTEXT(ctx
);
5345 FLUSH_VERTICES(ctx
, 0);
5346 return ctx
->Exec
->RenderMode( mode
);
5349 static void exec_FeedbackBuffer( GLsizei size
, GLenum type
, GLfloat
*buffer
)
5351 GET_CURRENT_CONTEXT(ctx
);
5352 FLUSH_VERTICES(ctx
, 0);
5353 ctx
->Exec
->FeedbackBuffer( size
, type
, buffer
);
5356 static void exec_SelectBuffer( GLsizei size
, GLuint
*buffer
)
5358 GET_CURRENT_CONTEXT(ctx
);
5359 FLUSH_VERTICES(ctx
, 0);
5360 ctx
->Exec
->SelectBuffer( size
, buffer
);
5363 static GLboolean
exec_AreTexturesResident(GLsizei n
, const GLuint
*texName
,
5364 GLboolean
*residences
)
5366 GET_CURRENT_CONTEXT(ctx
);
5367 FLUSH_VERTICES(ctx
, 0);
5368 return ctx
->Exec
->AreTexturesResident( n
, texName
, residences
);
5371 static void exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
,
5374 GET_CURRENT_CONTEXT(ctx
);
5375 FLUSH_VERTICES(ctx
, 0);
5376 ctx
->Exec
->ColorPointer( size
, type
, stride
, ptr
);
5379 static void exec_DeleteTextures( GLsizei n
, const GLuint
*texName
)
5381 GET_CURRENT_CONTEXT(ctx
);
5382 FLUSH_VERTICES(ctx
, 0);
5383 ctx
->Exec
->DeleteTextures( n
, texName
);
5386 static void exec_DisableClientState( GLenum cap
)
5388 GET_CURRENT_CONTEXT(ctx
);
5389 FLUSH_VERTICES(ctx
, 0);
5390 ctx
->Exec
->DisableClientState( cap
);
5393 static void exec_EdgeFlagPointer(GLsizei stride
, const void *vptr
)
5395 GET_CURRENT_CONTEXT(ctx
);
5396 FLUSH_VERTICES(ctx
, 0);
5397 ctx
->Exec
->EdgeFlagPointer( stride
, vptr
);
5400 static void exec_EnableClientState( GLenum cap
)
5402 GET_CURRENT_CONTEXT(ctx
);
5403 FLUSH_VERTICES(ctx
, 0);
5404 ctx
->Exec
->EnableClientState( cap
);
5407 static void exec_GenTextures( GLsizei n
, GLuint
*texName
)
5409 GET_CURRENT_CONTEXT(ctx
);
5410 FLUSH_VERTICES(ctx
, 0);
5411 ctx
->Exec
->GenTextures( n
, texName
);
5414 static void exec_GetPointerv( GLenum pname
, GLvoid
**params
)
5416 GET_CURRENT_CONTEXT(ctx
);
5417 FLUSH_VERTICES(ctx
, 0);
5418 ctx
->Exec
->GetPointerv( pname
, params
);
5421 static void exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5423 GET_CURRENT_CONTEXT(ctx
);
5424 FLUSH_VERTICES(ctx
, 0);
5425 ctx
->Exec
->IndexPointer( type
, stride
, ptr
);
5428 static void exec_InterleavedArrays(GLenum format
, GLsizei stride
,
5429 const GLvoid
*pointer
)
5431 GET_CURRENT_CONTEXT(ctx
);
5432 FLUSH_VERTICES(ctx
, 0);
5433 ctx
->Exec
->InterleavedArrays( format
, stride
, pointer
);
5436 static GLboolean
exec_IsTexture( GLuint texture
)
5438 GET_CURRENT_CONTEXT(ctx
);
5439 FLUSH_VERTICES(ctx
, 0);
5440 return ctx
->Exec
->IsTexture( texture
);
5443 static void exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5445 GET_CURRENT_CONTEXT(ctx
);
5446 FLUSH_VERTICES(ctx
, 0);
5447 ctx
->Exec
->NormalPointer( type
, stride
, ptr
);
5450 static void exec_PopClientAttrib(void)
5452 GET_CURRENT_CONTEXT(ctx
);
5453 FLUSH_VERTICES(ctx
, 0);
5454 ctx
->Exec
->PopClientAttrib();
5457 static void exec_PushClientAttrib(GLbitfield mask
)
5459 GET_CURRENT_CONTEXT(ctx
);
5460 FLUSH_VERTICES(ctx
, 0);
5461 ctx
->Exec
->PushClientAttrib( mask
);
5464 static void exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
5467 GET_CURRENT_CONTEXT(ctx
);
5468 FLUSH_VERTICES(ctx
, 0);
5469 ctx
->Exec
->TexCoordPointer( size
, type
, stride
, ptr
);
5472 static void exec_GetCompressedTexImageARB(GLenum target
, GLint level
,
5475 GET_CURRENT_CONTEXT(ctx
);
5476 FLUSH_VERTICES(ctx
, 0);
5477 ctx
->Exec
->GetCompressedTexImageARB( target
, level
, img
);
5480 static void exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
5483 GET_CURRENT_CONTEXT(ctx
);
5484 FLUSH_VERTICES(ctx
, 0);
5485 ctx
->Exec
->VertexPointer( size
, type
, stride
, ptr
);
5488 static void exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
5489 GLint x
, GLint y
, GLsizei width
)
5491 GET_CURRENT_CONTEXT(ctx
);
5492 FLUSH_VERTICES(ctx
, 0);
5493 ctx
->Exec
->CopyConvolutionFilter1D( target
, internalFormat
, x
, y
, width
);
5496 static void exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
5497 GLint x
, GLint y
, GLsizei width
,
5500 GET_CURRENT_CONTEXT(ctx
);
5501 FLUSH_VERTICES(ctx
, 0);
5502 ctx
->Exec
->CopyConvolutionFilter2D( target
, internalFormat
, x
, y
, width
,
5506 static void exec_GetColorTable( GLenum target
, GLenum format
,
5507 GLenum type
, GLvoid
*data
)
5509 GET_CURRENT_CONTEXT(ctx
);
5510 FLUSH_VERTICES(ctx
, 0);
5511 ctx
->Exec
->GetColorTable( target
, format
, type
, data
);
5514 static void exec_GetColorTableParameterfv( GLenum target
, GLenum pname
,
5517 GET_CURRENT_CONTEXT(ctx
);
5518 FLUSH_VERTICES(ctx
, 0);
5519 ctx
->Exec
->GetColorTableParameterfv( target
, pname
, params
);
5522 static void exec_GetColorTableParameteriv( GLenum target
, GLenum pname
,
5525 GET_CURRENT_CONTEXT(ctx
);
5526 FLUSH_VERTICES(ctx
, 0);
5527 ctx
->Exec
->GetColorTableParameteriv( target
, pname
, params
);
5530 static void exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
5533 GET_CURRENT_CONTEXT(ctx
);
5534 FLUSH_VERTICES(ctx
, 0);
5535 ctx
->Exec
->GetConvolutionFilter( target
, format
, type
, image
);
5538 static void exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
,
5541 GET_CURRENT_CONTEXT(ctx
);
5542 FLUSH_VERTICES(ctx
, 0);
5543 ctx
->Exec
->GetConvolutionParameterfv( target
, pname
, params
);
5546 static void exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
,
5549 GET_CURRENT_CONTEXT(ctx
);
5550 FLUSH_VERTICES(ctx
, 0);
5551 ctx
->Exec
->GetConvolutionParameteriv( target
, pname
, params
);
5554 static void exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
5555 GLenum type
, GLvoid
*values
)
5557 GET_CURRENT_CONTEXT(ctx
);
5558 FLUSH_VERTICES(ctx
, 0);
5559 ctx
->Exec
->GetHistogram( target
, reset
, format
, type
, values
);
5562 static void exec_GetHistogramParameterfv(GLenum target
, GLenum pname
,
5565 GET_CURRENT_CONTEXT(ctx
);
5566 FLUSH_VERTICES(ctx
, 0);
5567 ctx
->Exec
->GetHistogramParameterfv( target
, pname
, params
);
5570 static void exec_GetHistogramParameteriv(GLenum target
, GLenum pname
,
5573 GET_CURRENT_CONTEXT(ctx
);
5574 FLUSH_VERTICES(ctx
, 0);
5575 ctx
->Exec
->GetHistogramParameteriv( target
, pname
, params
);
5578 static void exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
5579 GLenum type
, GLvoid
*values
)
5581 GET_CURRENT_CONTEXT(ctx
);
5582 FLUSH_VERTICES(ctx
, 0);
5583 ctx
->Exec
->GetMinmax( target
, reset
, format
, type
, values
);
5586 static void exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
,
5589 GET_CURRENT_CONTEXT(ctx
);
5590 FLUSH_VERTICES(ctx
, 0);
5591 ctx
->Exec
->GetMinmaxParameterfv( target
, pname
, params
);
5594 static void exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
,
5597 GET_CURRENT_CONTEXT(ctx
);
5598 FLUSH_VERTICES(ctx
, 0);
5599 ctx
->Exec
->GetMinmaxParameteriv( target
, pname
, params
);
5602 static void exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
5603 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
5605 GET_CURRENT_CONTEXT(ctx
);
5606 FLUSH_VERTICES(ctx
, 0);
5607 ctx
->Exec
->GetSeparableFilter( target
, format
, type
, row
, column
, span
);
5610 static void exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
5611 GLsizei width
, GLsizei height
, GLenum format
,
5612 GLenum type
, const GLvoid
*row
,
5613 const GLvoid
*column
)
5615 GET_CURRENT_CONTEXT(ctx
);
5616 FLUSH_VERTICES(ctx
, 0);
5617 ctx
->Exec
->SeparableFilter2D( target
, internalFormat
, width
, height
, format
,
5621 static void exec_GetPixelTexGenParameterivSGIS(GLenum target
, GLint
*value
)
5623 GET_CURRENT_CONTEXT(ctx
);
5624 FLUSH_VERTICES(ctx
, 0);
5625 ctx
->Exec
->GetPixelTexGenParameterivSGIS( target
, value
);
5628 static void exec_GetPixelTexGenParameterfvSGIS(GLenum target
, GLfloat
*value
)
5630 GET_CURRENT_CONTEXT(ctx
);
5631 FLUSH_VERTICES(ctx
, 0);
5632 ctx
->Exec
->GetPixelTexGenParameterfvSGIS( target
, value
);
5635 static void exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5636 GLsizei count
, const GLvoid
*ptr
)
5638 GET_CURRENT_CONTEXT(ctx
);
5639 FLUSH_VERTICES(ctx
, 0);
5640 ctx
->Exec
->ColorPointerEXT( size
, type
, stride
, count
, ptr
);
5643 static void exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
,
5644 const GLboolean
*ptr
)
5646 GET_CURRENT_CONTEXT(ctx
);
5647 FLUSH_VERTICES(ctx
, 0);
5648 ctx
->Exec
->EdgeFlagPointerEXT( stride
, count
, ptr
);
5651 static void exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
5654 GET_CURRENT_CONTEXT(ctx
);
5655 FLUSH_VERTICES(ctx
, 0);
5656 ctx
->Exec
->IndexPointerEXT( type
, stride
, count
, ptr
);
5659 static void exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
5662 GET_CURRENT_CONTEXT(ctx
);
5663 FLUSH_VERTICES(ctx
, 0);
5664 ctx
->Exec
->NormalPointerEXT( type
, stride
, count
, ptr
);
5667 static void exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5668 GLsizei count
, const GLvoid
*ptr
)
5670 GET_CURRENT_CONTEXT(ctx
);
5671 FLUSH_VERTICES(ctx
, 0);
5672 ctx
->Exec
->TexCoordPointerEXT( size
, type
, stride
, count
, ptr
);
5675 static void exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5676 GLsizei count
, const GLvoid
*ptr
)
5678 GET_CURRENT_CONTEXT(ctx
);
5679 FLUSH_VERTICES(ctx
, 0);
5680 ctx
->Exec
->VertexPointerEXT( size
, type
, stride
, count
, ptr
);
5683 static void exec_LockArraysEXT(GLint first
, GLsizei count
)
5685 GET_CURRENT_CONTEXT(ctx
);
5686 FLUSH_VERTICES(ctx
, 0);
5687 ctx
->Exec
->LockArraysEXT( first
, count
);
5690 static void exec_UnlockArraysEXT( void )
5692 GET_CURRENT_CONTEXT(ctx
);
5693 FLUSH_VERTICES(ctx
, 0);
5694 ctx
->Exec
->UnlockArraysEXT( );
5697 static void exec_ResizeBuffersMESA( void )
5699 GET_CURRENT_CONTEXT(ctx
);
5700 FLUSH_VERTICES(ctx
, 0);
5701 ctx
->Exec
->ResizeBuffersMESA( );
5705 static void exec_ClientActiveTextureARB( GLenum target
)
5707 GET_CURRENT_CONTEXT(ctx
);
5708 FLUSH_VERTICES(ctx
, 0);
5709 ctx
->Exec
->ClientActiveTextureARB(target
);
5712 static void exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
5713 GLsizei stride
, const GLvoid
*ptr
)
5715 GET_CURRENT_CONTEXT(ctx
);
5716 FLUSH_VERTICES(ctx
, 0);
5717 ctx
->Exec
->SecondaryColorPointerEXT( size
, type
, stride
, ptr
);
5720 static void exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
,
5723 GET_CURRENT_CONTEXT(ctx
);
5724 FLUSH_VERTICES(ctx
, 0);
5725 ctx
->Exec
->FogCoordPointerEXT( type
, stride
, ptr
);
5730 * Assign all the pointers in <table> to point to Mesa's display list
5731 * building functions.
5733 * This does not include any of the tnl functions - they are
5734 * initialized from _mesa_init_api_defaults and from the active vtxfmt
5738 _mesa_init_dlist_table( struct _glapi_table
*table
, GLuint tableSize
)
5740 _mesa_init_no_op_table(table
, tableSize
);
5742 _mesa_loopback_init_api_table( table
, GL_TRUE
);
5745 table
->Accum
= save_Accum
;
5746 table
->AlphaFunc
= save_AlphaFunc
;
5747 table
->Bitmap
= save_Bitmap
;
5748 table
->BlendFunc
= save_BlendFunc
;
5749 table
->CallList
= _mesa_save_CallList
;
5750 table
->CallLists
= _mesa_save_CallLists
;
5751 table
->Clear
= save_Clear
;
5752 table
->ClearAccum
= save_ClearAccum
;
5753 table
->ClearColor
= save_ClearColor
;
5754 table
->ClearDepth
= save_ClearDepth
;
5755 table
->ClearIndex
= save_ClearIndex
;
5756 table
->ClearStencil
= save_ClearStencil
;
5757 table
->ClipPlane
= save_ClipPlane
;
5758 table
->ColorMask
= save_ColorMask
;
5759 table
->ColorMaterial
= save_ColorMaterial
;
5760 table
->CopyPixels
= save_CopyPixels
;
5761 table
->CullFace
= save_CullFace
;
5762 table
->DeleteLists
= _mesa_DeleteLists
;
5763 table
->DepthFunc
= save_DepthFunc
;
5764 table
->DepthMask
= save_DepthMask
;
5765 table
->DepthRange
= save_DepthRange
;
5766 table
->Disable
= save_Disable
;
5767 table
->DrawBuffer
= save_DrawBuffer
;
5768 table
->DrawPixels
= save_DrawPixels
;
5769 table
->Enable
= save_Enable
;
5770 table
->EndList
= _mesa_EndList
;
5771 table
->EvalMesh1
= _mesa_save_EvalMesh1
;
5772 table
->EvalMesh2
= _mesa_save_EvalMesh2
;
5773 table
->Finish
= exec_Finish
;
5774 table
->Flush
= exec_Flush
;
5775 table
->Fogf
= save_Fogf
;
5776 table
->Fogfv
= save_Fogfv
;
5777 table
->Fogi
= save_Fogi
;
5778 table
->Fogiv
= save_Fogiv
;
5779 table
->FrontFace
= save_FrontFace
;
5780 table
->Frustum
= save_Frustum
;
5781 table
->GenLists
= _mesa_GenLists
;
5782 table
->GetBooleanv
= exec_GetBooleanv
;
5783 table
->GetClipPlane
= exec_GetClipPlane
;
5784 table
->GetDoublev
= exec_GetDoublev
;
5785 table
->GetError
= exec_GetError
;
5786 table
->GetFloatv
= exec_GetFloatv
;
5787 table
->GetIntegerv
= exec_GetIntegerv
;
5788 table
->GetLightfv
= exec_GetLightfv
;
5789 table
->GetLightiv
= exec_GetLightiv
;
5790 table
->GetMapdv
= exec_GetMapdv
;
5791 table
->GetMapfv
= exec_GetMapfv
;
5792 table
->GetMapiv
= exec_GetMapiv
;
5793 table
->GetMaterialfv
= exec_GetMaterialfv
;
5794 table
->GetMaterialiv
= exec_GetMaterialiv
;
5795 table
->GetPixelMapfv
= exec_GetPixelMapfv
;
5796 table
->GetPixelMapuiv
= exec_GetPixelMapuiv
;
5797 table
->GetPixelMapusv
= exec_GetPixelMapusv
;
5798 table
->GetPolygonStipple
= exec_GetPolygonStipple
;
5799 table
->GetString
= exec_GetString
;
5800 table
->GetTexEnvfv
= exec_GetTexEnvfv
;
5801 table
->GetTexEnviv
= exec_GetTexEnviv
;
5802 table
->GetTexGendv
= exec_GetTexGendv
;
5803 table
->GetTexGenfv
= exec_GetTexGenfv
;
5804 table
->GetTexGeniv
= exec_GetTexGeniv
;
5805 table
->GetTexImage
= exec_GetTexImage
;
5806 table
->GetTexLevelParameterfv
= exec_GetTexLevelParameterfv
;
5807 table
->GetTexLevelParameteriv
= exec_GetTexLevelParameteriv
;
5808 table
->GetTexParameterfv
= exec_GetTexParameterfv
;
5809 table
->GetTexParameteriv
= exec_GetTexParameteriv
;
5810 table
->Hint
= save_Hint
;
5811 table
->IndexMask
= save_IndexMask
;
5812 table
->InitNames
= save_InitNames
;
5813 table
->IsEnabled
= exec_IsEnabled
;
5814 table
->IsList
= _mesa_IsList
;
5815 table
->LightModelf
= save_LightModelf
;
5816 table
->LightModelfv
= save_LightModelfv
;
5817 table
->LightModeli
= save_LightModeli
;
5818 table
->LightModeliv
= save_LightModeliv
;
5819 table
->Lightf
= save_Lightf
;
5820 table
->Lightfv
= save_Lightfv
;
5821 table
->Lighti
= save_Lighti
;
5822 table
->Lightiv
= save_Lightiv
;
5823 table
->LineStipple
= save_LineStipple
;
5824 table
->LineWidth
= save_LineWidth
;
5825 table
->ListBase
= save_ListBase
;
5826 table
->LoadIdentity
= save_LoadIdentity
;
5827 table
->LoadMatrixd
= save_LoadMatrixd
;
5828 table
->LoadMatrixf
= save_LoadMatrixf
;
5829 table
->LoadName
= save_LoadName
;
5830 table
->LogicOp
= save_LogicOp
;
5831 table
->Map1d
= save_Map1d
;
5832 table
->Map1f
= save_Map1f
;
5833 table
->Map2d
= save_Map2d
;
5834 table
->Map2f
= save_Map2f
;
5835 table
->MapGrid1d
= save_MapGrid1d
;
5836 table
->MapGrid1f
= save_MapGrid1f
;
5837 table
->MapGrid2d
= save_MapGrid2d
;
5838 table
->MapGrid2f
= save_MapGrid2f
;
5839 table
->MatrixMode
= save_MatrixMode
;
5840 table
->MultMatrixd
= save_MultMatrixd
;
5841 table
->MultMatrixf
= save_MultMatrixf
;
5842 table
->NewList
= save_NewList
;
5843 table
->Ortho
= save_Ortho
;
5844 table
->PassThrough
= save_PassThrough
;
5845 table
->PixelMapfv
= save_PixelMapfv
;
5846 table
->PixelMapuiv
= save_PixelMapuiv
;
5847 table
->PixelMapusv
= save_PixelMapusv
;
5848 table
->PixelStoref
= exec_PixelStoref
;
5849 table
->PixelStorei
= exec_PixelStorei
;
5850 table
->PixelTransferf
= save_PixelTransferf
;
5851 table
->PixelTransferi
= save_PixelTransferi
;
5852 table
->PixelZoom
= save_PixelZoom
;
5853 table
->PointSize
= save_PointSize
;
5854 table
->PolygonMode
= save_PolygonMode
;
5855 table
->PolygonOffset
= save_PolygonOffset
;
5856 table
->PolygonStipple
= save_PolygonStipple
;
5857 table
->PopAttrib
= save_PopAttrib
;
5858 table
->PopMatrix
= save_PopMatrix
;
5859 table
->PopName
= save_PopName
;
5860 table
->PushAttrib
= save_PushAttrib
;
5861 table
->PushMatrix
= save_PushMatrix
;
5862 table
->PushName
= save_PushName
;
5863 table
->RasterPos2d
= save_RasterPos2d
;
5864 table
->RasterPos2dv
= save_RasterPos2dv
;
5865 table
->RasterPos2f
= save_RasterPos2f
;
5866 table
->RasterPos2fv
= save_RasterPos2fv
;
5867 table
->RasterPos2i
= save_RasterPos2i
;
5868 table
->RasterPos2iv
= save_RasterPos2iv
;
5869 table
->RasterPos2s
= save_RasterPos2s
;
5870 table
->RasterPos2sv
= save_RasterPos2sv
;
5871 table
->RasterPos3d
= save_RasterPos3d
;
5872 table
->RasterPos3dv
= save_RasterPos3dv
;
5873 table
->RasterPos3f
= save_RasterPos3f
;
5874 table
->RasterPos3fv
= save_RasterPos3fv
;
5875 table
->RasterPos3i
= save_RasterPos3i
;
5876 table
->RasterPos3iv
= save_RasterPos3iv
;
5877 table
->RasterPos3s
= save_RasterPos3s
;
5878 table
->RasterPos3sv
= save_RasterPos3sv
;
5879 table
->RasterPos4d
= save_RasterPos4d
;
5880 table
->RasterPos4dv
= save_RasterPos4dv
;
5881 table
->RasterPos4f
= save_RasterPos4f
;
5882 table
->RasterPos4fv
= save_RasterPos4fv
;
5883 table
->RasterPos4i
= save_RasterPos4i
;
5884 table
->RasterPos4iv
= save_RasterPos4iv
;
5885 table
->RasterPos4s
= save_RasterPos4s
;
5886 table
->RasterPos4sv
= save_RasterPos4sv
;
5887 table
->ReadBuffer
= save_ReadBuffer
;
5888 table
->ReadPixels
= exec_ReadPixels
;
5889 table
->RenderMode
= exec_RenderMode
;
5890 table
->Rotated
= save_Rotated
;
5891 table
->Rotatef
= save_Rotatef
;
5892 table
->Scaled
= save_Scaled
;
5893 table
->Scalef
= save_Scalef
;
5894 table
->Scissor
= save_Scissor
;
5895 table
->FeedbackBuffer
= exec_FeedbackBuffer
;
5896 table
->SelectBuffer
= exec_SelectBuffer
;
5897 table
->ShadeModel
= save_ShadeModel
;
5898 table
->StencilFunc
= save_StencilFunc
;
5899 table
->StencilMask
= save_StencilMask
;
5900 table
->StencilOp
= save_StencilOp
;
5901 table
->TexEnvf
= save_TexEnvf
;
5902 table
->TexEnvfv
= save_TexEnvfv
;
5903 table
->TexEnvi
= save_TexEnvi
;
5904 table
->TexEnviv
= save_TexEnviv
;
5905 table
->TexGend
= save_TexGend
;
5906 table
->TexGendv
= save_TexGendv
;
5907 table
->TexGenf
= save_TexGenf
;
5908 table
->TexGenfv
= save_TexGenfv
;
5909 table
->TexGeni
= save_TexGeni
;
5910 table
->TexGeniv
= save_TexGeniv
;
5911 table
->TexImage1D
= save_TexImage1D
;
5912 table
->TexImage2D
= save_TexImage2D
;
5913 table
->TexParameterf
= save_TexParameterf
;
5914 table
->TexParameterfv
= save_TexParameterfv
;
5915 table
->TexParameteri
= save_TexParameteri
;
5916 table
->TexParameteriv
= save_TexParameteriv
;
5917 table
->Translated
= save_Translated
;
5918 table
->Translatef
= save_Translatef
;
5919 table
->Viewport
= save_Viewport
;
5922 table
->AreTexturesResident
= exec_AreTexturesResident
;
5923 table
->BindTexture
= save_BindTexture
;
5924 table
->ColorPointer
= exec_ColorPointer
;
5925 table
->CopyTexImage1D
= save_CopyTexImage1D
;
5926 table
->CopyTexImage2D
= save_CopyTexImage2D
;
5927 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
5928 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
5929 table
->DeleteTextures
= exec_DeleteTextures
;
5930 table
->DisableClientState
= exec_DisableClientState
;
5931 table
->EdgeFlagPointer
= exec_EdgeFlagPointer
;
5932 table
->EnableClientState
= exec_EnableClientState
;
5933 table
->GenTextures
= exec_GenTextures
;
5934 table
->GetPointerv
= exec_GetPointerv
;
5935 table
->IndexPointer
= exec_IndexPointer
;
5936 table
->InterleavedArrays
= exec_InterleavedArrays
;
5937 table
->IsTexture
= exec_IsTexture
;
5938 table
->NormalPointer
= exec_NormalPointer
;
5939 table
->PopClientAttrib
= exec_PopClientAttrib
;
5940 table
->PrioritizeTextures
= save_PrioritizeTextures
;
5941 table
->PushClientAttrib
= exec_PushClientAttrib
;
5942 table
->TexCoordPointer
= exec_TexCoordPointer
;
5943 table
->TexSubImage1D
= save_TexSubImage1D
;
5944 table
->TexSubImage2D
= save_TexSubImage2D
;
5945 table
->VertexPointer
= exec_VertexPointer
;
5948 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
5949 table
->TexImage3D
= save_TexImage3D
;
5950 table
->TexSubImage3D
= save_TexSubImage3D
;
5952 /* GL_ARB_imaging */
5953 /* Not all are supported */
5954 table
->BlendColor
= save_BlendColor
;
5955 table
->BlendEquation
= save_BlendEquation
;
5956 table
->ColorSubTable
= save_ColorSubTable
;
5957 table
->ColorTable
= save_ColorTable
;
5958 table
->ColorTableParameterfv
= save_ColorTableParameterfv
;
5959 table
->ColorTableParameteriv
= save_ColorTableParameteriv
;
5960 table
->ConvolutionFilter1D
= save_ConvolutionFilter1D
;
5961 table
->ConvolutionFilter2D
= save_ConvolutionFilter2D
;
5962 table
->ConvolutionParameterf
= save_ConvolutionParameterf
;
5963 table
->ConvolutionParameterfv
= save_ConvolutionParameterfv
;
5964 table
->ConvolutionParameteri
= save_ConvolutionParameteri
;
5965 table
->ConvolutionParameteriv
= save_ConvolutionParameteriv
;
5966 table
->CopyColorSubTable
= save_CopyColorSubTable
;
5967 table
->CopyColorTable
= save_CopyColorTable
;
5968 table
->CopyConvolutionFilter1D
= exec_CopyConvolutionFilter1D
;
5969 table
->CopyConvolutionFilter2D
= exec_CopyConvolutionFilter2D
;
5970 table
->GetColorTable
= exec_GetColorTable
;
5971 table
->GetColorTableParameterfv
= exec_GetColorTableParameterfv
;
5972 table
->GetColorTableParameteriv
= exec_GetColorTableParameteriv
;
5973 table
->GetConvolutionFilter
= exec_GetConvolutionFilter
;
5974 table
->GetConvolutionParameterfv
= exec_GetConvolutionParameterfv
;
5975 table
->GetConvolutionParameteriv
= exec_GetConvolutionParameteriv
;
5976 table
->GetHistogram
= exec_GetHistogram
;
5977 table
->GetHistogramParameterfv
= exec_GetHistogramParameterfv
;
5978 table
->GetHistogramParameteriv
= exec_GetHistogramParameteriv
;
5979 table
->GetMinmax
= exec_GetMinmax
;
5980 table
->GetMinmaxParameterfv
= exec_GetMinmaxParameterfv
;
5981 table
->GetMinmaxParameteriv
= exec_GetMinmaxParameteriv
;
5982 table
->GetSeparableFilter
= exec_GetSeparableFilter
;
5983 table
->Histogram
= save_Histogram
;
5984 table
->Minmax
= save_Minmax
;
5985 table
->ResetHistogram
= save_ResetHistogram
;
5986 table
->ResetMinmax
= save_ResetMinmax
;
5987 table
->SeparableFilter2D
= exec_SeparableFilter2D
;
5989 /* 2. GL_EXT_blend_color */
5991 table
->BlendColorEXT
= save_BlendColorEXT
;
5994 /* 3. GL_EXT_polygon_offset */
5995 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
5997 /* 6. GL_EXT_texture3d */
5999 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
6000 table
->TexImage3DEXT
= save_TexImage3DEXT
;
6001 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
6004 /* 15. GL_SGIX_pixel_texture */
6005 table
->PixelTexGenSGIX
= save_PixelTexGenSGIX
;
6007 /* 15. GL_SGIS_pixel_texture */
6008 table
->PixelTexGenParameteriSGIS
= save_PixelTexGenParameteriSGIS
;
6009 table
->PixelTexGenParameterfSGIS
= save_PixelTexGenParameterfSGIS
;
6010 table
->PixelTexGenParameterivSGIS
= save_PixelTexGenParameterivSGIS
;
6011 table
->PixelTexGenParameterfvSGIS
= save_PixelTexGenParameterfvSGIS
;
6012 table
->GetPixelTexGenParameterivSGIS
= exec_GetPixelTexGenParameterivSGIS
;
6013 table
->GetPixelTexGenParameterfvSGIS
= exec_GetPixelTexGenParameterfvSGIS
;
6015 /* 30. GL_EXT_vertex_array */
6016 table
->ColorPointerEXT
= exec_ColorPointerEXT
;
6017 table
->EdgeFlagPointerEXT
= exec_EdgeFlagPointerEXT
;
6018 table
->IndexPointerEXT
= exec_IndexPointerEXT
;
6019 table
->NormalPointerEXT
= exec_NormalPointerEXT
;
6020 table
->TexCoordPointerEXT
= exec_TexCoordPointerEXT
;
6021 table
->VertexPointerEXT
= exec_VertexPointerEXT
;
6023 /* 37. GL_EXT_blend_minmax */
6025 table
->BlendEquationEXT
= save_BlendEquationEXT
;
6028 /* 54. GL_EXT_point_parameters */
6029 table
->PointParameterfEXT
= save_PointParameterfEXT
;
6030 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
6032 /* 78. GL_EXT_paletted_texture */
6034 table
->ColorTableEXT
= save_ColorTable
;
6035 table
->ColorSubTableEXT
= save_ColorSubTable
;
6037 table
->GetColorTableEXT
= exec_GetColorTable
;
6038 table
->GetColorTableParameterfvEXT
= exec_GetColorTableParameterfv
;
6039 table
->GetColorTableParameterivEXT
= exec_GetColorTableParameteriv
;
6041 /* 97. GL_EXT_compiled_vertex_array */
6042 table
->LockArraysEXT
= exec_LockArraysEXT
;
6043 table
->UnlockArraysEXT
= exec_UnlockArraysEXT
;
6045 /* 145. GL_EXT_secondary_color */
6046 table
->SecondaryColorPointerEXT
= exec_SecondaryColorPointerEXT
;
6048 /* 149. GL_EXT_fog_coord */
6049 table
->FogCoordPointerEXT
= exec_FogCoordPointerEXT
;
6051 /* 173. GL_EXT_blend_func_separate */
6052 table
->BlendFuncSeparateEXT
= save_BlendFuncSeparateEXT
;
6054 /* 196. GL_MESA_resize_buffers */
6055 table
->ResizeBuffersMESA
= exec_ResizeBuffersMESA
;
6057 /* 197. GL_MESA_window_pos */
6058 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
6059 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
6060 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
6061 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
6062 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
6063 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
6064 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
6065 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
6066 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
6067 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
6068 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
6069 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
6070 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
6071 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
6072 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
6073 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
6074 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
6075 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
6076 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
6077 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
6078 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
6079 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
6080 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
6081 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
6083 /* 233. GL_NV_vertex_program */
6084 /* XXX Need to implement vertex program in display lists !!! */
6085 /* The following commands DO NOT go into display lists:
6086 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
6087 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
6089 table
->BindProgramNV
= save_BindProgramNV
;
6090 table
->DeleteProgramsNV
= _mesa_DeleteProgramsNV
;
6091 table
->ExecuteProgramNV
= save_ExecuteProgramNV
;
6092 table
->GenProgramsNV
= _mesa_GenProgramsNV
;
6093 table
->AreProgramsResidentNV
= _mesa_AreProgramsResidentNV
;
6094 table
->RequestResidentProgramsNV
= _mesa_RequestResidentProgramsNV
;
6095 table
->GetProgramParameterfvNV
= _mesa_GetProgramParameterfvNV
;
6096 table
->GetProgramParameterdvNV
= _mesa_GetProgramParameterdvNV
;
6097 table
->GetProgramivNV
= _mesa_GetProgramivNV
;
6098 table
->GetProgramStringNV
= _mesa_GetProgramStringNV
;
6099 table
->GetTrackMatrixivNV
= _mesa_GetTrackMatrixivNV
;
6100 table
->GetVertexAttribdvNV
= _mesa_GetVertexAttribdvNV
;
6101 table
->GetVertexAttribfvNV
= _mesa_GetVertexAttribfvNV
;
6102 table
->GetVertexAttribivNV
= _mesa_GetVertexAttribivNV
;
6103 table
->GetVertexAttribPointervNV
= _mesa_GetVertexAttribPointervNV
;
6104 table
->IsProgramNV
= _mesa_IsProgramNV
;
6105 table
->LoadProgramNV
= _mesa_LoadProgramNV
;
6106 table
->ProgramParameter4dNV
= save_ProgramParameter4dNV
;
6107 table
->ProgramParameter4dvNV
= save_ProgramParameter4dvNV
;
6108 table
->ProgramParameter4fNV
= save_ProgramParameter4fNV
;
6109 table
->ProgramParameter4fvNV
= save_ProgramParameter4fvNV
;
6110 table
->ProgramParameters4dvNV
= _mesa_ProgramParameters4dvNV
;
6111 table
->ProgramParameters4fvNV
= _mesa_ProgramParameters4fvNV
;
6112 table
->TrackMatrixNV
= save_TrackMatrixNV
;
6113 table
->VertexAttribPointerNV
= _mesa_VertexAttribPointerNV
;
6115 /* 262. GL_NV_point_sprite */
6116 table
->PointParameteriNV
= save_PointParameteriNV
;
6117 table
->PointParameterivNV
= save_PointParameterivNV
;
6119 /* ARB 1. GL_ARB_multitexture */
6120 table
->ActiveTextureARB
= save_ActiveTextureARB
;
6121 table
->ClientActiveTextureARB
= exec_ClientActiveTextureARB
;
6123 /* ARB 3. GL_ARB_transpose_matrix */
6124 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
6125 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
6126 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
6127 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
6129 /* ARB 5. GL_ARB_multisample */
6130 table
->SampleCoverageARB
= save_SampleCoverageARB
;
6132 /* ARB 12. GL_ARB_texture_compression */
6133 table
->CompressedTexImage3DARB
= save_CompressedTexImage3DARB
;
6134 table
->CompressedTexImage2DARB
= save_CompressedTexImage2DARB
;
6135 table
->CompressedTexImage1DARB
= save_CompressedTexImage1DARB
;
6136 table
->CompressedTexSubImage3DARB
= save_CompressedTexSubImage3DARB
;
6137 table
->CompressedTexSubImage2DARB
= save_CompressedTexSubImage2DARB
;
6138 table
->CompressedTexSubImage1DARB
= save_CompressedTexSubImage1DARB
;
6139 table
->GetCompressedTexImageARB
= exec_GetCompressedTexImageARB
;
6141 /* ARB 14. GL_ARB_point_parameters */
6142 /* re-use EXT_point_parameters functions */
6144 /* ARB 25. GL_ARB_window_pos */
6145 /* re-use MESA_window_pos functions */
6153 static const char *enum_string( GLenum k
)
6155 return _mesa_lookup_enum_by_nr( k
);
6160 * Print the commands in a display list. For debugging only.
6161 * TODO: many commands aren't handled yet.
6163 static void print_list( GLcontext
*ctx
, GLuint list
)
6168 if (!glIsList(list
)) {
6169 _mesa_printf(ctx
, "%u is not a display list ID\n", list
);
6173 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
6175 _mesa_printf(ctx
, "START-LIST %u, address %p\n", list
, (void*)n
);
6177 done
= n
? GL_FALSE
: GL_TRUE
;
6179 OpCode opcode
= n
[0].opcode
;
6180 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_DRV_0
;
6182 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
6183 ctx
->listext
.opcode
[i
].print(ctx
, &n
[1]);
6184 n
+= ctx
->listext
.opcode
[i
].size
;
6189 _mesa_printf(ctx
, "accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
6192 _mesa_printf(ctx
, "Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
6193 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
6195 case OPCODE_CALL_LIST
:
6196 _mesa_printf(ctx
, "CallList %d\n", (int) n
[1].ui
);
6198 case OPCODE_CALL_LIST_OFFSET
:
6199 _mesa_printf(ctx
, "CallList %d + offset %u = %u\n", (int) n
[1].ui
,
6200 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
6202 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
6203 _mesa_printf(ctx
, "ColorTableParameterfv %s %s %f %f %f %f\n",
6204 enum_string(n
[1].e
), enum_string(n
[2].e
),
6205 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6207 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
6208 _mesa_printf(ctx
, "ColorTableParameteriv %s %s %d %d %d %d\n",
6209 enum_string(n
[1].e
), enum_string(n
[2].e
),
6210 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
6212 case OPCODE_DISABLE
:
6213 _mesa_printf(ctx
, "Disable %s\n", enum_string(n
[1].e
));
6216 _mesa_printf(ctx
, "Enable %s\n", enum_string(n
[1].e
));
6218 case OPCODE_FRUSTUM
:
6219 _mesa_printf(ctx
, "Frustum %g %g %g %g %g %g\n",
6220 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6222 case OPCODE_LINE_STIPPLE
:
6223 _mesa_printf(ctx
, "LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
6225 case OPCODE_LOAD_IDENTITY
:
6226 _mesa_printf(ctx
, "LoadIdentity\n");
6228 case OPCODE_LOAD_MATRIX
:
6229 _mesa_printf(ctx
, "LoadMatrix\n");
6230 _mesa_printf(ctx
, " %8f %8f %8f %8f\n",
6231 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
6232 _mesa_printf(ctx
, " %8f %8f %8f %8f\n",
6233 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
6234 _mesa_printf(ctx
, " %8f %8f %8f %8f\n",
6235 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
6236 _mesa_printf(ctx
, " %8f %8f %8f %8f\n",
6237 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
6239 case OPCODE_MULT_MATRIX
:
6240 _mesa_printf(ctx
, "MultMatrix (or Rotate)\n");
6241 _mesa_printf(ctx
, " %8f %8f %8f %8f\n",
6242 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
6243 _mesa_printf(ctx
, " %8f %8f %8f %8f\n",
6244 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
6245 _mesa_printf(ctx
, " %8f %8f %8f %8f\n",
6246 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
6247 _mesa_printf(ctx
, " %8f %8f %8f %8f\n",
6248 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
6251 _mesa_printf(ctx
, "Ortho %g %g %g %g %g %g\n",
6252 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6254 case OPCODE_POP_ATTRIB
:
6255 _mesa_printf(ctx
, "PopAttrib\n");
6257 case OPCODE_POP_MATRIX
:
6258 _mesa_printf(ctx
, "PopMatrix\n");
6260 case OPCODE_POP_NAME
:
6261 _mesa_printf(ctx
, "PopName\n");
6263 case OPCODE_PUSH_ATTRIB
:
6264 _mesa_printf(ctx
, "PushAttrib %x\n", n
[1].bf
);
6266 case OPCODE_PUSH_MATRIX
:
6267 _mesa_printf(ctx
, "PushMatrix\n");
6269 case OPCODE_PUSH_NAME
:
6270 _mesa_printf(ctx
, "PushName %d\n", (int) n
[1].ui
);
6272 case OPCODE_RASTER_POS
:
6273 _mesa_printf(ctx
, "RasterPos %g %g %g %g\n",
6274 n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
6277 _mesa_printf(ctx
, "Rotate %g %g %g %g\n",
6278 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6281 _mesa_printf(ctx
, "Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
6283 case OPCODE_TRANSLATE
:
6284 _mesa_printf(ctx
, "Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
6286 case OPCODE_BIND_TEXTURE
:
6287 _mesa_printf(ctx
, "BindTexture %s %d\n",
6288 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
6290 case OPCODE_SHADE_MODEL
:
6291 _mesa_printf(ctx
, "ShadeModel %s\n",
6292 _mesa_lookup_enum_by_nr(n
[1].ui
));
6295 _mesa_printf(ctx
, "Map1 %s %.3f %.3f %d %d\n",
6296 _mesa_lookup_enum_by_nr(n
[1].ui
),
6297 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
6300 _mesa_printf(ctx
, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
6301 _mesa_lookup_enum_by_nr(n
[1].ui
),
6302 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
6303 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
6305 case OPCODE_MAPGRID1
:
6306 _mesa_printf(ctx
, "MapGrid1 %d %.3f %.3f\n",
6307 n
[1].i
, n
[2].f
, n
[3].f
);
6309 case OPCODE_MAPGRID2
:
6310 _mesa_printf(ctx
, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
6311 n
[1].i
, n
[2].f
, n
[3].f
,
6312 n
[4].i
, n
[5].f
, n
[6].f
);
6314 case OPCODE_EVALMESH1
:
6315 _mesa_printf(ctx
, "EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
6317 case OPCODE_EVALMESH2
:
6318 _mesa_printf(ctx
, "EvalMesh2 %d %d %d %d\n",
6319 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
6323 * meta opcodes/commands
6326 _mesa_printf(ctx
, "Error: %s %s\n",
6327 enum_string(n
[1].e
), (const char *)n
[2].data
);
6329 case OPCODE_CONTINUE
:
6330 _mesa_printf(ctx
, "DISPLAY-LIST-CONTINUE\n");
6331 n
= (Node
*) n
[1].next
;
6333 case OPCODE_END_OF_LIST
:
6334 _mesa_printf(ctx
, "END-LIST %u\n", list
);
6338 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
6340 "ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
6345 _mesa_printf(ctx
, "command %d, %u operands\n",
6346 opcode
, InstSize
[opcode
]);
6349 /* increment n to point to next compiled command */
6350 if (opcode
!=OPCODE_CONTINUE
) {
6351 n
+= InstSize
[opcode
];
6360 * Clients may call this function to help debug display list problems.
6361 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
6362 * changed, or break in the future without notice.
6364 void mesa_print_display_list( GLuint list
)
6366 GET_CURRENT_CONTEXT(ctx
);
6367 print_list( ctx
, list
);