1 /* $Id: dlist.c,v 1.86 2002/04/09 16:56:50 keithw 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
);
2521 static void save_PointSize( GLfloat size
)
2523 GET_CURRENT_CONTEXT(ctx
);
2525 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2526 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_SIZE
, 1 );
2530 if (ctx
->ExecuteFlag
) {
2531 (*ctx
->Exec
->PointSize
)( size
);
2536 static void save_PolygonMode( GLenum face
, GLenum mode
)
2538 GET_CURRENT_CONTEXT(ctx
);
2540 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2541 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_MODE
, 2 );
2546 if (ctx
->ExecuteFlag
) {
2547 (*ctx
->Exec
->PolygonMode
)( face
, mode
);
2553 * Polygon stipple must have been upacked already!
2555 static void save_PolygonStipple( const GLubyte
*pattern
)
2557 GET_CURRENT_CONTEXT(ctx
);
2559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2560 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2563 n
[1].data
= MALLOC( 32 * 4 );
2564 data
= n
[1].data
; /* This needed for Acorn compiler */
2565 MEMCPY( data
, pattern
, 32 * 4 );
2567 if (ctx
->ExecuteFlag
) {
2568 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) pattern
);
2573 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2575 GET_CURRENT_CONTEXT(ctx
);
2577 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2578 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2583 if (ctx
->ExecuteFlag
) {
2584 (*ctx
->Exec
->PolygonOffset
)( factor
, units
);
2589 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2591 GET_CURRENT_CONTEXT(ctx
);
2592 save_PolygonOffset(factor
, ctx
->DepthMaxF
* bias
);
2596 static void save_PopAttrib( void )
2598 GET_CURRENT_CONTEXT(ctx
);
2599 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2600 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_ATTRIB
, 0 );
2601 if (ctx
->ExecuteFlag
) {
2602 (*ctx
->Exec
->PopAttrib
)();
2607 static void save_PopMatrix( void )
2609 GET_CURRENT_CONTEXT(ctx
);
2610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2611 FLUSH_CURRENT(ctx
, 0);
2612 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_MATRIX
, 0 );
2613 if (ctx
->ExecuteFlag
) {
2614 (*ctx
->Exec
->PopMatrix
)();
2619 static void save_PopName( void )
2621 GET_CURRENT_CONTEXT(ctx
);
2622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2623 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_NAME
, 0 );
2624 if (ctx
->ExecuteFlag
) {
2625 (*ctx
->Exec
->PopName
)();
2630 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2631 const GLclampf
*priorities
)
2633 GET_CURRENT_CONTEXT(ctx
);
2635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2637 for (i
=0;i
<num
;i
++) {
2639 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2641 n
[1].ui
= textures
[i
];
2642 n
[2].f
= priorities
[i
];
2645 if (ctx
->ExecuteFlag
) {
2646 (*ctx
->Exec
->PrioritizeTextures
)( num
, textures
, priorities
);
2651 static void save_PushAttrib( GLbitfield mask
)
2653 GET_CURRENT_CONTEXT(ctx
);
2655 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2656 FLUSH_CURRENT(ctx
, 0);
2657 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2661 if (ctx
->ExecuteFlag
) {
2662 (*ctx
->Exec
->PushAttrib
)( mask
);
2667 static void save_PushMatrix( void )
2669 GET_CURRENT_CONTEXT(ctx
);
2670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2671 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2672 if (ctx
->ExecuteFlag
) {
2673 (*ctx
->Exec
->PushMatrix
)();
2678 static void save_PushName( GLuint name
)
2680 GET_CURRENT_CONTEXT(ctx
);
2682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2683 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_NAME
, 1 );
2687 if (ctx
->ExecuteFlag
) {
2688 (*ctx
->Exec
->PushName
)( name
);
2693 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2695 GET_CURRENT_CONTEXT(ctx
);
2697 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2698 FLUSH_CURRENT(ctx
, 0);
2699 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RASTER_POS
, 4 );
2706 if (ctx
->ExecuteFlag
) {
2707 (*ctx
->Exec
->RasterPos4f
)( x
, y
, z
, w
);
2711 static void save_RasterPos2d(GLdouble x
, GLdouble y
)
2713 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2716 static void save_RasterPos2f(GLfloat x
, GLfloat y
)
2718 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2721 static void save_RasterPos2i(GLint x
, GLint y
)
2723 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2726 static void save_RasterPos2s(GLshort x
, GLshort y
)
2728 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2731 static void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2733 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2736 static void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2738 save_RasterPos4f(x
, y
, z
, 1.0F
);
2741 static void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2743 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2746 static void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2748 save_RasterPos4f(x
, y
, z
, 1.0F
);
2751 static void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2753 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2756 static void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2758 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2761 static void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2763 save_RasterPos4f(x
, y
, z
, w
);
2766 static void save_RasterPos2dv(const GLdouble
*v
)
2768 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2771 static void save_RasterPos2fv(const GLfloat
*v
)
2773 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2776 static void save_RasterPos2iv(const GLint
*v
)
2778 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2781 static void save_RasterPos2sv(const GLshort
*v
)
2783 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2786 static void save_RasterPos3dv(const GLdouble
*v
)
2788 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2791 static void save_RasterPos3fv(const GLfloat
*v
)
2793 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2796 static void save_RasterPos3iv(const GLint
*v
)
2798 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2801 static void save_RasterPos3sv(const GLshort
*v
)
2803 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2806 static void save_RasterPos4dv(const GLdouble
*v
)
2808 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
2809 (GLfloat
) v
[2], (GLfloat
) v
[3]);
2812 static void save_RasterPos4fv(const GLfloat
*v
)
2814 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2817 static void save_RasterPos4iv(const GLint
*v
)
2819 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
2820 (GLfloat
) v
[2], (GLfloat
) v
[3]);
2823 static void save_RasterPos4sv(const GLshort
*v
)
2825 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2829 static void save_PassThrough( GLfloat token
)
2831 GET_CURRENT_CONTEXT(ctx
);
2833 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2834 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PASSTHROUGH
, 1 );
2838 if (ctx
->ExecuteFlag
) {
2839 (*ctx
->Exec
->PassThrough
)( token
);
2844 static void save_ReadBuffer( GLenum mode
)
2846 GET_CURRENT_CONTEXT(ctx
);
2848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2849 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_READ_BUFFER
, 1 );
2853 if (ctx
->ExecuteFlag
) {
2854 (*ctx
->Exec
->ReadBuffer
)( mode
);
2860 save_ResetHistogram(GLenum target
)
2862 GET_CURRENT_CONTEXT(ctx
);
2864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2865 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_HISTOGRAM
, 1 );
2869 if (ctx
->ExecuteFlag
) {
2870 (*ctx
->Exec
->ResetHistogram
)( target
);
2876 save_ResetMinmax(GLenum target
)
2878 GET_CURRENT_CONTEXT(ctx
);
2880 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2881 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_MIN_MAX
, 1 );
2885 if (ctx
->ExecuteFlag
) {
2886 (*ctx
->Exec
->ResetMinmax
)( target
);
2891 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2893 GET_CURRENT_CONTEXT(ctx
);
2895 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2896 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ROTATE
, 4 );
2903 if (ctx
->ExecuteFlag
) {
2904 (*ctx
->Exec
->Rotatef
)( angle
, x
, y
, z
);
2909 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2911 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
2915 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2917 GET_CURRENT_CONTEXT(ctx
);
2919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2920 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCALE
, 3 );
2926 if (ctx
->ExecuteFlag
) {
2927 (*ctx
->Exec
->Scalef
)( x
, y
, z
);
2932 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
2934 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
2938 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
2940 GET_CURRENT_CONTEXT(ctx
);
2942 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2943 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCISSOR
, 4 );
2950 if (ctx
->ExecuteFlag
) {
2951 (*ctx
->Exec
->Scissor
)( x
, y
, width
, height
);
2956 static void save_ShadeModel( GLenum mode
)
2958 GET_CURRENT_CONTEXT(ctx
);
2960 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2961 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SHADE_MODEL
, 1 );
2965 if (ctx
->ExecuteFlag
) {
2966 (*ctx
->Exec
->ShadeModel
)( mode
);
2971 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
2973 GET_CURRENT_CONTEXT(ctx
);
2975 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2976 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_FUNC
, 3 );
2982 if (ctx
->ExecuteFlag
) {
2983 (*ctx
->Exec
->StencilFunc
)( func
, ref
, mask
);
2988 static void save_StencilMask( GLuint mask
)
2990 GET_CURRENT_CONTEXT(ctx
);
2992 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2993 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_MASK
, 1 );
2997 if (ctx
->ExecuteFlag
) {
2998 (*ctx
->Exec
->StencilMask
)( mask
);
3003 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
3005 GET_CURRENT_CONTEXT(ctx
);
3007 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3008 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_OP
, 3 );
3014 if (ctx
->ExecuteFlag
) {
3015 (*ctx
->Exec
->StencilOp
)( fail
, zfail
, zpass
);
3020 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
3022 GET_CURRENT_CONTEXT(ctx
);
3024 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3025 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXENV
, 6 );
3034 if (ctx
->ExecuteFlag
) {
3035 (*ctx
->Exec
->TexEnvfv
)( target
, pname
, params
);
3040 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
3042 save_TexEnvfv( target
, pname
, ¶m
);
3046 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
3049 p
[0] = (GLfloat
) param
;
3050 p
[1] = p
[2] = p
[3] = 0.0;
3051 save_TexEnvfv( target
, pname
, p
);
3055 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
3058 p
[0] = INT_TO_FLOAT( param
[0] );
3059 p
[1] = INT_TO_FLOAT( param
[1] );
3060 p
[2] = INT_TO_FLOAT( param
[2] );
3061 p
[3] = INT_TO_FLOAT( param
[3] );
3062 save_TexEnvfv( target
, pname
, p
);
3066 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
3068 GET_CURRENT_CONTEXT(ctx
);
3070 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3071 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXGEN
, 6 );
3080 if (ctx
->ExecuteFlag
) {
3081 (*ctx
->Exec
->TexGenfv
)( coord
, pname
, params
);
3086 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3089 p
[0] = (GLfloat
) params
[0];
3090 p
[1] = (GLfloat
) params
[1];
3091 p
[2] = (GLfloat
) params
[2];
3092 p
[3] = (GLfloat
) params
[3];
3093 save_TexGenfv(coord
, pname
, p
);
3097 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3099 GLfloat p
= (GLfloat
) param
;
3100 save_TexGenfv( coord
, pname
, &p
);
3104 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3107 p
[0] = (GLfloat
) params
[0];
3108 p
[1] = (GLfloat
) params
[1];
3109 p
[2] = (GLfloat
) params
[2];
3110 p
[3] = (GLfloat
) params
[3];
3111 save_TexGenfv( coord
, pname
, p
);
3115 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
3117 save_TexGenfv(coord
, pname
, ¶m
);
3121 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
3123 save_TexGeniv( coord
, pname
, ¶m
);
3127 static void save_TexParameterfv( GLenum target
,
3128 GLenum pname
, const GLfloat
*params
)
3130 GET_CURRENT_CONTEXT(ctx
);
3132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3133 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXPARAMETER
, 6 );
3142 if (ctx
->ExecuteFlag
) {
3143 (*ctx
->Exec
->TexParameterfv
)( target
, pname
, params
);
3148 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
3150 save_TexParameterfv(target
, pname
, ¶m
);
3154 static void save_TexParameteri( GLenum target
, GLenum pname
, GLint param
)
3157 fparam
[0] = (GLfloat
) param
;
3158 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3159 save_TexParameterfv(target
, pname
, fparam
);
3163 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
3166 fparam
[0] = (GLfloat
) params
[0];
3167 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3168 save_TexParameterfv(target
, pname
, fparam
);
3172 static void save_TexImage1D( GLenum target
,
3173 GLint level
, GLint components
,
3174 GLsizei width
, GLint border
,
3175 GLenum format
, GLenum type
,
3176 const GLvoid
*pixels
)
3178 GET_CURRENT_CONTEXT(ctx
);
3179 if (target
== GL_PROXY_TEXTURE_1D
) {
3180 /* don't compile, execute immediately */
3181 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3182 border
, format
, type
, pixels
);
3185 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3186 pixels
, &ctx
->Unpack
);
3188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3189 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
3193 n
[3].i
= components
;
3194 n
[4].i
= (GLint
) width
;
3203 if (ctx
->ExecuteFlag
) {
3204 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3205 border
, format
, type
, pixels
);
3211 static void save_TexImage2D( GLenum target
,
3212 GLint level
, GLint components
,
3213 GLsizei width
, GLsizei height
, GLint border
,
3214 GLenum format
, GLenum type
,
3215 const GLvoid
*pixels
)
3217 GET_CURRENT_CONTEXT(ctx
);
3218 if (target
== GL_PROXY_TEXTURE_2D
) {
3219 /* don't compile, execute immediately */
3220 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3221 height
, border
, format
, type
, pixels
);
3224 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3225 pixels
, &ctx
->Unpack
);
3227 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3228 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
3232 n
[3].i
= components
;
3233 n
[4].i
= (GLint
) width
;
3234 n
[5].i
= (GLint
) height
;
3243 if (ctx
->ExecuteFlag
) {
3244 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3245 height
, border
, format
, type
, pixels
);
3251 static void save_TexImage3D( GLenum target
,
3252 GLint level
, GLint internalFormat
,
3253 GLsizei width
, GLsizei height
, GLsizei depth
,
3255 GLenum format
, GLenum type
,
3256 const GLvoid
*pixels
)
3258 GET_CURRENT_CONTEXT(ctx
);
3259 if (target
== GL_PROXY_TEXTURE_3D
) {
3260 /* don't compile, execute immediately */
3261 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3262 height
, depth
, border
, format
, type
, pixels
);
3266 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3267 pixels
, &ctx
->Unpack
);
3268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3269 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
3273 n
[3].i
= (GLint
) internalFormat
;
3274 n
[4].i
= (GLint
) width
;
3275 n
[5].i
= (GLint
) height
;
3276 n
[6].i
= (GLint
) depth
;
3285 if (ctx
->ExecuteFlag
) {
3286 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3287 height
, depth
, border
, format
, type
, pixels
);
3293 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
3294 GLsizei width
, GLenum format
, GLenum type
,
3295 const GLvoid
*pixels
)
3297 GET_CURRENT_CONTEXT(ctx
);
3299 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3300 pixels
, &ctx
->Unpack
);
3301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3302 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
3307 n
[4].i
= (GLint
) width
;
3315 if (ctx
->ExecuteFlag
) {
3316 (*ctx
->Exec
->TexSubImage1D
)( target
, level
, xoffset
, width
,
3317 format
, type
, pixels
);
3322 static void save_TexSubImage2D( GLenum target
, GLint level
,
3323 GLint xoffset
, GLint yoffset
,
3324 GLsizei width
, GLsizei height
,
3325 GLenum format
, GLenum type
,
3326 const GLvoid
*pixels
)
3328 GET_CURRENT_CONTEXT(ctx
);
3330 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3331 pixels
, &ctx
->Unpack
);
3332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3333 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
3339 n
[5].i
= (GLint
) width
;
3340 n
[6].i
= (GLint
) height
;
3348 if (ctx
->ExecuteFlag
) {
3349 (*ctx
->Exec
->TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
3350 width
, height
, format
, type
, pixels
);
3355 static void save_TexSubImage3D( GLenum target
, GLint level
,
3356 GLint xoffset
, GLint yoffset
,GLint zoffset
,
3357 GLsizei width
, GLsizei height
, GLsizei depth
,
3358 GLenum format
, GLenum type
,
3359 const GLvoid
*pixels
)
3361 GET_CURRENT_CONTEXT(ctx
);
3363 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3364 pixels
, &ctx
->Unpack
);
3365 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3366 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
3373 n
[6].i
= (GLint
) width
;
3374 n
[7].i
= (GLint
) height
;
3375 n
[8].i
= (GLint
) depth
;
3383 if (ctx
->ExecuteFlag
) {
3384 (*ctx
->Exec
->TexSubImage3D
)( target
, level
,
3385 xoffset
, yoffset
, zoffset
,
3386 width
, height
, depth
, format
, type
, pixels
);
3391 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
3393 GET_CURRENT_CONTEXT(ctx
);
3395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3396 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRANSLATE
, 3 );
3402 if (ctx
->ExecuteFlag
) {
3403 (*ctx
->Exec
->Translatef
)( x
, y
, z
);
3408 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3410 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3415 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3417 GET_CURRENT_CONTEXT(ctx
);
3419 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3420 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_VIEWPORT
, 4 );
3424 n
[3].i
= (GLint
) width
;
3425 n
[4].i
= (GLint
) height
;
3427 if (ctx
->ExecuteFlag
) {
3428 (*ctx
->Exec
->Viewport
)( x
, y
, width
, height
);
3433 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3435 GET_CURRENT_CONTEXT(ctx
);
3437 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3438 FLUSH_CURRENT(ctx
, 0);
3439 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_WINDOW_POS
, 4 );
3446 if (ctx
->ExecuteFlag
) {
3447 (*ctx
->Exec
->WindowPos4fMESA
)( x
, y
, z
, w
);
3451 static void save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3453 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3456 static void save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3458 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3461 static void save_WindowPos2iMESA(GLint x
, GLint y
)
3463 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3466 static void save_WindowPos2sMESA(GLshort x
, GLshort y
)
3468 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3471 static void save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3473 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3476 static void save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3478 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3481 static void save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3483 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3486 static void save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3488 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3491 static void save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3493 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3496 static void save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3498 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3501 static void save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3503 save_WindowPos4fMESA(x
, y
, z
, w
);
3506 static void save_WindowPos2dvMESA(const GLdouble
*v
)
3508 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3511 static void save_WindowPos2fvMESA(const GLfloat
*v
)
3513 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3516 static void save_WindowPos2ivMESA(const GLint
*v
)
3518 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3521 static void save_WindowPos2svMESA(const GLshort
*v
)
3523 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3526 static void save_WindowPos3dvMESA(const GLdouble
*v
)
3528 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3531 static void save_WindowPos3fvMESA(const GLfloat
*v
)
3533 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3536 static void save_WindowPos3ivMESA(const GLint
*v
)
3538 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3541 static void save_WindowPos3svMESA(const GLshort
*v
)
3543 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3546 static void save_WindowPos4dvMESA(const GLdouble
*v
)
3548 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3549 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3552 static void save_WindowPos4fvMESA(const GLfloat
*v
)
3554 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3557 static void save_WindowPos4ivMESA(const GLint
*v
)
3559 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3560 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3563 static void save_WindowPos4svMESA(const GLshort
*v
)
3565 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3574 static void save_WindowPos3fARB( GLfloat x
, GLfloat y
, GLfloat z
)
3576 GET_CURRENT_CONTEXT(ctx
);
3578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3579 FLUSH_CURRENT(ctx
, 0);
3580 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_WINDOW_POS_ARB
, 3 );
3586 if (ctx
->ExecuteFlag
) {
3587 (*ctx
->Exec
->WindowPos3fMESA
)( x
, y
, z
);
3591 static void save_WindowPos2dARB(GLdouble x
, GLdouble y
)
3593 save_WindowPos3fARB((GLfloat
) x
, (GLfloat
) y
, 0.0F
);
3596 static void save_WindowPos2fARB(GLfloat x
, GLfloat y
)
3598 save_WindowPos3fARB(x
, y
, 0.0F
);
3601 static void save_WindowPos2iARB(GLint x
, GLint y
)
3603 save_WindowPos3fARB((GLfloat
) x
, (GLfloat
) y
, 0.0F
);
3606 static void save_WindowPos2sARB(GLshort x
, GLshort y
)
3608 save_WindowPos3fARB(x
, y
, 0.0F
);
3611 static void save_WindowPos3dARB(GLdouble x
, GLdouble y
, GLdouble z
)
3613 save_WindowPos3fARB((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3616 static void save_WindowPos3iARB(GLint x
, GLint y
, GLint z
)
3618 save_WindowPos3fARB((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3621 static void save_WindowPos3sARB(GLshort x
, GLshort y
, GLshort z
)
3623 save_WindowPos3fARB(x
, y
, z
);
3626 static void save_WindowPos2dvARB(const GLdouble
*v
)
3628 save_WindowPos3fARB((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
);
3631 static void save_WindowPos2fvARB(const GLfloat
*v
)
3633 save_WindowPos3fARB(v
[0], v
[1], 0.0F
);
3636 static void save_WindowPos2ivARB(const GLint
*v
)
3638 save_WindowPos3fARB((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
);
3641 static void save_WindowPos2svARB(const GLshort
*v
)
3643 save_WindowPos3fARB(v
[0], v
[1], 0.0F
);
3646 static void save_WindowPos3dvARB(const GLdouble
*v
)
3648 save_WindowPos3fARB((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2]);
3651 static void save_WindowPos3fvARB(const GLfloat
*v
)
3653 save_WindowPos3fARB(v
[0], v
[1], v
[2]);
3656 static void save_WindowPos3ivARB(const GLint
*v
)
3658 save_WindowPos3fARB((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2]);
3661 static void save_WindowPos3svARB(const GLshort
*v
)
3663 save_WindowPos3fARB(v
[0], v
[1], v
[2]);
3667 /* GL_ARB_multitexture */
3668 static void save_ActiveTextureARB( GLenum target
)
3670 GET_CURRENT_CONTEXT(ctx
);
3672 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3673 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3677 if (ctx
->ExecuteFlag
) {
3678 (*ctx
->Exec
->ActiveTextureARB
)( target
);
3683 /* GL_ARB_transpose_matrix */
3685 static void save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3688 _math_transposefd(tm
, m
);
3689 save_LoadMatrixf(tm
);
3693 static void save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3696 _math_transposef(tm
, m
);
3697 save_LoadMatrixf(tm
);
3702 save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3705 _math_transposefd(tm
, m
);
3706 save_MultMatrixf(tm
);
3711 save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3714 _math_transposef(tm
, m
);
3715 save_MultMatrixf(tm
);
3720 save_PixelTexGenSGIX(GLenum mode
)
3722 GET_CURRENT_CONTEXT(ctx
);
3724 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3725 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_SGIX
, 1 );
3729 if (ctx
->ExecuteFlag
) {
3730 (*ctx
->Exec
->PixelTexGenSGIX
)( mode
);
3735 /* GL_ARB_texture_compression */
3737 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3738 GLenum internalFormat
, GLsizei width
,
3739 GLint border
, GLsizei imageSize
,
3742 GET_CURRENT_CONTEXT(ctx
);
3743 if (target
== GL_PROXY_TEXTURE_1D
) {
3744 /* don't compile, execute immediately */
3745 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3746 width
, border
, imageSize
, data
);
3751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3752 /* make copy of image */
3753 image
= MALLOC(imageSize
);
3755 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3758 MEMCPY(image
, data
, imageSize
);
3759 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7 );
3763 n
[3].e
= internalFormat
;
3764 n
[4].i
= (GLint
) width
;
3772 if (ctx
->ExecuteFlag
) {
3773 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3774 width
, border
, imageSize
, data
);
3781 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
3782 GLenum internalFormat
, GLsizei width
,
3783 GLsizei height
, GLint border
, GLsizei imageSize
,
3786 GET_CURRENT_CONTEXT(ctx
);
3787 if (target
== GL_PROXY_TEXTURE_2D
) {
3788 /* don't compile, execute immediately */
3789 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3790 width
, height
, border
, imageSize
, data
);
3795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3796 /* make copy of image */
3797 image
= MALLOC(imageSize
);
3799 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
3802 MEMCPY(image
, data
, imageSize
);
3803 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8 );
3807 n
[3].e
= internalFormat
;
3808 n
[4].i
= (GLint
) width
;
3809 n
[5].i
= (GLint
) height
;
3817 if (ctx
->ExecuteFlag
) {
3818 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3819 width
, height
, border
, imageSize
, data
);
3826 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
3827 GLenum internalFormat
, GLsizei width
,
3828 GLsizei height
, GLsizei depth
, GLint border
,
3829 GLsizei imageSize
, const GLvoid
*data
)
3831 GET_CURRENT_CONTEXT(ctx
);
3832 if (target
== GL_PROXY_TEXTURE_3D
) {
3833 /* don't compile, execute immediately */
3834 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3835 width
, height
, depth
, border
, imageSize
, data
);
3840 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3841 /* make copy of image */
3842 image
= MALLOC(imageSize
);
3844 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
3847 MEMCPY(image
, data
, imageSize
);
3848 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9 );
3852 n
[3].e
= internalFormat
;
3853 n
[4].i
= (GLint
) width
;
3854 n
[5].i
= (GLint
) height
;
3855 n
[6].i
= (GLint
) depth
;
3863 if (ctx
->ExecuteFlag
) {
3864 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3865 width
, height
, depth
, border
, imageSize
, data
);
3872 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
3873 GLsizei width
, GLenum format
,
3874 GLsizei imageSize
, const GLvoid
*data
)
3879 GET_CURRENT_CONTEXT(ctx
);
3880 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3882 /* make copy of image */
3883 image
= MALLOC(imageSize
);
3885 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
3888 MEMCPY(image
, data
, imageSize
);
3889 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7 );
3894 n
[4].i
= (GLint
) width
;
3902 if (ctx
->ExecuteFlag
) {
3903 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(target
, level
, xoffset
,
3904 width
, format
, imageSize
, data
);
3910 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
3911 GLint yoffset
, GLsizei width
, GLsizei height
,
3912 GLenum format
, GLsizei imageSize
,
3918 GET_CURRENT_CONTEXT(ctx
);
3919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3921 /* make copy of image */
3922 image
= MALLOC(imageSize
);
3924 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
3927 MEMCPY(image
, data
, imageSize
);
3928 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9 );
3934 n
[5].i
= (GLint
) width
;
3935 n
[6].i
= (GLint
) height
;
3943 if (ctx
->ExecuteFlag
) {
3944 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(target
, level
, xoffset
, yoffset
,
3945 width
, height
, format
, imageSize
, data
);
3951 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
3952 GLint yoffset
, GLint zoffset
, GLsizei width
,
3953 GLsizei height
, GLsizei depth
, GLenum format
,
3954 GLsizei imageSize
, const GLvoid
*data
)
3959 GET_CURRENT_CONTEXT(ctx
);
3960 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3962 /* make copy of image */
3963 image
= MALLOC(imageSize
);
3965 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
3968 MEMCPY(image
, data
, imageSize
);
3969 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11 );
3976 n
[6].i
= (GLint
) width
;
3977 n
[7].i
= (GLint
) height
;
3978 n
[8].i
= (GLint
) depth
;
3980 n
[10].i
= imageSize
;
3986 if (ctx
->ExecuteFlag
) {
3987 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(target
, level
, xoffset
, yoffset
,
3988 zoffset
, width
, height
, depth
, format
, imageSize
, data
);
3993 /* GL_ARB_multisample */
3995 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
3997 GET_CURRENT_CONTEXT(ctx
);
3999 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4000 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SAMPLE_COVERAGE
, 2 );
4005 if (ctx
->ExecuteFlag
) {
4006 (*ctx
->Exec
->SampleCoverageARB
)( value
, invert
);
4011 /* GL_SGIS_pixel_texture */
4014 save_PixelTexGenParameteriSGIS(GLenum target
, GLint value
)
4016 GET_CURRENT_CONTEXT(ctx
);
4018 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4019 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
, 2 );
4024 if (ctx
->ExecuteFlag
) {
4025 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( target
, value
);
4031 save_PixelTexGenParameterfSGIS(GLenum target
, GLfloat value
)
4033 save_PixelTexGenParameteriSGIS(target
, (GLint
) value
);
4038 save_PixelTexGenParameterivSGIS(GLenum target
, const GLint
*value
)
4040 save_PixelTexGenParameteriSGIS(target
, *value
);
4045 save_PixelTexGenParameterfvSGIS(GLenum target
, const GLfloat
*value
)
4047 save_PixelTexGenParameteriSGIS(target
, (GLint
) *value
);
4052 * GL_NV_vertex_program
4055 save_BindProgramNV(GLenum target
, GLuint id
)
4057 GET_CURRENT_CONTEXT(ctx
);
4059 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4060 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_PROGRAM_NV
, 2 );
4065 if (ctx
->ExecuteFlag
) {
4066 (*ctx
->Exec
->BindProgramNV
)( target
, id
);
4071 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4073 GET_CURRENT_CONTEXT(ctx
);
4075 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4076 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6 );
4085 if (ctx
->ExecuteFlag
) {
4086 (*ctx
->Exec
->ExecuteProgramNV
)(target
, id
, params
);
4092 save_ProgramParameter4fNV(GLenum target
, GLuint index
,
4093 GLfloat x
, GLfloat y
,
4094 GLfloat z
, GLfloat w
)
4096 GET_CURRENT_CONTEXT(ctx
);
4098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4099 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_PARAMETER4F_NV
, 6 );
4108 if (ctx
->ExecuteFlag
) {
4109 (*ctx
->Exec
->ProgramParameter4fNV
)(target
, index
, x
, y
, z
, w
);
4115 save_ProgramParameter4fvNV(GLenum target
, GLuint index
, const GLfloat
*params
)
4117 save_ProgramParameter4fNV(target
, index
, params
[0], params
[1],
4118 params
[2], params
[3]);
4123 save_ProgramParameter4dNV(GLenum target
, GLuint index
,
4124 GLdouble x
, GLdouble y
,
4125 GLdouble z
, GLdouble w
)
4127 save_ProgramParameter4fNV(target
, index
, (GLfloat
) x
, (GLfloat
) y
,
4128 (GLfloat
) z
, (GLfloat
) w
);
4133 save_ProgramParameter4dvNV(GLenum target
, GLuint index
,
4134 const GLdouble
*params
)
4136 save_ProgramParameter4fNV(target
, index
, (GLfloat
) params
[0],
4137 (GLfloat
) params
[1], (GLfloat
) params
[2],
4138 (GLfloat
) params
[3]);
4143 save_TrackMatrixNV(GLenum target
, GLuint address
,
4144 GLenum matrix
, GLenum transform
)
4146 GET_CURRENT_CONTEXT(ctx
);
4148 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4149 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRACK_MATRIX_NV
, 4 );
4156 if (ctx
->ExecuteFlag
) {
4157 (*ctx
->Exec
->TrackMatrixNV
)(target
, address
, matrix
, transform
);
4164 /* KW: Compile commands
4166 * Will appear in the list before the vertex buffer containing the
4167 * command that provoked the error. I don't see this as a problem.
4170 _mesa_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
4173 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ERROR
, 2 );
4176 n
[2].data
= (void *) s
;
4178 /* execute already done */
4183 * Compile an error into current display list.
4186 _mesa_compile_error( GLcontext
*ctx
, GLenum error
, const char *s
)
4188 if (ctx
->CompileFlag
)
4189 _mesa_save_error( ctx
, error
, s
);
4191 if (ctx
->ExecuteFlag
)
4192 _mesa_error( ctx
, error
, s
);
4198 islist(GLcontext
*ctx
, GLuint list
)
4200 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
4210 /**********************************************************************/
4211 /* Display list execution */
4212 /**********************************************************************/
4216 * Execute a display list. Note that the ListBase offset must have already
4217 * been added before calling this function. I.e. the list argument is
4218 * the absolute list number, not relative to ListBase.
4219 * Input: list - display list number
4222 execute_list( GLcontext
*ctx
, GLuint list
)
4227 if (!islist(ctx
,list
))
4230 if (ctx
->Driver
.BeginCallList
)
4231 ctx
->Driver
.BeginCallList( ctx
, list
);
4233 /* fprintf(stderr, "execute list %d\n", list); */
4234 /* mesa_print_display_list( list ); */
4238 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
4242 OpCode opcode
= n
[0].opcode
;
4243 int i
= (int)n
[0].opcode
- (int)OPCODE_DRV_0
;
4245 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
4246 ctx
->listext
.opcode
[i
].execute(ctx
, &n
[1]);
4247 n
+= ctx
->listext
.opcode
[i
].size
;
4252 _mesa_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
4255 (*ctx
->Exec
->Accum
)( n
[1].e
, n
[2].f
);
4257 case OPCODE_ALPHA_FUNC
:
4258 (*ctx
->Exec
->AlphaFunc
)( n
[1].e
, n
[2].f
);
4260 case OPCODE_BIND_TEXTURE
:
4261 (*ctx
->Exec
->BindTexture
)( n
[1].e
, n
[2].ui
);
4265 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4266 ctx
->Unpack
= _mesa_native_packing
;
4267 (*ctx
->Exec
->Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
4268 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (const GLubyte
*) n
[7].data
);
4269 ctx
->Unpack
= save
; /* restore */
4272 case OPCODE_BLEND_COLOR
:
4273 (*ctx
->Exec
->BlendColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4275 case OPCODE_BLEND_EQUATION
:
4276 (*ctx
->Exec
->BlendEquation
)( n
[1].e
);
4278 case OPCODE_BLEND_FUNC
:
4279 (*ctx
->Exec
->BlendFunc
)( n
[1].e
, n
[2].e
);
4281 case OPCODE_BLEND_FUNC_SEPARATE
:
4282 (*ctx
->Exec
->BlendFuncSeparateEXT
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
4284 case OPCODE_CALL_LIST
:
4285 /* Generated by glCallList(), don't add ListBase */
4286 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4287 execute_list( ctx
, n
[1].ui
);
4290 case OPCODE_CALL_LIST_OFFSET
:
4291 /* Generated by glCallLists() so we must add ListBase */
4292 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4293 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
4297 (*ctx
->Exec
->Clear
)( n
[1].bf
);
4299 case OPCODE_CLEAR_COLOR
:
4300 (*ctx
->Exec
->ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4302 case OPCODE_CLEAR_ACCUM
:
4303 (*ctx
->Exec
->ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4305 case OPCODE_CLEAR_DEPTH
:
4306 (*ctx
->Exec
->ClearDepth
)( (GLclampd
) n
[1].f
);
4308 case OPCODE_CLEAR_INDEX
:
4309 (*ctx
->Exec
->ClearIndex
)( (GLfloat
) n
[1].ui
);
4311 case OPCODE_CLEAR_STENCIL
:
4312 (*ctx
->Exec
->ClearStencil
)( n
[1].i
);
4314 case OPCODE_CLIP_PLANE
:
4321 (*ctx
->Exec
->ClipPlane
)( n
[1].e
, eq
);
4324 case OPCODE_COLOR_MASK
:
4325 (*ctx
->Exec
->ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
4327 case OPCODE_COLOR_MATERIAL
:
4328 (*ctx
->Exec
->ColorMaterial
)( n
[1].e
, n
[2].e
);
4330 case OPCODE_COLOR_TABLE
:
4332 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4333 ctx
->Unpack
= _mesa_native_packing
;
4334 (*ctx
->Exec
->ColorTable
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
4335 n
[5].e
, n
[6].data
);
4336 ctx
->Unpack
= save
; /* restore */
4339 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
4346 (*ctx
->Exec
->ColorTableParameterfv
)( n
[1].e
, n
[2].e
, params
);
4349 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
4356 (*ctx
->Exec
->ColorTableParameteriv
)( n
[1].e
, n
[2].e
, params
);
4359 case OPCODE_COLOR_SUB_TABLE
:
4361 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4362 ctx
->Unpack
= _mesa_native_packing
;
4363 (*ctx
->Exec
->ColorSubTable
)( n
[1].e
, n
[2].i
, n
[3].i
,
4364 n
[4].e
, n
[5].e
, n
[6].data
);
4365 ctx
->Unpack
= save
; /* restore */
4368 case OPCODE_CONVOLUTION_FILTER_1D
:
4370 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4371 ctx
->Unpack
= _mesa_native_packing
;
4372 (*ctx
->Exec
->ConvolutionFilter1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4373 n
[4].e
, n
[5].e
, n
[6].data
);
4374 ctx
->Unpack
= save
; /* restore */
4377 case OPCODE_CONVOLUTION_FILTER_2D
:
4379 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4380 ctx
->Unpack
= _mesa_native_packing
;
4381 (*ctx
->Exec
->ConvolutionFilter2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4382 n
[4].i
, n
[5].e
, n
[6].e
, n
[7].data
);
4383 ctx
->Unpack
= save
; /* restore */
4386 case OPCODE_CONVOLUTION_PARAMETER_I
:
4387 (*ctx
->Exec
->ConvolutionParameteri
)( n
[1].e
, n
[2].e
, n
[3].i
);
4389 case OPCODE_CONVOLUTION_PARAMETER_IV
:
4396 (*ctx
->Exec
->ConvolutionParameteriv
)( n
[1].e
, n
[2].e
, params
);
4399 case OPCODE_CONVOLUTION_PARAMETER_F
:
4400 (*ctx
->Exec
->ConvolutionParameterf
)( n
[1].e
, n
[2].e
, n
[3].f
);
4402 case OPCODE_CONVOLUTION_PARAMETER_FV
:
4409 (*ctx
->Exec
->ConvolutionParameterfv
)( n
[1].e
, n
[2].e
, params
);
4412 case OPCODE_COPY_COLOR_SUB_TABLE
:
4413 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4414 n
[3].i
, n
[4].i
, n
[5].i
);
4416 case OPCODE_COPY_COLOR_TABLE
:
4417 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4418 n
[3].i
, n
[4].i
, n
[5].i
);
4420 case OPCODE_COPY_PIXELS
:
4421 (*ctx
->Exec
->CopyPixels
)( n
[1].i
, n
[2].i
,
4422 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
4424 case OPCODE_COPY_TEX_IMAGE1D
:
4425 (*ctx
->Exec
->CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4426 n
[5].i
, n
[6].i
, n
[7].i
);
4428 case OPCODE_COPY_TEX_IMAGE2D
:
4429 (*ctx
->Exec
->CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4430 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4432 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
4433 (*ctx
->Exec
->CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4434 n
[4].i
, n
[5].i
, n
[6].i
);
4436 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
4437 (*ctx
->Exec
->CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4438 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4440 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
4441 (*ctx
->Exec
->CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4442 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
4444 case OPCODE_CULL_FACE
:
4445 (*ctx
->Exec
->CullFace
)( n
[1].e
);
4447 case OPCODE_DEPTH_FUNC
:
4448 (*ctx
->Exec
->DepthFunc
)( n
[1].e
);
4450 case OPCODE_DEPTH_MASK
:
4451 (*ctx
->Exec
->DepthMask
)( n
[1].b
);
4453 case OPCODE_DEPTH_RANGE
:
4454 (*ctx
->Exec
->DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
4456 case OPCODE_DISABLE
:
4457 (*ctx
->Exec
->Disable
)( n
[1].e
);
4459 case OPCODE_DRAW_BUFFER
:
4460 (*ctx
->Exec
->DrawBuffer
)( n
[1].e
);
4462 case OPCODE_DRAW_PIXELS
:
4464 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4465 ctx
->Unpack
= _mesa_native_packing
;
4466 (*ctx
->Exec
->DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
4468 ctx
->Unpack
= save
; /* restore */
4472 (*ctx
->Exec
->Enable
)( n
[1].e
);
4474 case OPCODE_EVALMESH1
:
4475 (*ctx
->Exec
->EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
4477 case OPCODE_EVALMESH2
:
4478 (*ctx
->Exec
->EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
4487 (*ctx
->Exec
->Fogfv
)( n
[1].e
, p
);
4490 case OPCODE_FRONT_FACE
:
4491 (*ctx
->Exec
->FrontFace
)( n
[1].e
);
4493 case OPCODE_FRUSTUM
:
4494 (*ctx
->Exec
->Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4497 (*ctx
->Exec
->Hint
)( n
[1].e
, n
[2].e
);
4499 case OPCODE_HISTOGRAM
:
4500 (*ctx
->Exec
->Histogram
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
);
4502 case OPCODE_INDEX_MASK
:
4503 (*ctx
->Exec
->IndexMask
)( n
[1].ui
);
4505 case OPCODE_INIT_NAMES
:
4506 (*ctx
->Exec
->InitNames
)();
4515 (*ctx
->Exec
->Lightfv
)( n
[1].e
, n
[2].e
, p
);
4518 case OPCODE_LIGHT_MODEL
:
4525 (*ctx
->Exec
->LightModelfv
)( n
[1].e
, p
);
4528 case OPCODE_LINE_STIPPLE
:
4529 (*ctx
->Exec
->LineStipple
)( n
[1].i
, n
[2].us
);
4531 case OPCODE_LINE_WIDTH
:
4532 (*ctx
->Exec
->LineWidth
)( n
[1].f
);
4534 case OPCODE_LIST_BASE
:
4535 (*ctx
->Exec
->ListBase
)( n
[1].ui
);
4537 case OPCODE_LOAD_IDENTITY
:
4538 (*ctx
->Exec
->LoadIdentity
)();
4540 case OPCODE_LOAD_MATRIX
:
4541 if (sizeof(Node
)==sizeof(GLfloat
)) {
4542 (*ctx
->Exec
->LoadMatrixf
)( &n
[1].f
);
4547 for (i
=0;i
<16;i
++) {
4550 (*ctx
->Exec
->LoadMatrixf
)( m
);
4553 case OPCODE_LOAD_NAME
:
4554 (*ctx
->Exec
->LoadName
)( n
[1].ui
);
4556 case OPCODE_LOGIC_OP
:
4557 (*ctx
->Exec
->LogicOp
)( n
[1].e
);
4561 GLenum target
= n
[1].e
;
4562 GLint ustride
= _mesa_evaluator_components(target
);
4563 GLint uorder
= n
[5].i
;
4564 GLfloat u1
= n
[2].f
;
4565 GLfloat u2
= n
[3].f
;
4566 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, ustride
, uorder
,
4567 (GLfloat
*) n
[6].data
);
4572 GLenum target
= n
[1].e
;
4573 GLfloat u1
= n
[2].f
;
4574 GLfloat u2
= n
[3].f
;
4575 GLfloat v1
= n
[4].f
;
4576 GLfloat v2
= n
[5].f
;
4577 GLint ustride
= n
[6].i
;
4578 GLint vstride
= n
[7].i
;
4579 GLint uorder
= n
[8].i
;
4580 GLint vorder
= n
[9].i
;
4581 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
4582 v1
, v2
, vstride
, vorder
,
4583 (GLfloat
*) n
[10].data
);
4586 case OPCODE_MAPGRID1
:
4587 (*ctx
->Exec
->MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
4589 case OPCODE_MAPGRID2
:
4590 (*ctx
->Exec
->MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
4592 case OPCODE_MATRIX_MODE
:
4593 (*ctx
->Exec
->MatrixMode
)( n
[1].e
);
4595 case OPCODE_MIN_MAX
:
4596 (*ctx
->Exec
->Minmax
)(n
[1].e
, n
[2].e
, n
[3].b
);
4598 case OPCODE_MULT_MATRIX
:
4599 if (sizeof(Node
)==sizeof(GLfloat
)) {
4600 (*ctx
->Exec
->MultMatrixf
)( &n
[1].f
);
4605 for (i
=0;i
<16;i
++) {
4608 (*ctx
->Exec
->MultMatrixf
)( m
);
4612 (*ctx
->Exec
->Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4614 case OPCODE_PASSTHROUGH
:
4615 (*ctx
->Exec
->PassThrough
)( n
[1].f
);
4617 case OPCODE_PIXEL_MAP
:
4618 (*ctx
->Exec
->PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
4620 case OPCODE_PIXEL_TRANSFER
:
4621 (*ctx
->Exec
->PixelTransferf
)( n
[1].e
, n
[2].f
);
4623 case OPCODE_PIXEL_ZOOM
:
4624 (*ctx
->Exec
->PixelZoom
)( n
[1].f
, n
[2].f
);
4626 case OPCODE_POINT_SIZE
:
4627 (*ctx
->Exec
->PointSize
)( n
[1].f
);
4629 case OPCODE_POINT_PARAMETERS
:
4635 (*ctx
->Exec
->PointParameterfvEXT
)( n
[1].e
, params
);
4638 case OPCODE_POLYGON_MODE
:
4639 (*ctx
->Exec
->PolygonMode
)( n
[1].e
, n
[2].e
);
4641 case OPCODE_POLYGON_STIPPLE
:
4642 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) n
[1].data
);
4644 case OPCODE_POLYGON_OFFSET
:
4645 (*ctx
->Exec
->PolygonOffset
)( n
[1].f
, n
[2].f
);
4647 case OPCODE_POP_ATTRIB
:
4648 (*ctx
->Exec
->PopAttrib
)();
4650 case OPCODE_POP_MATRIX
:
4651 (*ctx
->Exec
->PopMatrix
)();
4653 case OPCODE_POP_NAME
:
4654 (*ctx
->Exec
->PopName
)();
4656 case OPCODE_PRIORITIZE_TEXTURE
:
4657 (*ctx
->Exec
->PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
4659 case OPCODE_PUSH_ATTRIB
:
4660 (*ctx
->Exec
->PushAttrib
)( n
[1].bf
);
4662 case OPCODE_PUSH_MATRIX
:
4663 (*ctx
->Exec
->PushMatrix
)();
4665 case OPCODE_PUSH_NAME
:
4666 (*ctx
->Exec
->PushName
)( n
[1].ui
);
4668 case OPCODE_RASTER_POS
:
4669 (*ctx
->Exec
->RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4671 case OPCODE_READ_BUFFER
:
4672 (*ctx
->Exec
->ReadBuffer
)( n
[1].e
);
4674 case OPCODE_RESET_HISTOGRAM
:
4675 (*ctx
->Exec
->ResetHistogram
)( n
[1].e
);
4677 case OPCODE_RESET_MIN_MAX
:
4678 (*ctx
->Exec
->ResetMinmax
)( n
[1].e
);
4681 (*ctx
->Exec
->Rotatef
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4684 (*ctx
->Exec
->Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4686 case OPCODE_SCISSOR
:
4687 (*ctx
->Exec
->Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
4689 case OPCODE_SHADE_MODEL
:
4690 (*ctx
->Exec
->ShadeModel
)( n
[1].e
);
4692 case OPCODE_STENCIL_FUNC
:
4693 (*ctx
->Exec
->StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
4695 case OPCODE_STENCIL_MASK
:
4696 (*ctx
->Exec
->StencilMask
)( n
[1].ui
);
4698 case OPCODE_STENCIL_OP
:
4699 (*ctx
->Exec
->StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
4708 (*ctx
->Exec
->TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
4718 (*ctx
->Exec
->TexGenfv
)( n
[1].e
, n
[2].e
, params
);
4721 case OPCODE_TEXPARAMETER
:
4728 (*ctx
->Exec
->TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
4731 case OPCODE_TEX_IMAGE1D
:
4733 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4734 ctx
->Unpack
= _mesa_native_packing
;
4735 (*ctx
->Exec
->TexImage1D
)(
4736 n
[1].e
, /* target */
4738 n
[3].i
, /* components */
4740 n
[5].e
, /* border */
4741 n
[6].e
, /* format */
4744 ctx
->Unpack
= save
; /* restore */
4747 case OPCODE_TEX_IMAGE2D
:
4749 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4750 ctx
->Unpack
= _mesa_native_packing
;
4751 (*ctx
->Exec
->TexImage2D
)(
4752 n
[1].e
, /* target */
4754 n
[3].i
, /* components */
4756 n
[5].i
, /* height */
4757 n
[6].e
, /* border */
4758 n
[7].e
, /* format */
4761 ctx
->Unpack
= save
; /* restore */
4764 case OPCODE_TEX_IMAGE3D
:
4766 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4767 ctx
->Unpack
= _mesa_native_packing
;
4768 (*ctx
->Exec
->TexImage3D
)(
4769 n
[1].e
, /* target */
4771 n
[3].i
, /* components */
4773 n
[5].i
, /* height */
4775 n
[7].e
, /* border */
4776 n
[8].e
, /* format */
4779 ctx
->Unpack
= save
; /* restore */
4782 case OPCODE_TEX_SUB_IMAGE1D
:
4784 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4785 ctx
->Unpack
= _mesa_native_packing
;
4786 (*ctx
->Exec
->TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4788 n
[6].e
, n
[7].data
);
4789 ctx
->Unpack
= save
; /* restore */
4792 case OPCODE_TEX_SUB_IMAGE2D
:
4794 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4795 ctx
->Unpack
= _mesa_native_packing
;
4796 (*ctx
->Exec
->TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4798 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
4799 ctx
->Unpack
= save
; /* restore */
4802 case OPCODE_TEX_SUB_IMAGE3D
:
4804 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4805 ctx
->Unpack
= _mesa_native_packing
;
4806 (*ctx
->Exec
->TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4807 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
4808 n
[8].i
, n
[9].e
, n
[10].e
,
4810 ctx
->Unpack
= save
; /* restore */
4813 case OPCODE_TRANSLATE
:
4814 (*ctx
->Exec
->Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4816 case OPCODE_VIEWPORT
:
4817 (*ctx
->Exec
->Viewport
)(n
[1].i
, n
[2].i
,
4818 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
4820 case OPCODE_WINDOW_POS
:
4821 (*ctx
->Exec
->WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4823 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
4824 (*ctx
->Exec
->ActiveTextureARB
)( n
[1].e
);
4826 case OPCODE_PIXEL_TEXGEN_SGIX
: /* GL_SGIX_pixel_texture */
4827 (*ctx
->Exec
->PixelTexGenSGIX
)( n
[1].e
);
4829 case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
: /* GL_SGIS_pixel_texture */
4830 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( n
[1].e
, n
[2].i
);
4832 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
4833 (*ctx
->Exec
->CompressedTexImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4834 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].data
);
4836 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
4837 (*ctx
->Exec
->CompressedTexImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4838 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].data
);
4840 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
4841 (*ctx
->Exec
->CompressedTexImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4842 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].data
);
4844 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
4845 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4846 n
[4].i
, n
[5].e
, n
[6].i
, n
[7].data
);
4848 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
4849 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4850 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
, n
[9].data
);
4852 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
4853 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4854 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
4855 n
[9].e
, n
[10].i
, n
[11].data
);
4857 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
4858 (*ctx
->Exec
->SampleCoverageARB
)(n
[1].f
, n
[2].b
);
4860 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
4861 (*ctx
->Exec
->WindowPos3fARB
)( n
[1].f
, n
[2].f
, n
[3].f
);
4863 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
4864 (*ctx
->Exec
->BindProgramNV
)( n
[1].e
, n
[2].ui
);
4866 case OPCODE_EXECUTE_PROGRAM_NV
:
4873 (*ctx
->Exec
->ExecuteProgramNV
)(n
[1].e
, n
[2].ui
, v
);
4876 case OPCODE_REQUEST_PROGRAMS_RESIDENT_NV
:
4878 (*ctx->Exec->RequestResidentProgramsNV)();
4881 case OPCODE_LOAD_PROGRAM_NV
:
4883 (*ctx->Exec->LoadProgramNV)();
4886 case OPCODE_PROGRAM_PARAMETER4F_NV
:
4887 (*ctx
->Exec
->ProgramParameter4fNV
)(n
[1].e
, n
[2].ui
, n
[3].f
,
4888 n
[4].f
, n
[5].f
, n
[6].f
);
4890 case OPCODE_PROGRAM_PARAMETERS4FV_NV
:
4892 (*ctx->Exec->ProgramParameters4fvNV)();
4895 case OPCODE_TRACK_MATRIX_NV
:
4896 (*ctx
->Exec
->TrackMatrixNV
)(n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
);
4899 case OPCODE_CONTINUE
:
4900 n
= (Node
*) n
[1].next
;
4902 case OPCODE_END_OF_LIST
:
4908 sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
4909 _mesa_problem( ctx
, msg
);
4914 /* increment n to point to next compiled command */
4915 if (opcode
!=OPCODE_CONTINUE
) {
4916 n
+= InstSize
[opcode
];
4922 if (ctx
->Driver
.EndCallList
)
4923 ctx
->Driver
.EndCallList( ctx
);
4930 /**********************************************************************/
4932 /**********************************************************************/
4938 * Test if a display list number is valid.
4941 _mesa_IsList( GLuint list
)
4943 GET_CURRENT_CONTEXT(ctx
);
4944 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4945 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
4946 return islist(ctx
, list
);
4951 * Delete a sequence of consecutive display lists.
4954 _mesa_DeleteLists( GLuint list
, GLsizei range
)
4956 GET_CURRENT_CONTEXT(ctx
);
4958 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4959 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4962 _mesa_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
4965 for (i
=list
;i
<list
+range
;i
++) {
4966 _mesa_destroy_list( ctx
, i
);
4973 * Return a display list number, n, such that lists n through n+range-1
4977 _mesa_GenLists(GLsizei range
)
4979 GET_CURRENT_CONTEXT(ctx
);
4981 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4982 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
4985 _mesa_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
4993 * Make this an atomic operation
4995 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
4997 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
4999 /* reserve the list IDs by with empty/dummy lists */
5001 for (i
=0; i
<range
; i
++) {
5002 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
5006 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
5014 * Begin a new display list.
5017 _mesa_NewList( GLuint list
, GLenum mode
)
5019 GET_CURRENT_CONTEXT(ctx
);
5020 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
5021 ASSERT_OUTSIDE_BEGIN_END(ctx
);
5023 if (MESA_VERBOSE
&VERBOSE_API
)
5024 fprintf(stderr
, "glNewList %u %s\n", list
, _mesa_lookup_enum_by_nr(mode
));
5027 _mesa_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
5031 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
5032 _mesa_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
5036 if (ctx
->CurrentListPtr
) {
5037 /* already compiling a display list */
5038 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
5042 /* Allocate new display list */
5043 ctx
->CurrentListNum
= list
;
5044 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
5045 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
5046 ctx
->CurrentPos
= 0;
5047 ctx
->CompileFlag
= GL_TRUE
;
5048 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
5050 ctx
->Driver
.NewList( ctx
, list
, mode
);
5052 ctx
->CurrentDispatch
= ctx
->Save
;
5053 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5059 * End definition of current display list. Is the current
5060 * ASSERT_OUTSIDE_BEGIN_END strong enough to really guarentee that
5061 * we are outside begin/end calls?
5064 _mesa_EndList( void )
5066 GET_CURRENT_CONTEXT(ctx
);
5067 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
5068 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
5070 if (MESA_VERBOSE
&VERBOSE_API
)
5071 fprintf(stderr
, "glEndList\n");
5073 /* Check that a list is under construction */
5074 if (!ctx
->CurrentListPtr
) {
5075 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
5079 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_END_OF_LIST
, 0 );
5081 /* Destroy old list, if any */
5082 _mesa_destroy_list(ctx
, ctx
->CurrentListNum
);
5083 /* Install the list */
5084 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
5087 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
5088 mesa_print_display_list(ctx
->CurrentListNum
);
5090 ctx
->CurrentListNum
= 0;
5091 ctx
->CurrentListPtr
= NULL
;
5092 ctx
->ExecuteFlag
= GL_TRUE
;
5093 ctx
->CompileFlag
= GL_FALSE
;
5095 ctx
->Driver
.EndList( ctx
);
5097 ctx
->CurrentDispatch
= ctx
->Exec
;
5098 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5104 _mesa_CallList( GLuint list
)
5106 GLboolean save_compile_flag
;
5107 GET_CURRENT_CONTEXT(ctx
);
5108 FLUSH_CURRENT(ctx
, 0);
5109 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
5110 /* execute the display list, and restore the CompileFlag. */
5113 if (MESA_VERBOSE
& VERBOSE_API
)
5114 fprintf(stderr
, "_mesa_CallList %d\n", list
);
5116 /* mesa_print_display_list( list ); */
5118 save_compile_flag
= ctx
->CompileFlag
;
5119 if (save_compile_flag
) {
5120 ctx
->CompileFlag
= GL_FALSE
;
5123 execute_list( ctx
, list
);
5124 ctx
->CompileFlag
= save_compile_flag
;
5126 /* also restore API function pointers to point to "save" versions */
5127 if (save_compile_flag
) {
5128 ctx
->CurrentDispatch
= ctx
->Save
;
5129 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5136 * Execute glCallLists: call multiple display lists.
5139 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
5141 GET_CURRENT_CONTEXT(ctx
);
5144 GLboolean save_compile_flag
;
5146 if (MESA_VERBOSE
& VERBOSE_API
)
5147 fprintf(stderr
, "_mesa_CallLists %d\n", n
);
5149 /* Save the CompileFlag status, turn it off, execute display list,
5150 * and restore the CompileFlag.
5152 save_compile_flag
= ctx
->CompileFlag
;
5153 ctx
->CompileFlag
= GL_FALSE
;
5156 list
= translate_id( i
, type
, lists
);
5157 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
5160 ctx
->CompileFlag
= save_compile_flag
;
5162 /* also restore API function pointers to point to "save" versions */
5163 if (save_compile_flag
) {
5164 ctx
->CurrentDispatch
= ctx
->Save
;
5165 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5172 * Set the offset added to list numbers in glCallLists.
5175 _mesa_ListBase( GLuint base
)
5177 GET_CURRENT_CONTEXT(ctx
);
5178 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
5179 ASSERT_OUTSIDE_BEGIN_END(ctx
);
5180 ctx
->List
.ListBase
= base
;
5184 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
5186 static void exec_Finish( void )
5188 GET_CURRENT_CONTEXT(ctx
);
5189 FLUSH_VERTICES(ctx
, 0);
5190 ctx
->Exec
->Finish();
5193 static void exec_Flush( void )
5195 GET_CURRENT_CONTEXT(ctx
);
5196 FLUSH_VERTICES(ctx
, 0);
5197 ctx
->Exec
->Flush( );
5200 static void exec_GetBooleanv( GLenum pname
, GLboolean
*params
)
5202 GET_CURRENT_CONTEXT(ctx
);
5203 FLUSH_VERTICES(ctx
, 0);
5204 ctx
->Exec
->GetBooleanv( pname
, params
);
5207 static void exec_GetClipPlane( GLenum plane
, GLdouble
*equation
)
5209 GET_CURRENT_CONTEXT(ctx
);
5210 FLUSH_VERTICES(ctx
, 0);
5211 ctx
->Exec
->GetClipPlane( plane
, equation
);
5214 static void exec_GetDoublev( GLenum pname
, GLdouble
*params
)
5216 GET_CURRENT_CONTEXT(ctx
);
5217 FLUSH_VERTICES(ctx
, 0);
5218 ctx
->Exec
->GetDoublev( pname
, params
);
5221 static GLenum
exec_GetError( void )
5223 GET_CURRENT_CONTEXT(ctx
);
5224 FLUSH_VERTICES(ctx
, 0);
5225 return ctx
->Exec
->GetError( );
5228 static void exec_GetFloatv( GLenum pname
, GLfloat
*params
)
5230 GET_CURRENT_CONTEXT(ctx
);
5231 FLUSH_VERTICES(ctx
, 0);
5232 ctx
->Exec
->GetFloatv( pname
, params
);
5235 static void exec_GetIntegerv( GLenum pname
, GLint
*params
)
5237 GET_CURRENT_CONTEXT(ctx
);
5238 FLUSH_VERTICES(ctx
, 0);
5239 ctx
->Exec
->GetIntegerv( pname
, params
);
5242 static void exec_GetLightfv( GLenum light
, GLenum pname
, GLfloat
*params
)
5244 GET_CURRENT_CONTEXT(ctx
);
5245 FLUSH_VERTICES(ctx
, 0);
5246 ctx
->Exec
->GetLightfv( light
, pname
, params
);
5249 static void exec_GetLightiv( GLenum light
, GLenum pname
, GLint
*params
)
5251 GET_CURRENT_CONTEXT(ctx
);
5252 FLUSH_VERTICES(ctx
, 0);
5253 ctx
->Exec
->GetLightiv( light
, pname
, params
);
5256 static void exec_GetMapdv( GLenum target
, GLenum query
, GLdouble
*v
)
5258 GET_CURRENT_CONTEXT(ctx
);
5259 FLUSH_VERTICES(ctx
, 0);
5260 ctx
->Exec
->GetMapdv( target
, query
, v
);
5263 static void exec_GetMapfv( GLenum target
, GLenum query
, GLfloat
*v
)
5265 GET_CURRENT_CONTEXT(ctx
);
5266 FLUSH_VERTICES(ctx
, 0);
5267 ctx
->Exec
->GetMapfv( target
, query
, v
);
5270 static void exec_GetMapiv( GLenum target
, GLenum query
, GLint
*v
)
5272 GET_CURRENT_CONTEXT(ctx
);
5273 FLUSH_VERTICES(ctx
, 0);
5274 ctx
->Exec
->GetMapiv( target
, query
, v
);
5277 static void exec_GetMaterialfv( GLenum face
, GLenum pname
, GLfloat
*params
)
5279 GET_CURRENT_CONTEXT(ctx
);
5280 FLUSH_VERTICES(ctx
, 0);
5281 ctx
->Exec
->GetMaterialfv( face
, pname
, params
);
5284 static void exec_GetMaterialiv( GLenum face
, GLenum pname
, GLint
*params
)
5286 GET_CURRENT_CONTEXT(ctx
);
5287 FLUSH_VERTICES(ctx
, 0);
5288 ctx
->Exec
->GetMaterialiv( face
, pname
, params
);
5291 static void exec_GetPixelMapfv( GLenum map
, GLfloat
*values
)
5293 GET_CURRENT_CONTEXT(ctx
);
5294 FLUSH_VERTICES(ctx
, 0);
5295 ctx
->Exec
->GetPixelMapfv( map
, values
);
5298 static void exec_GetPixelMapuiv( GLenum map
, GLuint
*values
)
5300 GET_CURRENT_CONTEXT(ctx
);
5301 FLUSH_VERTICES(ctx
, 0);
5302 ctx
->Exec
->GetPixelMapuiv( map
, values
);
5305 static void exec_GetPixelMapusv( GLenum map
, GLushort
*values
)
5307 GET_CURRENT_CONTEXT(ctx
);
5308 FLUSH_VERTICES(ctx
, 0);
5309 ctx
->Exec
->GetPixelMapusv( map
, values
);
5312 static void exec_GetPolygonStipple( GLubyte
*dest
)
5314 GET_CURRENT_CONTEXT(ctx
);
5315 FLUSH_VERTICES(ctx
, 0);
5316 ctx
->Exec
->GetPolygonStipple( dest
);
5319 static const GLubyte
*exec_GetString( GLenum name
)
5321 GET_CURRENT_CONTEXT(ctx
);
5322 FLUSH_VERTICES(ctx
, 0);
5323 return ctx
->Exec
->GetString( name
);
5326 static void exec_GetTexEnvfv( GLenum target
, GLenum pname
, GLfloat
*params
)
5328 GET_CURRENT_CONTEXT(ctx
);
5329 FLUSH_VERTICES(ctx
, 0);
5330 ctx
->Exec
->GetTexEnvfv( target
, pname
, params
);
5333 static void exec_GetTexEnviv( GLenum target
, GLenum pname
, GLint
*params
)
5335 GET_CURRENT_CONTEXT(ctx
);
5336 FLUSH_VERTICES(ctx
, 0);
5337 ctx
->Exec
->GetTexEnviv( target
, pname
, params
);
5340 static void exec_GetTexGendv( GLenum coord
, GLenum pname
, GLdouble
*params
)
5342 GET_CURRENT_CONTEXT(ctx
);
5343 FLUSH_VERTICES(ctx
, 0);
5344 ctx
->Exec
->GetTexGendv( coord
, pname
, params
);
5347 static void exec_GetTexGenfv( GLenum coord
, GLenum pname
, GLfloat
*params
)
5349 GET_CURRENT_CONTEXT(ctx
);
5350 FLUSH_VERTICES(ctx
, 0);
5351 ctx
->Exec
->GetTexGenfv( coord
, pname
, params
);
5354 static void exec_GetTexGeniv( GLenum coord
, GLenum pname
, GLint
*params
)
5356 GET_CURRENT_CONTEXT(ctx
);
5357 FLUSH_VERTICES(ctx
, 0);
5358 ctx
->Exec
->GetTexGeniv( coord
, pname
, params
);
5361 static void exec_GetTexImage( GLenum target
, GLint level
, GLenum format
,
5362 GLenum type
, GLvoid
*pixels
)
5364 GET_CURRENT_CONTEXT(ctx
);
5365 FLUSH_VERTICES(ctx
, 0);
5366 ctx
->Exec
->GetTexImage( target
, level
, format
, type
, pixels
);
5369 static void exec_GetTexLevelParameterfv( GLenum target
, GLint level
,
5370 GLenum pname
, GLfloat
*params
)
5372 GET_CURRENT_CONTEXT(ctx
);
5373 FLUSH_VERTICES(ctx
, 0);
5374 ctx
->Exec
->GetTexLevelParameterfv( target
, level
, pname
, params
);
5377 static void exec_GetTexLevelParameteriv( GLenum target
, GLint level
,
5378 GLenum pname
, GLint
*params
)
5380 GET_CURRENT_CONTEXT(ctx
);
5381 FLUSH_VERTICES(ctx
, 0);
5382 ctx
->Exec
->GetTexLevelParameteriv( target
, level
, pname
, params
);
5385 static void exec_GetTexParameterfv( GLenum target
, GLenum pname
,
5388 GET_CURRENT_CONTEXT(ctx
);
5389 FLUSH_VERTICES(ctx
, 0);
5390 ctx
->Exec
->GetTexParameterfv( target
, pname
, params
);
5393 static void exec_GetTexParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
5395 GET_CURRENT_CONTEXT(ctx
);
5396 FLUSH_VERTICES(ctx
, 0);
5397 ctx
->Exec
->GetTexParameteriv( target
, pname
, params
);
5400 static GLboolean
exec_IsEnabled( GLenum cap
)
5402 GET_CURRENT_CONTEXT(ctx
);
5403 FLUSH_VERTICES(ctx
, 0);
5404 return ctx
->Exec
->IsEnabled( cap
);
5407 static void exec_PixelStoref( GLenum pname
, GLfloat param
)
5409 GET_CURRENT_CONTEXT(ctx
);
5410 FLUSH_VERTICES(ctx
, 0);
5411 ctx
->Exec
->PixelStoref( pname
, param
);
5414 static void exec_PixelStorei( GLenum pname
, GLint param
)
5416 GET_CURRENT_CONTEXT(ctx
);
5417 FLUSH_VERTICES(ctx
, 0);
5418 ctx
->Exec
->PixelStorei( pname
, param
);
5421 static void exec_ReadPixels( GLint x
, GLint y
, GLsizei width
, GLsizei height
,
5422 GLenum format
, GLenum type
, GLvoid
*pixels
)
5424 GET_CURRENT_CONTEXT(ctx
);
5425 FLUSH_VERTICES(ctx
, 0);
5426 ctx
->Exec
->ReadPixels( x
, y
, width
, height
, format
, type
, pixels
);
5429 static GLint
exec_RenderMode( GLenum mode
)
5431 GET_CURRENT_CONTEXT(ctx
);
5432 FLUSH_VERTICES(ctx
, 0);
5433 return ctx
->Exec
->RenderMode( mode
);
5436 static void exec_FeedbackBuffer( GLsizei size
, GLenum type
, GLfloat
*buffer
)
5438 GET_CURRENT_CONTEXT(ctx
);
5439 FLUSH_VERTICES(ctx
, 0);
5440 ctx
->Exec
->FeedbackBuffer( size
, type
, buffer
);
5443 static void exec_SelectBuffer( GLsizei size
, GLuint
*buffer
)
5445 GET_CURRENT_CONTEXT(ctx
);
5446 FLUSH_VERTICES(ctx
, 0);
5447 ctx
->Exec
->SelectBuffer( size
, buffer
);
5450 static GLboolean
exec_AreTexturesResident(GLsizei n
, const GLuint
*texName
,
5451 GLboolean
*residences
)
5453 GET_CURRENT_CONTEXT(ctx
);
5454 FLUSH_VERTICES(ctx
, 0);
5455 return ctx
->Exec
->AreTexturesResident( n
, texName
, residences
);
5458 static void exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
,
5461 GET_CURRENT_CONTEXT(ctx
);
5462 FLUSH_VERTICES(ctx
, 0);
5463 ctx
->Exec
->ColorPointer( size
, type
, stride
, ptr
);
5466 static void exec_DeleteTextures( GLsizei n
, const GLuint
*texName
)
5468 GET_CURRENT_CONTEXT(ctx
);
5469 FLUSH_VERTICES(ctx
, 0);
5470 ctx
->Exec
->DeleteTextures( n
, texName
);
5473 static void exec_DisableClientState( GLenum cap
)
5475 GET_CURRENT_CONTEXT(ctx
);
5476 FLUSH_VERTICES(ctx
, 0);
5477 ctx
->Exec
->DisableClientState( cap
);
5480 static void exec_EdgeFlagPointer(GLsizei stride
, const void *vptr
)
5482 GET_CURRENT_CONTEXT(ctx
);
5483 FLUSH_VERTICES(ctx
, 0);
5484 ctx
->Exec
->EdgeFlagPointer( stride
, vptr
);
5487 static void exec_EnableClientState( GLenum cap
)
5489 GET_CURRENT_CONTEXT(ctx
);
5490 FLUSH_VERTICES(ctx
, 0);
5491 ctx
->Exec
->EnableClientState( cap
);
5494 static void exec_GenTextures( GLsizei n
, GLuint
*texName
)
5496 GET_CURRENT_CONTEXT(ctx
);
5497 FLUSH_VERTICES(ctx
, 0);
5498 ctx
->Exec
->GenTextures( n
, texName
);
5501 static void exec_GetPointerv( GLenum pname
, GLvoid
**params
)
5503 GET_CURRENT_CONTEXT(ctx
);
5504 FLUSH_VERTICES(ctx
, 0);
5505 ctx
->Exec
->GetPointerv( pname
, params
);
5508 static void exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5510 GET_CURRENT_CONTEXT(ctx
);
5511 FLUSH_VERTICES(ctx
, 0);
5512 ctx
->Exec
->IndexPointer( type
, stride
, ptr
);
5515 static void exec_InterleavedArrays(GLenum format
, GLsizei stride
,
5516 const GLvoid
*pointer
)
5518 GET_CURRENT_CONTEXT(ctx
);
5519 FLUSH_VERTICES(ctx
, 0);
5520 ctx
->Exec
->InterleavedArrays( format
, stride
, pointer
);
5523 static GLboolean
exec_IsTexture( GLuint texture
)
5525 GET_CURRENT_CONTEXT(ctx
);
5526 FLUSH_VERTICES(ctx
, 0);
5527 return ctx
->Exec
->IsTexture( texture
);
5530 static void exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5532 GET_CURRENT_CONTEXT(ctx
);
5533 FLUSH_VERTICES(ctx
, 0);
5534 ctx
->Exec
->NormalPointer( type
, stride
, ptr
);
5537 static void exec_PopClientAttrib(void)
5539 GET_CURRENT_CONTEXT(ctx
);
5540 FLUSH_VERTICES(ctx
, 0);
5541 ctx
->Exec
->PopClientAttrib();
5544 static void exec_PushClientAttrib(GLbitfield mask
)
5546 GET_CURRENT_CONTEXT(ctx
);
5547 FLUSH_VERTICES(ctx
, 0);
5548 ctx
->Exec
->PushClientAttrib( mask
);
5551 static void exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
5554 GET_CURRENT_CONTEXT(ctx
);
5555 FLUSH_VERTICES(ctx
, 0);
5556 ctx
->Exec
->TexCoordPointer( size
, type
, stride
, ptr
);
5559 static void exec_GetCompressedTexImageARB(GLenum target
, GLint level
,
5562 GET_CURRENT_CONTEXT(ctx
);
5563 FLUSH_VERTICES(ctx
, 0);
5564 ctx
->Exec
->GetCompressedTexImageARB( target
, level
, img
);
5567 static void exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
5570 GET_CURRENT_CONTEXT(ctx
);
5571 FLUSH_VERTICES(ctx
, 0);
5572 ctx
->Exec
->VertexPointer( size
, type
, stride
, ptr
);
5575 static void exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
5576 GLint x
, GLint y
, GLsizei width
)
5578 GET_CURRENT_CONTEXT(ctx
);
5579 FLUSH_VERTICES(ctx
, 0);
5580 ctx
->Exec
->CopyConvolutionFilter1D( target
, internalFormat
, x
, y
, width
);
5583 static void exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
5584 GLint x
, GLint y
, GLsizei width
,
5587 GET_CURRENT_CONTEXT(ctx
);
5588 FLUSH_VERTICES(ctx
, 0);
5589 ctx
->Exec
->CopyConvolutionFilter2D( target
, internalFormat
, x
, y
, width
,
5593 static void exec_GetColorTable( GLenum target
, GLenum format
,
5594 GLenum type
, GLvoid
*data
)
5596 GET_CURRENT_CONTEXT(ctx
);
5597 FLUSH_VERTICES(ctx
, 0);
5598 ctx
->Exec
->GetColorTable( target
, format
, type
, data
);
5601 static void exec_GetColorTableParameterfv( GLenum target
, GLenum pname
,
5604 GET_CURRENT_CONTEXT(ctx
);
5605 FLUSH_VERTICES(ctx
, 0);
5606 ctx
->Exec
->GetColorTableParameterfv( target
, pname
, params
);
5609 static void exec_GetColorTableParameteriv( GLenum target
, GLenum pname
,
5612 GET_CURRENT_CONTEXT(ctx
);
5613 FLUSH_VERTICES(ctx
, 0);
5614 ctx
->Exec
->GetColorTableParameteriv( target
, pname
, params
);
5617 static void exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
5620 GET_CURRENT_CONTEXT(ctx
);
5621 FLUSH_VERTICES(ctx
, 0);
5622 ctx
->Exec
->GetConvolutionFilter( target
, format
, type
, image
);
5625 static void exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
,
5628 GET_CURRENT_CONTEXT(ctx
);
5629 FLUSH_VERTICES(ctx
, 0);
5630 ctx
->Exec
->GetConvolutionParameterfv( target
, pname
, params
);
5633 static void exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
,
5636 GET_CURRENT_CONTEXT(ctx
);
5637 FLUSH_VERTICES(ctx
, 0);
5638 ctx
->Exec
->GetConvolutionParameteriv( target
, pname
, params
);
5641 static void exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
5642 GLenum type
, GLvoid
*values
)
5644 GET_CURRENT_CONTEXT(ctx
);
5645 FLUSH_VERTICES(ctx
, 0);
5646 ctx
->Exec
->GetHistogram( target
, reset
, format
, type
, values
);
5649 static void exec_GetHistogramParameterfv(GLenum target
, GLenum pname
,
5652 GET_CURRENT_CONTEXT(ctx
);
5653 FLUSH_VERTICES(ctx
, 0);
5654 ctx
->Exec
->GetHistogramParameterfv( target
, pname
, params
);
5657 static void exec_GetHistogramParameteriv(GLenum target
, GLenum pname
,
5660 GET_CURRENT_CONTEXT(ctx
);
5661 FLUSH_VERTICES(ctx
, 0);
5662 ctx
->Exec
->GetHistogramParameteriv( target
, pname
, params
);
5665 static void exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
5666 GLenum type
, GLvoid
*values
)
5668 GET_CURRENT_CONTEXT(ctx
);
5669 FLUSH_VERTICES(ctx
, 0);
5670 ctx
->Exec
->GetMinmax( target
, reset
, format
, type
, values
);
5673 static void exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
,
5676 GET_CURRENT_CONTEXT(ctx
);
5677 FLUSH_VERTICES(ctx
, 0);
5678 ctx
->Exec
->GetMinmaxParameterfv( target
, pname
, params
);
5681 static void exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
,
5684 GET_CURRENT_CONTEXT(ctx
);
5685 FLUSH_VERTICES(ctx
, 0);
5686 ctx
->Exec
->GetMinmaxParameteriv( target
, pname
, params
);
5689 static void exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
5690 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
5692 GET_CURRENT_CONTEXT(ctx
);
5693 FLUSH_VERTICES(ctx
, 0);
5694 ctx
->Exec
->GetSeparableFilter( target
, format
, type
, row
, column
, span
);
5697 static void exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
5698 GLsizei width
, GLsizei height
, GLenum format
,
5699 GLenum type
, const GLvoid
*row
,
5700 const GLvoid
*column
)
5702 GET_CURRENT_CONTEXT(ctx
);
5703 FLUSH_VERTICES(ctx
, 0);
5704 ctx
->Exec
->SeparableFilter2D( target
, internalFormat
, width
, height
, format
,
5708 static void exec_GetPixelTexGenParameterivSGIS(GLenum target
, GLint
*value
)
5710 GET_CURRENT_CONTEXT(ctx
);
5711 FLUSH_VERTICES(ctx
, 0);
5712 ctx
->Exec
->GetPixelTexGenParameterivSGIS( target
, value
);
5715 static void exec_GetPixelTexGenParameterfvSGIS(GLenum target
, GLfloat
*value
)
5717 GET_CURRENT_CONTEXT(ctx
);
5718 FLUSH_VERTICES(ctx
, 0);
5719 ctx
->Exec
->GetPixelTexGenParameterfvSGIS( target
, value
);
5722 static void exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5723 GLsizei count
, const GLvoid
*ptr
)
5725 GET_CURRENT_CONTEXT(ctx
);
5726 FLUSH_VERTICES(ctx
, 0);
5727 ctx
->Exec
->ColorPointerEXT( size
, type
, stride
, count
, ptr
);
5730 static void exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
,
5731 const GLboolean
*ptr
)
5733 GET_CURRENT_CONTEXT(ctx
);
5734 FLUSH_VERTICES(ctx
, 0);
5735 ctx
->Exec
->EdgeFlagPointerEXT( stride
, count
, ptr
);
5738 static void exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
5741 GET_CURRENT_CONTEXT(ctx
);
5742 FLUSH_VERTICES(ctx
, 0);
5743 ctx
->Exec
->IndexPointerEXT( type
, stride
, count
, ptr
);
5746 static void exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
5749 GET_CURRENT_CONTEXT(ctx
);
5750 FLUSH_VERTICES(ctx
, 0);
5751 ctx
->Exec
->NormalPointerEXT( type
, stride
, count
, ptr
);
5754 static void exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5755 GLsizei count
, const GLvoid
*ptr
)
5757 GET_CURRENT_CONTEXT(ctx
);
5758 FLUSH_VERTICES(ctx
, 0);
5759 ctx
->Exec
->TexCoordPointerEXT( size
, type
, stride
, count
, ptr
);
5762 static void exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5763 GLsizei count
, const GLvoid
*ptr
)
5765 GET_CURRENT_CONTEXT(ctx
);
5766 FLUSH_VERTICES(ctx
, 0);
5767 ctx
->Exec
->VertexPointerEXT( size
, type
, stride
, count
, ptr
);
5770 static void exec_LockArraysEXT(GLint first
, GLsizei count
)
5772 GET_CURRENT_CONTEXT(ctx
);
5773 FLUSH_VERTICES(ctx
, 0);
5774 ctx
->Exec
->LockArraysEXT( first
, count
);
5777 static void exec_UnlockArraysEXT( void )
5779 GET_CURRENT_CONTEXT(ctx
);
5780 FLUSH_VERTICES(ctx
, 0);
5781 ctx
->Exec
->UnlockArraysEXT( );
5784 static void exec_ResizeBuffersMESA( void )
5786 GET_CURRENT_CONTEXT(ctx
);
5787 FLUSH_VERTICES(ctx
, 0);
5788 ctx
->Exec
->ResizeBuffersMESA( );
5792 static void exec_ClientActiveTextureARB( GLenum target
)
5794 GET_CURRENT_CONTEXT(ctx
);
5795 FLUSH_VERTICES(ctx
, 0);
5796 ctx
->Exec
->ClientActiveTextureARB(target
);
5799 static void exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
5800 GLsizei stride
, const GLvoid
*ptr
)
5802 GET_CURRENT_CONTEXT(ctx
);
5803 FLUSH_VERTICES(ctx
, 0);
5804 ctx
->Exec
->SecondaryColorPointerEXT( size
, type
, stride
, ptr
);
5807 static void exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
,
5810 GET_CURRENT_CONTEXT(ctx
);
5811 FLUSH_VERTICES(ctx
, 0);
5812 ctx
->Exec
->FogCoordPointerEXT( type
, stride
, ptr
);
5817 * Assign all the pointers in <table> to point to Mesa's display list
5818 * building functions.
5820 * This does not include any of the tnl functions - they are
5821 * initialized from _mesa_init_api_defaults and from the active vtxfmt
5825 _mesa_init_dlist_table( struct _glapi_table
*table
, GLuint tableSize
)
5827 _mesa_init_no_op_table(table
, tableSize
);
5829 _mesa_loopback_init_api_table( table
, GL_TRUE
);
5832 table
->Accum
= save_Accum
;
5833 table
->AlphaFunc
= save_AlphaFunc
;
5834 table
->Bitmap
= save_Bitmap
;
5835 table
->BlendFunc
= save_BlendFunc
;
5836 table
->CallList
= _mesa_save_CallList
;
5837 table
->CallLists
= _mesa_save_CallLists
;
5838 table
->Clear
= save_Clear
;
5839 table
->ClearAccum
= save_ClearAccum
;
5840 table
->ClearColor
= save_ClearColor
;
5841 table
->ClearDepth
= save_ClearDepth
;
5842 table
->ClearIndex
= save_ClearIndex
;
5843 table
->ClearStencil
= save_ClearStencil
;
5844 table
->ClipPlane
= save_ClipPlane
;
5845 table
->ColorMask
= save_ColorMask
;
5846 table
->ColorMaterial
= save_ColorMaterial
;
5847 table
->CopyPixels
= save_CopyPixels
;
5848 table
->CullFace
= save_CullFace
;
5849 table
->DeleteLists
= _mesa_DeleteLists
;
5850 table
->DepthFunc
= save_DepthFunc
;
5851 table
->DepthMask
= save_DepthMask
;
5852 table
->DepthRange
= save_DepthRange
;
5853 table
->Disable
= save_Disable
;
5854 table
->DrawBuffer
= save_DrawBuffer
;
5855 table
->DrawPixels
= save_DrawPixels
;
5856 table
->Enable
= save_Enable
;
5857 table
->EndList
= _mesa_EndList
;
5858 table
->EvalMesh1
= _mesa_save_EvalMesh1
;
5859 table
->EvalMesh2
= _mesa_save_EvalMesh2
;
5860 table
->Finish
= exec_Finish
;
5861 table
->Flush
= exec_Flush
;
5862 table
->Fogf
= save_Fogf
;
5863 table
->Fogfv
= save_Fogfv
;
5864 table
->Fogi
= save_Fogi
;
5865 table
->Fogiv
= save_Fogiv
;
5866 table
->FrontFace
= save_FrontFace
;
5867 table
->Frustum
= save_Frustum
;
5868 table
->GenLists
= _mesa_GenLists
;
5869 table
->GetBooleanv
= exec_GetBooleanv
;
5870 table
->GetClipPlane
= exec_GetClipPlane
;
5871 table
->GetDoublev
= exec_GetDoublev
;
5872 table
->GetError
= exec_GetError
;
5873 table
->GetFloatv
= exec_GetFloatv
;
5874 table
->GetIntegerv
= exec_GetIntegerv
;
5875 table
->GetLightfv
= exec_GetLightfv
;
5876 table
->GetLightiv
= exec_GetLightiv
;
5877 table
->GetMapdv
= exec_GetMapdv
;
5878 table
->GetMapfv
= exec_GetMapfv
;
5879 table
->GetMapiv
= exec_GetMapiv
;
5880 table
->GetMaterialfv
= exec_GetMaterialfv
;
5881 table
->GetMaterialiv
= exec_GetMaterialiv
;
5882 table
->GetPixelMapfv
= exec_GetPixelMapfv
;
5883 table
->GetPixelMapuiv
= exec_GetPixelMapuiv
;
5884 table
->GetPixelMapusv
= exec_GetPixelMapusv
;
5885 table
->GetPolygonStipple
= exec_GetPolygonStipple
;
5886 table
->GetString
= exec_GetString
;
5887 table
->GetTexEnvfv
= exec_GetTexEnvfv
;
5888 table
->GetTexEnviv
= exec_GetTexEnviv
;
5889 table
->GetTexGendv
= exec_GetTexGendv
;
5890 table
->GetTexGenfv
= exec_GetTexGenfv
;
5891 table
->GetTexGeniv
= exec_GetTexGeniv
;
5892 table
->GetTexImage
= exec_GetTexImage
;
5893 table
->GetTexLevelParameterfv
= exec_GetTexLevelParameterfv
;
5894 table
->GetTexLevelParameteriv
= exec_GetTexLevelParameteriv
;
5895 table
->GetTexParameterfv
= exec_GetTexParameterfv
;
5896 table
->GetTexParameteriv
= exec_GetTexParameteriv
;
5897 table
->Hint
= save_Hint
;
5898 table
->IndexMask
= save_IndexMask
;
5899 table
->InitNames
= save_InitNames
;
5900 table
->IsEnabled
= exec_IsEnabled
;
5901 table
->IsList
= _mesa_IsList
;
5902 table
->LightModelf
= save_LightModelf
;
5903 table
->LightModelfv
= save_LightModelfv
;
5904 table
->LightModeli
= save_LightModeli
;
5905 table
->LightModeliv
= save_LightModeliv
;
5906 table
->Lightf
= save_Lightf
;
5907 table
->Lightfv
= save_Lightfv
;
5908 table
->Lighti
= save_Lighti
;
5909 table
->Lightiv
= save_Lightiv
;
5910 table
->LineStipple
= save_LineStipple
;
5911 table
->LineWidth
= save_LineWidth
;
5912 table
->ListBase
= save_ListBase
;
5913 table
->LoadIdentity
= save_LoadIdentity
;
5914 table
->LoadMatrixd
= save_LoadMatrixd
;
5915 table
->LoadMatrixf
= save_LoadMatrixf
;
5916 table
->LoadName
= save_LoadName
;
5917 table
->LogicOp
= save_LogicOp
;
5918 table
->Map1d
= save_Map1d
;
5919 table
->Map1f
= save_Map1f
;
5920 table
->Map2d
= save_Map2d
;
5921 table
->Map2f
= save_Map2f
;
5922 table
->MapGrid1d
= save_MapGrid1d
;
5923 table
->MapGrid1f
= save_MapGrid1f
;
5924 table
->MapGrid2d
= save_MapGrid2d
;
5925 table
->MapGrid2f
= save_MapGrid2f
;
5926 table
->MatrixMode
= save_MatrixMode
;
5927 table
->MultMatrixd
= save_MultMatrixd
;
5928 table
->MultMatrixf
= save_MultMatrixf
;
5929 table
->NewList
= save_NewList
;
5930 table
->Ortho
= save_Ortho
;
5931 table
->PassThrough
= save_PassThrough
;
5932 table
->PixelMapfv
= save_PixelMapfv
;
5933 table
->PixelMapuiv
= save_PixelMapuiv
;
5934 table
->PixelMapusv
= save_PixelMapusv
;
5935 table
->PixelStoref
= exec_PixelStoref
;
5936 table
->PixelStorei
= exec_PixelStorei
;
5937 table
->PixelTransferf
= save_PixelTransferf
;
5938 table
->PixelTransferi
= save_PixelTransferi
;
5939 table
->PixelZoom
= save_PixelZoom
;
5940 table
->PointSize
= save_PointSize
;
5941 table
->PolygonMode
= save_PolygonMode
;
5942 table
->PolygonOffset
= save_PolygonOffset
;
5943 table
->PolygonStipple
= save_PolygonStipple
;
5944 table
->PopAttrib
= save_PopAttrib
;
5945 table
->PopMatrix
= save_PopMatrix
;
5946 table
->PopName
= save_PopName
;
5947 table
->PushAttrib
= save_PushAttrib
;
5948 table
->PushMatrix
= save_PushMatrix
;
5949 table
->PushName
= save_PushName
;
5950 table
->RasterPos2d
= save_RasterPos2d
;
5951 table
->RasterPos2dv
= save_RasterPos2dv
;
5952 table
->RasterPos2f
= save_RasterPos2f
;
5953 table
->RasterPos2fv
= save_RasterPos2fv
;
5954 table
->RasterPos2i
= save_RasterPos2i
;
5955 table
->RasterPos2iv
= save_RasterPos2iv
;
5956 table
->RasterPos2s
= save_RasterPos2s
;
5957 table
->RasterPos2sv
= save_RasterPos2sv
;
5958 table
->RasterPos3d
= save_RasterPos3d
;
5959 table
->RasterPos3dv
= save_RasterPos3dv
;
5960 table
->RasterPos3f
= save_RasterPos3f
;
5961 table
->RasterPos3fv
= save_RasterPos3fv
;
5962 table
->RasterPos3i
= save_RasterPos3i
;
5963 table
->RasterPos3iv
= save_RasterPos3iv
;
5964 table
->RasterPos3s
= save_RasterPos3s
;
5965 table
->RasterPos3sv
= save_RasterPos3sv
;
5966 table
->RasterPos4d
= save_RasterPos4d
;
5967 table
->RasterPos4dv
= save_RasterPos4dv
;
5968 table
->RasterPos4f
= save_RasterPos4f
;
5969 table
->RasterPos4fv
= save_RasterPos4fv
;
5970 table
->RasterPos4i
= save_RasterPos4i
;
5971 table
->RasterPos4iv
= save_RasterPos4iv
;
5972 table
->RasterPos4s
= save_RasterPos4s
;
5973 table
->RasterPos4sv
= save_RasterPos4sv
;
5974 table
->ReadBuffer
= save_ReadBuffer
;
5975 table
->ReadPixels
= exec_ReadPixels
;
5976 table
->RenderMode
= exec_RenderMode
;
5977 table
->Rotated
= save_Rotated
;
5978 table
->Rotatef
= save_Rotatef
;
5979 table
->Scaled
= save_Scaled
;
5980 table
->Scalef
= save_Scalef
;
5981 table
->Scissor
= save_Scissor
;
5982 table
->FeedbackBuffer
= exec_FeedbackBuffer
;
5983 table
->SelectBuffer
= exec_SelectBuffer
;
5984 table
->ShadeModel
= save_ShadeModel
;
5985 table
->StencilFunc
= save_StencilFunc
;
5986 table
->StencilMask
= save_StencilMask
;
5987 table
->StencilOp
= save_StencilOp
;
5988 table
->TexEnvf
= save_TexEnvf
;
5989 table
->TexEnvfv
= save_TexEnvfv
;
5990 table
->TexEnvi
= save_TexEnvi
;
5991 table
->TexEnviv
= save_TexEnviv
;
5992 table
->TexGend
= save_TexGend
;
5993 table
->TexGendv
= save_TexGendv
;
5994 table
->TexGenf
= save_TexGenf
;
5995 table
->TexGenfv
= save_TexGenfv
;
5996 table
->TexGeni
= save_TexGeni
;
5997 table
->TexGeniv
= save_TexGeniv
;
5998 table
->TexImage1D
= save_TexImage1D
;
5999 table
->TexImage2D
= save_TexImage2D
;
6000 table
->TexParameterf
= save_TexParameterf
;
6001 table
->TexParameterfv
= save_TexParameterfv
;
6002 table
->TexParameteri
= save_TexParameteri
;
6003 table
->TexParameteriv
= save_TexParameteriv
;
6004 table
->Translated
= save_Translated
;
6005 table
->Translatef
= save_Translatef
;
6006 table
->Viewport
= save_Viewport
;
6009 table
->AreTexturesResident
= exec_AreTexturesResident
;
6010 table
->BindTexture
= save_BindTexture
;
6011 table
->ColorPointer
= exec_ColorPointer
;
6012 table
->CopyTexImage1D
= save_CopyTexImage1D
;
6013 table
->CopyTexImage2D
= save_CopyTexImage2D
;
6014 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
6015 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
6016 table
->DeleteTextures
= exec_DeleteTextures
;
6017 table
->DisableClientState
= exec_DisableClientState
;
6018 table
->EdgeFlagPointer
= exec_EdgeFlagPointer
;
6019 table
->EnableClientState
= exec_EnableClientState
;
6020 table
->GenTextures
= exec_GenTextures
;
6021 table
->GetPointerv
= exec_GetPointerv
;
6022 table
->IndexPointer
= exec_IndexPointer
;
6023 table
->InterleavedArrays
= exec_InterleavedArrays
;
6024 table
->IsTexture
= exec_IsTexture
;
6025 table
->NormalPointer
= exec_NormalPointer
;
6026 table
->PopClientAttrib
= exec_PopClientAttrib
;
6027 table
->PrioritizeTextures
= save_PrioritizeTextures
;
6028 table
->PushClientAttrib
= exec_PushClientAttrib
;
6029 table
->TexCoordPointer
= exec_TexCoordPointer
;
6030 table
->TexSubImage1D
= save_TexSubImage1D
;
6031 table
->TexSubImage2D
= save_TexSubImage2D
;
6032 table
->VertexPointer
= exec_VertexPointer
;
6035 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
6036 table
->TexImage3D
= save_TexImage3D
;
6037 table
->TexSubImage3D
= save_TexSubImage3D
;
6039 /* GL_ARB_imaging */
6040 /* Not all are supported */
6041 table
->BlendColor
= save_BlendColor
;
6042 table
->BlendEquation
= save_BlendEquation
;
6043 table
->ColorSubTable
= save_ColorSubTable
;
6044 table
->ColorTable
= save_ColorTable
;
6045 table
->ColorTableParameterfv
= save_ColorTableParameterfv
;
6046 table
->ColorTableParameteriv
= save_ColorTableParameteriv
;
6047 table
->ConvolutionFilter1D
= save_ConvolutionFilter1D
;
6048 table
->ConvolutionFilter2D
= save_ConvolutionFilter2D
;
6049 table
->ConvolutionParameterf
= save_ConvolutionParameterf
;
6050 table
->ConvolutionParameterfv
= save_ConvolutionParameterfv
;
6051 table
->ConvolutionParameteri
= save_ConvolutionParameteri
;
6052 table
->ConvolutionParameteriv
= save_ConvolutionParameteriv
;
6053 table
->CopyColorSubTable
= save_CopyColorSubTable
;
6054 table
->CopyColorTable
= save_CopyColorTable
;
6055 table
->CopyConvolutionFilter1D
= exec_CopyConvolutionFilter1D
;
6056 table
->CopyConvolutionFilter2D
= exec_CopyConvolutionFilter2D
;
6057 table
->GetColorTable
= exec_GetColorTable
;
6058 table
->GetColorTableParameterfv
= exec_GetColorTableParameterfv
;
6059 table
->GetColorTableParameteriv
= exec_GetColorTableParameteriv
;
6060 table
->GetConvolutionFilter
= exec_GetConvolutionFilter
;
6061 table
->GetConvolutionParameterfv
= exec_GetConvolutionParameterfv
;
6062 table
->GetConvolutionParameteriv
= exec_GetConvolutionParameteriv
;
6063 table
->GetHistogram
= exec_GetHistogram
;
6064 table
->GetHistogramParameterfv
= exec_GetHistogramParameterfv
;
6065 table
->GetHistogramParameteriv
= exec_GetHistogramParameteriv
;
6066 table
->GetMinmax
= exec_GetMinmax
;
6067 table
->GetMinmaxParameterfv
= exec_GetMinmaxParameterfv
;
6068 table
->GetMinmaxParameteriv
= exec_GetMinmaxParameteriv
;
6069 table
->GetSeparableFilter
= exec_GetSeparableFilter
;
6070 table
->Histogram
= save_Histogram
;
6071 table
->Minmax
= save_Minmax
;
6072 table
->ResetHistogram
= save_ResetHistogram
;
6073 table
->ResetMinmax
= save_ResetMinmax
;
6074 table
->SeparableFilter2D
= exec_SeparableFilter2D
;
6076 /* 2. GL_EXT_blend_color */
6078 table
->BlendColorEXT
= save_BlendColorEXT
;
6081 /* 3. GL_EXT_polygon_offset */
6082 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
6084 /* 6. GL_EXT_texture3d */
6086 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
6087 table
->TexImage3DEXT
= save_TexImage3DEXT
;
6088 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
6091 /* 15. GL_SGIX_pixel_texture */
6092 table
->PixelTexGenSGIX
= save_PixelTexGenSGIX
;
6094 /* 15. GL_SGIS_pixel_texture */
6095 table
->PixelTexGenParameteriSGIS
= save_PixelTexGenParameteriSGIS
;
6096 table
->PixelTexGenParameterfSGIS
= save_PixelTexGenParameterfSGIS
;
6097 table
->PixelTexGenParameterivSGIS
= save_PixelTexGenParameterivSGIS
;
6098 table
->PixelTexGenParameterfvSGIS
= save_PixelTexGenParameterfvSGIS
;
6099 table
->GetPixelTexGenParameterivSGIS
= exec_GetPixelTexGenParameterivSGIS
;
6100 table
->GetPixelTexGenParameterfvSGIS
= exec_GetPixelTexGenParameterfvSGIS
;
6102 /* 30. GL_EXT_vertex_array */
6103 table
->ColorPointerEXT
= exec_ColorPointerEXT
;
6104 table
->EdgeFlagPointerEXT
= exec_EdgeFlagPointerEXT
;
6105 table
->IndexPointerEXT
= exec_IndexPointerEXT
;
6106 table
->NormalPointerEXT
= exec_NormalPointerEXT
;
6107 table
->TexCoordPointerEXT
= exec_TexCoordPointerEXT
;
6108 table
->VertexPointerEXT
= exec_VertexPointerEXT
;
6110 /* 37. GL_EXT_blend_minmax */
6112 table
->BlendEquationEXT
= save_BlendEquationEXT
;
6115 /* 54. GL_EXT_point_parameters */
6116 table
->PointParameterfEXT
= save_PointParameterfEXT
;
6117 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
6119 /* 78. GL_EXT_paletted_texture */
6121 table
->ColorTableEXT
= save_ColorTable
;
6122 table
->ColorSubTableEXT
= save_ColorSubTable
;
6124 table
->GetColorTableEXT
= exec_GetColorTable
;
6125 table
->GetColorTableParameterfvEXT
= exec_GetColorTableParameterfv
;
6126 table
->GetColorTableParameterivEXT
= exec_GetColorTableParameteriv
;
6128 /* 97. GL_EXT_compiled_vertex_array */
6129 table
->LockArraysEXT
= exec_LockArraysEXT
;
6130 table
->UnlockArraysEXT
= exec_UnlockArraysEXT
;
6132 /* 145. GL_EXT_secondary_color */
6133 table
->SecondaryColorPointerEXT
= exec_SecondaryColorPointerEXT
;
6135 /* 149. GL_EXT_fog_coord */
6136 table
->FogCoordPointerEXT
= exec_FogCoordPointerEXT
;
6138 /* 173. GL_EXT_blend_func_separate */
6139 table
->BlendFuncSeparateEXT
= save_BlendFuncSeparateEXT
;
6141 /* 196. GL_MESA_resize_buffers */
6142 table
->ResizeBuffersMESA
= exec_ResizeBuffersMESA
;
6144 /* 197. GL_MESA_window_pos */
6145 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
6146 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
6147 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
6148 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
6149 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
6150 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
6151 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
6152 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
6153 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
6154 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
6155 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
6156 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
6157 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
6158 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
6159 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
6160 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
6161 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
6162 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
6163 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
6164 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
6165 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
6166 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
6167 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
6168 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
6170 /* 233. GL_NV_vertex_program */
6171 /* XXX Need to implement vertex program in display lists !!! */
6172 /* The following commands DO NOT go into display lists:
6173 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
6174 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
6176 table
->BindProgramNV
= save_BindProgramNV
;
6177 table
->DeleteProgramsNV
= _mesa_DeleteProgramsNV
;
6178 table
->ExecuteProgramNV
= save_ExecuteProgramNV
;
6179 table
->GenProgramsNV
= _mesa_GenProgramsNV
;
6180 table
->AreProgramsResidentNV
= _mesa_AreProgramsResidentNV
;
6181 table
->RequestResidentProgramsNV
= _mesa_RequestResidentProgramsNV
;
6182 table
->GetProgramParameterfvNV
= _mesa_GetProgramParameterfvNV
;
6183 table
->GetProgramParameterdvNV
= _mesa_GetProgramParameterdvNV
;
6184 table
->GetProgramivNV
= _mesa_GetProgramivNV
;
6185 table
->GetProgramStringNV
= _mesa_GetProgramStringNV
;
6186 table
->GetTrackMatrixivNV
= _mesa_GetTrackMatrixivNV
;
6187 table
->GetVertexAttribdvNV
= _mesa_GetVertexAttribdvNV
;
6188 table
->GetVertexAttribfvNV
= _mesa_GetVertexAttribfvNV
;
6189 table
->GetVertexAttribivNV
= _mesa_GetVertexAttribivNV
;
6190 table
->GetVertexAttribPointervNV
= _mesa_GetVertexAttribPointervNV
;
6191 table
->IsProgramNV
= _mesa_IsProgramNV
;
6192 table
->LoadProgramNV
= _mesa_LoadProgramNV
;
6193 table
->ProgramParameter4dNV
= save_ProgramParameter4dNV
;
6194 table
->ProgramParameter4dvNV
= save_ProgramParameter4dvNV
;
6195 table
->ProgramParameter4fNV
= save_ProgramParameter4fNV
;
6196 table
->ProgramParameter4fvNV
= save_ProgramParameter4fvNV
;
6197 table
->ProgramParameters4dvNV
= _mesa_ProgramParameters4dvNV
;
6198 table
->ProgramParameters4fvNV
= _mesa_ProgramParameters4fvNV
;
6199 table
->TrackMatrixNV
= save_TrackMatrixNV
;
6200 table
->VertexAttribPointerNV
= _mesa_VertexAttribPointerNV
;
6202 /* ARB 1. GL_ARB_multitexture */
6203 table
->ActiveTextureARB
= save_ActiveTextureARB
;
6204 table
->ClientActiveTextureARB
= exec_ClientActiveTextureARB
;
6206 /* ARB 3. GL_ARB_transpose_matrix */
6207 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
6208 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
6209 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
6210 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
6212 /* ARB 5. GL_ARB_multisample */
6213 table
->SampleCoverageARB
= save_SampleCoverageARB
;
6215 /* ARB 12. GL_ARB_texture_compression */
6216 table
->CompressedTexImage3DARB
= save_CompressedTexImage3DARB
;
6217 table
->CompressedTexImage2DARB
= save_CompressedTexImage2DARB
;
6218 table
->CompressedTexImage1DARB
= save_CompressedTexImage1DARB
;
6219 table
->CompressedTexSubImage3DARB
= save_CompressedTexSubImage3DARB
;
6220 table
->CompressedTexSubImage2DARB
= save_CompressedTexSubImage2DARB
;
6221 table
->CompressedTexSubImage1DARB
= save_CompressedTexSubImage1DARB
;
6222 table
->GetCompressedTexImageARB
= exec_GetCompressedTexImageARB
;
6224 /* ARB 14. GL_ARB_point_parameters */
6225 /* re-use EXT_point_parameters functions */
6227 /* ARB 25. GL_ARB_window_pos */
6228 table
->WindowPos2dARB
= save_WindowPos2dARB
;
6229 table
->WindowPos2dvARB
= save_WindowPos2dvARB
;
6230 table
->WindowPos2fARB
= save_WindowPos2fARB
;
6231 table
->WindowPos2fvARB
= save_WindowPos2fvARB
;
6232 table
->WindowPos2iARB
= save_WindowPos2iARB
;
6233 table
->WindowPos2ivARB
= save_WindowPos2ivARB
;
6234 table
->WindowPos2sARB
= save_WindowPos2sARB
;
6235 table
->WindowPos2svARB
= save_WindowPos2svARB
;
6236 table
->WindowPos3dARB
= save_WindowPos3dARB
;
6237 table
->WindowPos3dvARB
= save_WindowPos3dvARB
;
6238 table
->WindowPos3fARB
= save_WindowPos3fARB
;
6239 table
->WindowPos3fvARB
= save_WindowPos3fvARB
;
6240 table
->WindowPos3iARB
= save_WindowPos3iARB
;
6241 table
->WindowPos3ivARB
= save_WindowPos3ivARB
;
6242 table
->WindowPos3sARB
= save_WindowPos3sARB
;
6243 table
->WindowPos3svARB
= save_WindowPos3svARB
;
6251 static const char *enum_string( GLenum k
)
6253 return _mesa_lookup_enum_by_nr( k
);
6258 * Print the commands in a display list. For debugging only.
6259 * TODO: many commands aren't handled yet.
6261 static void print_list( GLcontext
*ctx
, FILE *f
, GLuint list
)
6266 if (!glIsList(list
)) {
6267 fprintf(f
,"%u is not a display list ID\n",list
);
6271 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
6273 fprintf( f
, "START-LIST %u, address %p\n", list
, (void*)n
);
6275 done
= n
? GL_FALSE
: GL_TRUE
;
6277 OpCode opcode
= n
[0].opcode
;
6278 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_DRV_0
;
6280 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
6281 ctx
->listext
.opcode
[i
].print(ctx
, &n
[1]);
6282 n
+= ctx
->listext
.opcode
[i
].size
;
6287 fprintf(f
,"accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
6290 fprintf(f
,"Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
6291 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
6293 case OPCODE_CALL_LIST
:
6294 fprintf(f
,"CallList %d\n", (int) n
[1].ui
);
6296 case OPCODE_CALL_LIST_OFFSET
:
6297 fprintf(f
,"CallList %d + offset %u = %u\n", (int) n
[1].ui
,
6298 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
6300 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
6301 fprintf(f
,"ColorTableParameterfv %s %s %f %f %f %f\n",
6302 enum_string(n
[1].e
), enum_string(n
[2].e
),
6303 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6305 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
6306 fprintf(f
,"ColorTableParameteriv %s %s %d %d %d %d\n",
6307 enum_string(n
[1].e
), enum_string(n
[2].e
),
6308 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
6310 case OPCODE_DISABLE
:
6311 fprintf(f
,"Disable %s\n", enum_string(n
[1].e
));
6314 fprintf(f
,"Enable %s\n", enum_string(n
[1].e
));
6316 case OPCODE_FRUSTUM
:
6317 fprintf(f
,"Frustum %g %g %g %g %g %g\n",
6318 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6320 case OPCODE_LINE_STIPPLE
:
6321 fprintf(f
,"LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
6323 case OPCODE_LOAD_IDENTITY
:
6324 fprintf(f
,"LoadIdentity\n");
6326 case OPCODE_LOAD_MATRIX
:
6327 fprintf(f
,"LoadMatrix\n");
6328 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
6329 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
6330 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
6331 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
6333 case OPCODE_MULT_MATRIX
:
6334 fprintf(f
,"MultMatrix (or Rotate)\n");
6335 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
6336 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
6337 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
6338 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
6341 fprintf(f
,"Ortho %g %g %g %g %g %g\n",
6342 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6344 case OPCODE_POP_ATTRIB
:
6345 fprintf(f
,"PopAttrib\n");
6347 case OPCODE_POP_MATRIX
:
6348 fprintf(f
,"PopMatrix\n");
6350 case OPCODE_POP_NAME
:
6351 fprintf(f
,"PopName\n");
6353 case OPCODE_PUSH_ATTRIB
:
6354 fprintf(f
,"PushAttrib %x\n", n
[1].bf
);
6356 case OPCODE_PUSH_MATRIX
:
6357 fprintf(f
,"PushMatrix\n");
6359 case OPCODE_PUSH_NAME
:
6360 fprintf(f
,"PushName %d\n", (int) n
[1].ui
);
6362 case OPCODE_RASTER_POS
:
6363 fprintf(f
,"RasterPos %g %g %g %g\n", n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
6366 fprintf(f
,"Rotate %g %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6369 fprintf(f
,"Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
6371 case OPCODE_TRANSLATE
:
6372 fprintf(f
,"Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
6374 case OPCODE_BIND_TEXTURE
:
6375 fprintf(f
,"BindTexture %s %d\n", _mesa_lookup_enum_by_nr(n
[1].ui
),
6378 case OPCODE_SHADE_MODEL
:
6379 fprintf(f
,"ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
6382 fprintf(f
,"Map1 %s %.3f %.3f %d %d\n",
6383 _mesa_lookup_enum_by_nr(n
[1].ui
),
6384 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
6387 fprintf(f
,"Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
6388 _mesa_lookup_enum_by_nr(n
[1].ui
),
6389 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
6390 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
6392 case OPCODE_MAPGRID1
:
6393 fprintf(f
,"MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
6395 case OPCODE_MAPGRID2
:
6396 fprintf(f
,"MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
6397 n
[1].i
, n
[2].f
, n
[3].f
,
6398 n
[4].i
, n
[5].f
, n
[6].f
);
6400 case OPCODE_EVALMESH1
:
6401 fprintf(f
,"EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
6403 case OPCODE_EVALMESH2
:
6404 fprintf(f
,"EvalMesh2 %d %d %d %d\n",
6405 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
6409 * meta opcodes/commands
6412 fprintf(f
,"Error: %s %s\n", enum_string(n
[1].e
), (const char *)n
[2].data
);
6414 case OPCODE_CONTINUE
:
6415 fprintf(f
,"DISPLAY-LIST-CONTINUE\n");
6416 n
= (Node
*) n
[1].next
;
6418 case OPCODE_END_OF_LIST
:
6419 fprintf(f
,"END-LIST %u\n", list
);
6423 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
6424 fprintf(f
,"ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
6429 fprintf(f
,"command %d, %u operands\n",opcode
,InstSize
[opcode
]);
6432 /* increment n to point to next compiled command */
6433 if (opcode
!=OPCODE_CONTINUE
) {
6434 n
+= InstSize
[opcode
];
6443 * Clients may call this function to help debug display list problems.
6444 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
6445 * changed, or break in the future without notice.
6447 void mesa_print_display_list( GLuint list
)
6449 GET_CURRENT_CONTEXT(ctx
);
6450 print_list( ctx
, stderr
, list
);