1 /* $Id: dlist.c,v 1.102 2003/01/21 21:47:48 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2002 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.
29 #include "api_loopback.h"
43 #include "extensions.h"
48 #include "histogram.h"
64 #if FEATURE_NV_vertex_program
65 #include "nvprogram.h"
68 #include "math/m_matrix.h"
69 #include "math/m_xform.h"
74 Functions which aren't compiled but executed immediately:
78 glEndList --- BUT: call ctx->Driver.EndList at end of list execution?
89 Functions which cause errors if called while compiling a display list:
96 * Display list instructions are stored as sequences of "nodes". Nodes
97 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
98 * are linked together with a pointer.
102 /* How many nodes to allocate at a time:
103 * - reduced now that we hold vertices etc. elsewhere.
105 #define BLOCK_SIZE 256
109 * Display list opcodes.
111 * The fact that these identifiers are assigned consecutive
112 * integer values starting at 0 is very important, see InstSize array usage)
121 OPCODE_BLEND_EQUATION
,
123 OPCODE_BLEND_FUNC_SEPARATE
,
125 OPCODE_CALL_LIST_OFFSET
,
131 OPCODE_CLEAR_STENCIL
,
134 OPCODE_COLOR_MATERIAL
,
136 OPCODE_COLOR_TABLE_PARAMETER_FV
,
137 OPCODE_COLOR_TABLE_PARAMETER_IV
,
138 OPCODE_COLOR_SUB_TABLE
,
139 OPCODE_CONVOLUTION_FILTER_1D
,
140 OPCODE_CONVOLUTION_FILTER_2D
,
141 OPCODE_CONVOLUTION_PARAMETER_I
,
142 OPCODE_CONVOLUTION_PARAMETER_IV
,
143 OPCODE_CONVOLUTION_PARAMETER_F
,
144 OPCODE_CONVOLUTION_PARAMETER_FV
,
145 OPCODE_COPY_COLOR_SUB_TABLE
,
146 OPCODE_COPY_COLOR_TABLE
,
148 OPCODE_COPY_TEX_IMAGE1D
,
149 OPCODE_COPY_TEX_IMAGE2D
,
150 OPCODE_COPY_TEX_SUB_IMAGE1D
,
151 OPCODE_COPY_TEX_SUB_IMAGE2D
,
152 OPCODE_COPY_TEX_SUB_IMAGE3D
,
175 OPCODE_LOAD_IDENTITY
,
189 OPCODE_PIXEL_TRANSFER
,
192 OPCODE_POINT_PARAMETERS
,
194 OPCODE_POLYGON_STIPPLE
,
195 OPCODE_POLYGON_OFFSET
,
199 OPCODE_PRIORITIZE_TEXTURE
,
205 OPCODE_RESET_HISTOGRAM
,
206 OPCODE_RESET_MIN_MAX
,
210 OPCODE_SELECT_TEXTURE_SGIS
,
211 OPCODE_SELECT_TEXTURE_COORD_SET
,
222 OPCODE_TEX_SUB_IMAGE1D
,
223 OPCODE_TEX_SUB_IMAGE2D
,
224 OPCODE_TEX_SUB_IMAGE3D
,
228 /* GL_ARB_multitexture */
229 OPCODE_ACTIVE_TEXTURE
,
230 /* GL_SGIX/SGIS_pixel_texture */
231 OPCODE_PIXEL_TEXGEN_SGIX
,
232 OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
,
233 /* GL_ARB_texture_compression */
234 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
235 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
236 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
237 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
238 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
239 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
240 /* GL_ARB_multisample */
241 OPCODE_SAMPLE_COVERAGE
,
242 /* GL_ARB_window_pos */
243 OPCODE_WINDOW_POS_ARB
,
244 /* GL_NV_vertex_program */
245 OPCODE_BIND_PROGRAM_NV
,
246 OPCODE_EXECUTE_PROGRAM_NV
,
247 OPCODE_REQUEST_PROGRAMS_RESIDENT_NV
,
248 OPCODE_LOAD_PROGRAM_NV
,
249 OPCODE_PROGRAM_PARAMETER4F_NV
,
250 OPCODE_TRACK_MATRIX_NV
,
251 /* GL_EXT_stencil_two_side */
252 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
253 /* The following three are meta instructions */
254 OPCODE_ERROR
, /* raise compiled-in error */
262 * Each instruction in the display list is stored as a sequence of
263 * contiguous nodes in memory.
264 * Each node is the union of a variety of datatypes.
278 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
283 /* Number of nodes of storage needed for each instruction. Sizes for
284 * dynamically allocated opcodes are stored in the context struct.
286 static GLuint InstSize
[ OPCODE_END_OF_LIST
+1 ];
288 void mesa_print_display_list( GLuint list
);
291 /**********************************************************************/
292 /***** Private *****/
293 /**********************************************************************/
300 * Make an empty display list. This is used by glGenLists() to
301 * reserver display list IDs.
303 static Node
*make_empty_list( void )
305 Node
*n
= (Node
*) MALLOC( sizeof(Node
) );
306 n
[0].opcode
= OPCODE_END_OF_LIST
;
313 * Destroy all nodes in a display list.
314 * Input: list - display list number
316 void _mesa_destroy_list( GLcontext
*ctx
, GLuint list
)
324 block
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
327 done
= block
? GL_FALSE
: GL_TRUE
;
330 /* check for extension opcodes first */
332 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_DRV_0
;
333 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
334 ctx
->listext
.opcode
[i
].destroy(ctx
, &n
[1]);
335 n
+= ctx
->listext
.opcode
[i
].size
;
338 switch (n
[0].opcode
) {
341 n
+= InstSize
[n
[0].opcode
];
345 n
+= InstSize
[n
[0].opcode
];
347 case OPCODE_DRAW_PIXELS
:
349 n
+= InstSize
[n
[0].opcode
];
353 n
+= InstSize
[n
[0].opcode
];
355 case OPCODE_COLOR_TABLE
:
357 n
+= InstSize
[n
[0].opcode
];
359 case OPCODE_COLOR_SUB_TABLE
:
361 n
+= InstSize
[n
[0].opcode
];
363 case OPCODE_CONVOLUTION_FILTER_1D
:
365 n
+= InstSize
[n
[0].opcode
];
367 case OPCODE_CONVOLUTION_FILTER_2D
:
369 n
+= InstSize
[n
[0].opcode
];
371 case OPCODE_POLYGON_STIPPLE
:
373 n
+= InstSize
[n
[0].opcode
];
375 case OPCODE_TEX_IMAGE1D
:
377 n
+= InstSize
[n
[0].opcode
];
379 case OPCODE_TEX_IMAGE2D
:
381 n
+= InstSize
[n
[0].opcode
];
383 case OPCODE_TEX_IMAGE3D
:
385 n
+= InstSize
[n
[0].opcode
];
387 case OPCODE_TEX_SUB_IMAGE1D
:
389 n
+= InstSize
[n
[0].opcode
];
391 case OPCODE_TEX_SUB_IMAGE2D
:
393 n
+= InstSize
[n
[0].opcode
];
395 case OPCODE_TEX_SUB_IMAGE3D
:
397 n
+= InstSize
[n
[0].opcode
];
399 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
401 n
+= InstSize
[n
[0].opcode
];
403 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
405 n
+= InstSize
[n
[0].opcode
];
407 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
409 n
+= InstSize
[n
[0].opcode
];
411 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
413 n
+= InstSize
[n
[0].opcode
];
415 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
417 n
+= InstSize
[n
[0].opcode
];
419 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
421 n
+= InstSize
[n
[0].opcode
];
423 case OPCODE_CONTINUE
:
424 n
= (Node
*) n
[1].next
;
428 case OPCODE_END_OF_LIST
:
433 /* Most frequent case */
434 n
+= InstSize
[n
[0].opcode
];
440 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
446 * Translate the nth element of list from type to GLuint.
448 static GLuint
translate_id( GLsizei n
, GLenum type
, const GLvoid
*list
)
460 bptr
= (GLbyte
*) list
;
461 return (GLuint
) *(bptr
+n
);
462 case GL_UNSIGNED_BYTE
:
463 ubptr
= (GLubyte
*) list
;
464 return (GLuint
) *(ubptr
+n
);
466 sptr
= (GLshort
*) list
;
467 return (GLuint
) *(sptr
+n
);
468 case GL_UNSIGNED_SHORT
:
469 usptr
= (GLushort
*) list
;
470 return (GLuint
) *(usptr
+n
);
472 iptr
= (GLint
*) list
;
473 return (GLuint
) *(iptr
+n
);
474 case GL_UNSIGNED_INT
:
475 uiptr
= (GLuint
*) list
;
476 return (GLuint
) *(uiptr
+n
);
478 fptr
= (GLfloat
*) list
;
479 return (GLuint
) *(fptr
+n
);
481 ubptr
= ((GLubyte
*) list
) + 2*n
;
482 return (GLuint
) *ubptr
* 256 + (GLuint
) *(ubptr
+1);
484 ubptr
= ((GLubyte
*) list
) + 3*n
;
485 return (GLuint
) *ubptr
* 65536
486 + (GLuint
) *(ubptr
+1) * 256
487 + (GLuint
) *(ubptr
+2);
489 ubptr
= ((GLubyte
*) list
) + 4*n
;
490 return (GLuint
) *ubptr
* 16777216
491 + (GLuint
) *(ubptr
+1) * 65536
492 + (GLuint
) *(ubptr
+2) * 256
493 + (GLuint
) *(ubptr
+3);
502 /**********************************************************************/
504 /**********************************************************************/
506 void _mesa_init_lists( void )
508 static int init_flag
= 0;
511 InstSize
[OPCODE_ACCUM
] = 3;
512 InstSize
[OPCODE_ALPHA_FUNC
] = 3;
513 InstSize
[OPCODE_BIND_TEXTURE
] = 3;
514 InstSize
[OPCODE_BITMAP
] = 8;
515 InstSize
[OPCODE_BLEND_COLOR
] = 5;
516 InstSize
[OPCODE_BLEND_EQUATION
] = 2;
517 InstSize
[OPCODE_BLEND_FUNC
] = 3;
518 InstSize
[OPCODE_BLEND_FUNC_SEPARATE
] = 5;
519 InstSize
[OPCODE_CALL_LIST
] = 2;
520 InstSize
[OPCODE_CALL_LIST_OFFSET
] = 3;
521 InstSize
[OPCODE_CLEAR
] = 2;
522 InstSize
[OPCODE_CLEAR_ACCUM
] = 5;
523 InstSize
[OPCODE_CLEAR_COLOR
] = 5;
524 InstSize
[OPCODE_CLEAR_DEPTH
] = 2;
525 InstSize
[OPCODE_CLEAR_INDEX
] = 2;
526 InstSize
[OPCODE_CLEAR_STENCIL
] = 2;
527 InstSize
[OPCODE_CLIP_PLANE
] = 6;
528 InstSize
[OPCODE_COLOR_MASK
] = 5;
529 InstSize
[OPCODE_COLOR_MATERIAL
] = 3;
530 InstSize
[OPCODE_COLOR_TABLE
] = 7;
531 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_FV
] = 7;
532 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_IV
] = 7;
533 InstSize
[OPCODE_COLOR_SUB_TABLE
] = 7;
534 InstSize
[OPCODE_CONVOLUTION_FILTER_1D
] = 7;
535 InstSize
[OPCODE_CONVOLUTION_FILTER_2D
] = 8;
536 InstSize
[OPCODE_CONVOLUTION_PARAMETER_I
] = 4;
537 InstSize
[OPCODE_CONVOLUTION_PARAMETER_IV
] = 7;
538 InstSize
[OPCODE_CONVOLUTION_PARAMETER_F
] = 4;
539 InstSize
[OPCODE_CONVOLUTION_PARAMETER_FV
] = 7;
540 InstSize
[OPCODE_COPY_PIXELS
] = 6;
541 InstSize
[OPCODE_COPY_COLOR_SUB_TABLE
] = 6;
542 InstSize
[OPCODE_COPY_COLOR_TABLE
] = 6;
543 InstSize
[OPCODE_COPY_TEX_IMAGE1D
] = 8;
544 InstSize
[OPCODE_COPY_TEX_IMAGE2D
] = 9;
545 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE1D
] = 7;
546 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE2D
] = 9;
547 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE3D
] = 10;
548 InstSize
[OPCODE_CULL_FACE
] = 2;
549 InstSize
[OPCODE_DEPTH_FUNC
] = 2;
550 InstSize
[OPCODE_DEPTH_MASK
] = 2;
551 InstSize
[OPCODE_DEPTH_RANGE
] = 3;
552 InstSize
[OPCODE_DISABLE
] = 2;
553 InstSize
[OPCODE_DRAW_BUFFER
] = 2;
554 InstSize
[OPCODE_DRAW_PIXELS
] = 6;
555 InstSize
[OPCODE_ENABLE
] = 2;
556 InstSize
[OPCODE_EVALMESH1
] = 4;
557 InstSize
[OPCODE_EVALMESH2
] = 6;
558 InstSize
[OPCODE_FOG
] = 6;
559 InstSize
[OPCODE_FRONT_FACE
] = 2;
560 InstSize
[OPCODE_FRUSTUM
] = 7;
561 InstSize
[OPCODE_HINT
] = 3;
562 InstSize
[OPCODE_HISTOGRAM
] = 5;
563 InstSize
[OPCODE_INDEX_MASK
] = 2;
564 InstSize
[OPCODE_INIT_NAMES
] = 1;
565 InstSize
[OPCODE_LIGHT
] = 7;
566 InstSize
[OPCODE_LIGHT_MODEL
] = 6;
567 InstSize
[OPCODE_LINE_STIPPLE
] = 3;
568 InstSize
[OPCODE_LINE_WIDTH
] = 2;
569 InstSize
[OPCODE_LIST_BASE
] = 2;
570 InstSize
[OPCODE_LOAD_IDENTITY
] = 1;
571 InstSize
[OPCODE_LOAD_MATRIX
] = 17;
572 InstSize
[OPCODE_LOAD_NAME
] = 2;
573 InstSize
[OPCODE_LOGIC_OP
] = 2;
574 InstSize
[OPCODE_MAP1
] = 7;
575 InstSize
[OPCODE_MAP2
] = 11;
576 InstSize
[OPCODE_MAPGRID1
] = 4;
577 InstSize
[OPCODE_MAPGRID2
] = 7;
578 InstSize
[OPCODE_MATRIX_MODE
] = 2;
579 InstSize
[OPCODE_MIN_MAX
] = 4;
580 InstSize
[OPCODE_MULT_MATRIX
] = 17;
581 InstSize
[OPCODE_ORTHO
] = 7;
582 InstSize
[OPCODE_PASSTHROUGH
] = 2;
583 InstSize
[OPCODE_PIXEL_MAP
] = 4;
584 InstSize
[OPCODE_PIXEL_TRANSFER
] = 3;
585 InstSize
[OPCODE_PIXEL_ZOOM
] = 3;
586 InstSize
[OPCODE_POINT_SIZE
] = 2;
587 InstSize
[OPCODE_POINT_PARAMETERS
] = 5;
588 InstSize
[OPCODE_POLYGON_MODE
] = 3;
589 InstSize
[OPCODE_POLYGON_STIPPLE
] = 2;
590 InstSize
[OPCODE_POLYGON_OFFSET
] = 3;
591 InstSize
[OPCODE_POP_ATTRIB
] = 1;
592 InstSize
[OPCODE_POP_MATRIX
] = 1;
593 InstSize
[OPCODE_POP_NAME
] = 1;
594 InstSize
[OPCODE_PRIORITIZE_TEXTURE
] = 3;
595 InstSize
[OPCODE_PUSH_ATTRIB
] = 2;
596 InstSize
[OPCODE_PUSH_MATRIX
] = 1;
597 InstSize
[OPCODE_PUSH_NAME
] = 2;
598 InstSize
[OPCODE_RASTER_POS
] = 5;
599 InstSize
[OPCODE_READ_BUFFER
] = 2;
600 InstSize
[OPCODE_RESET_HISTOGRAM
] = 2;
601 InstSize
[OPCODE_RESET_MIN_MAX
] = 2;
602 InstSize
[OPCODE_ROTATE
] = 5;
603 InstSize
[OPCODE_SCALE
] = 4;
604 InstSize
[OPCODE_SCISSOR
] = 5;
605 InstSize
[OPCODE_STENCIL_FUNC
] = 4;
606 InstSize
[OPCODE_STENCIL_MASK
] = 2;
607 InstSize
[OPCODE_STENCIL_OP
] = 4;
608 InstSize
[OPCODE_SHADE_MODEL
] = 2;
609 InstSize
[OPCODE_TEXENV
] = 7;
610 InstSize
[OPCODE_TEXGEN
] = 7;
611 InstSize
[OPCODE_TEXPARAMETER
] = 7;
612 InstSize
[OPCODE_TEX_IMAGE1D
] = 9;
613 InstSize
[OPCODE_TEX_IMAGE2D
] = 10;
614 InstSize
[OPCODE_TEX_IMAGE3D
] = 11;
615 InstSize
[OPCODE_TEX_SUB_IMAGE1D
] = 8;
616 InstSize
[OPCODE_TEX_SUB_IMAGE2D
] = 10;
617 InstSize
[OPCODE_TEX_SUB_IMAGE3D
] = 12;
618 InstSize
[OPCODE_TRANSLATE
] = 4;
619 InstSize
[OPCODE_VIEWPORT
] = 5;
620 InstSize
[OPCODE_WINDOW_POS
] = 5;
621 InstSize
[OPCODE_CONTINUE
] = 2;
622 InstSize
[OPCODE_ERROR
] = 3;
623 InstSize
[OPCODE_END_OF_LIST
] = 1;
624 /* GL_SGIX/SGIS_pixel_texture */
625 InstSize
[OPCODE_PIXEL_TEXGEN_SGIX
] = 2;
626 InstSize
[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
] = 3;
627 /* GL_ARB_texture_compression */
628 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_1D
] = 8;
629 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_2D
] = 9;
630 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_3D
] = 10;
631 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
] = 8;
632 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
] = 10;
633 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
] = 12;
634 /* GL_ARB_multisample */
635 InstSize
[OPCODE_SAMPLE_COVERAGE
] = 3;
636 /* GL_ARB_multitexture */
637 InstSize
[OPCODE_ACTIVE_TEXTURE
] = 2;
638 /* GL_ARB_window_pos */
639 InstSize
[OPCODE_WINDOW_POS_ARB
] = 4;
640 /* GL_NV_vertex_program */
641 InstSize
[OPCODE_BIND_PROGRAM_NV
] = 3;
642 InstSize
[OPCODE_EXECUTE_PROGRAM_NV
] = 7;
643 InstSize
[OPCODE_REQUEST_PROGRAMS_RESIDENT_NV
] = 2;
644 InstSize
[OPCODE_LOAD_PROGRAM_NV
] = 4;
645 InstSize
[OPCODE_PROGRAM_PARAMETER4F_NV
] = 7;
646 InstSize
[OPCODE_TRACK_MATRIX_NV
] = 5;
647 /* GL_EXT_stencil_two_side */
648 InstSize
[OPCODE_ACTIVE_STENCIL_FACE_EXT
] = 2;
655 * Allocate space for a display list instruction.
656 * Input: opcode - type of instruction
657 * argcount - size in bytes of data required.
658 * Return: pointer to the usable data area (not including the internal
662 _mesa_alloc_instruction( GLcontext
*ctx
, int opcode
, GLint sz
)
665 GLuint count
= 1 + (sz
+ sizeof(Node
) - 1) / sizeof(Node
);
668 if (opcode
< (int) OPCODE_DRV_0
) {
669 assert( count
== InstSize
[opcode
] );
673 if (ctx
->CurrentPos
+ count
+ 2 > BLOCK_SIZE
) {
674 /* This block is full. Allocate a new block and chain to it */
675 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
676 n
[0].opcode
= OPCODE_CONTINUE
;
677 newblock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
679 _mesa_error( ctx
, GL_OUT_OF_MEMORY
, "Building display list" );
682 n
[1].next
= (Node
*) newblock
;
683 ctx
->CurrentBlock
= newblock
;
687 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
688 ctx
->CurrentPos
+= count
;
690 n
[0].opcode
= (OpCode
) opcode
;
692 return (void *)&n
[1];
696 /* Allow modules and drivers to get their own opcodes.
699 _mesa_alloc_opcode( GLcontext
*ctx
,
701 void (*execute
)( GLcontext
*, void * ),
702 void (*destroy
)( GLcontext
*, void * ),
703 void (*print
)( GLcontext
*, void * ) )
705 if (ctx
->listext
.nr_opcodes
< GL_MAX_EXT_OPCODES
) {
706 GLuint i
= ctx
->listext
.nr_opcodes
++;
707 ctx
->listext
.opcode
[i
].size
= 1 + (sz
+ sizeof(Node
) - 1)/sizeof(Node
);
708 ctx
->listext
.opcode
[i
].execute
= execute
;
709 ctx
->listext
.opcode
[i
].destroy
= destroy
;
710 ctx
->listext
.opcode
[i
].print
= print
;
711 return i
+ OPCODE_DRV_0
;
718 /* Mimic the old behaviour of alloc_instruction:
719 * - sz is in units of sizeof(Node)
720 * - return value a pointer to sizeof(Node) before the actual
723 #define ALLOC_INSTRUCTION(ctx, opcode, sz) \
724 ((Node *)_mesa_alloc_instruction(ctx, opcode, sz*sizeof(Node)) - 1)
729 * Display List compilation functions
731 static void save_Accum( GLenum op
, GLfloat value
)
733 GET_CURRENT_CONTEXT(ctx
);
735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
736 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACCUM
, 2 );
741 if (ctx
->ExecuteFlag
) {
742 (*ctx
->Exec
->Accum
)( op
, value
);
747 static void save_AlphaFunc( GLenum func
, GLclampf ref
)
749 GET_CURRENT_CONTEXT(ctx
);
751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
752 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ALPHA_FUNC
, 2 );
755 n
[2].f
= (GLfloat
) ref
;
757 if (ctx
->ExecuteFlag
) {
758 (*ctx
->Exec
->AlphaFunc
)( func
, ref
);
763 static void save_BindTexture( GLenum target
, GLuint texture
)
765 GET_CURRENT_CONTEXT(ctx
);
767 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
768 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_TEXTURE
, 2 );
773 if (ctx
->ExecuteFlag
) {
774 (*ctx
->Exec
->BindTexture
)( target
, texture
);
779 static void save_Bitmap( GLsizei width
, GLsizei height
,
780 GLfloat xorig
, GLfloat yorig
,
781 GLfloat xmove
, GLfloat ymove
,
782 const GLubyte
*pixels
)
784 GET_CURRENT_CONTEXT(ctx
);
785 GLvoid
*image
= _mesa_unpack_bitmap( width
, height
, pixels
, &ctx
->Unpack
);
787 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
788 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BITMAP
, 7 );
790 n
[1].i
= (GLint
) width
;
791 n
[2].i
= (GLint
) height
;
801 if (ctx
->ExecuteFlag
) {
802 (*ctx
->Exec
->Bitmap
)( width
, height
,
803 xorig
, yorig
, xmove
, ymove
, pixels
);
808 static void save_BlendEquation( GLenum mode
)
810 GET_CURRENT_CONTEXT(ctx
);
812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
813 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_EQUATION
, 1 );
817 if (ctx
->ExecuteFlag
) {
818 (*ctx
->Exec
->BlendEquation
)( mode
);
823 static void save_BlendFunc( GLenum sfactor
, GLenum dfactor
)
825 GET_CURRENT_CONTEXT(ctx
);
827 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
828 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_FUNC
, 2 );
833 if (ctx
->ExecuteFlag
) {
834 (*ctx
->Exec
->BlendFunc
)( sfactor
, dfactor
);
839 static void save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
840 GLenum sfactorA
, GLenum dfactorA
)
842 GET_CURRENT_CONTEXT(ctx
);
844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
845 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4 );
852 if (ctx
->ExecuteFlag
) {
853 (*ctx
->Exec
->BlendFuncSeparateEXT
)( sfactorRGB
, dfactorRGB
,
859 static void save_BlendColor( GLfloat red
, GLfloat green
,
860 GLfloat blue
, GLfloat alpha
)
862 GET_CURRENT_CONTEXT(ctx
);
864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
865 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_COLOR
, 4 );
872 if (ctx
->ExecuteFlag
) {
873 (*ctx
->Exec
->BlendColor
)( red
, green
, blue
, alpha
);
878 void _mesa_save_CallList( GLuint list
)
880 GET_CURRENT_CONTEXT(ctx
);
882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
883 FLUSH_CURRENT(ctx
, 0);
885 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CALL_LIST
, 1 );
889 if (ctx
->ExecuteFlag
) {
890 (*ctx
->Exec
->CallList
)( list
);
895 void _mesa_save_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
897 GET_CURRENT_CONTEXT(ctx
);
899 GLboolean typeErrorFlag
;
901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
902 FLUSH_CURRENT(ctx
, 0);
906 case GL_UNSIGNED_BYTE
:
908 case GL_UNSIGNED_SHORT
:
910 case GL_UNSIGNED_INT
:
915 typeErrorFlag
= GL_FALSE
;
918 typeErrorFlag
= GL_TRUE
;
922 GLuint list
= translate_id( i
, type
, lists
);
923 Node
*n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CALL_LIST_OFFSET
, 2 );
926 n
[2].b
= typeErrorFlag
;
929 if (ctx
->ExecuteFlag
) {
930 (*ctx
->Exec
->CallLists
)( n
, type
, lists
);
935 static void save_Clear( GLbitfield mask
)
937 GET_CURRENT_CONTEXT(ctx
);
939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
940 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR
, 1 );
944 if (ctx
->ExecuteFlag
) {
945 (*ctx
->Exec
->Clear
)( mask
);
950 static void save_ClearAccum( GLfloat red
, GLfloat green
,
951 GLfloat blue
, GLfloat alpha
)
953 GET_CURRENT_CONTEXT(ctx
);
955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
956 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_ACCUM
, 4 );
963 if (ctx
->ExecuteFlag
) {
964 (*ctx
->Exec
->ClearAccum
)( red
, green
, blue
, alpha
);
969 static void save_ClearColor( GLclampf red
, GLclampf green
,
970 GLclampf blue
, GLclampf alpha
)
972 GET_CURRENT_CONTEXT(ctx
);
974 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
975 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_COLOR
, 4 );
982 if (ctx
->ExecuteFlag
) {
983 (*ctx
->Exec
->ClearColor
)( red
, green
, blue
, alpha
);
988 static void save_ClearDepth( GLclampd depth
)
990 GET_CURRENT_CONTEXT(ctx
);
992 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
993 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_DEPTH
, 1 );
995 n
[1].f
= (GLfloat
) depth
;
997 if (ctx
->ExecuteFlag
) {
998 (*ctx
->Exec
->ClearDepth
)( depth
);
1003 static void save_ClearIndex( GLfloat c
)
1005 GET_CURRENT_CONTEXT(ctx
);
1007 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1008 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_INDEX
, 1 );
1012 if (ctx
->ExecuteFlag
) {
1013 (*ctx
->Exec
->ClearIndex
)( c
);
1018 static void save_ClearStencil( GLint s
)
1020 GET_CURRENT_CONTEXT(ctx
);
1022 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1023 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_STENCIL
, 1 );
1027 if (ctx
->ExecuteFlag
) {
1028 (*ctx
->Exec
->ClearStencil
)( s
);
1033 static void save_ClipPlane( GLenum plane
, const GLdouble
*equ
)
1035 GET_CURRENT_CONTEXT(ctx
);
1037 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1038 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLIP_PLANE
, 5 );
1041 n
[2].f
= (GLfloat
) equ
[0];
1042 n
[3].f
= (GLfloat
) equ
[1];
1043 n
[4].f
= (GLfloat
) equ
[2];
1044 n
[5].f
= (GLfloat
) equ
[3];
1046 if (ctx
->ExecuteFlag
) {
1047 (*ctx
->Exec
->ClipPlane
)( plane
, equ
);
1053 static void save_ColorMask( GLboolean red
, GLboolean green
,
1054 GLboolean blue
, GLboolean alpha
)
1056 GET_CURRENT_CONTEXT(ctx
);
1058 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1059 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_MASK
, 4 );
1066 if (ctx
->ExecuteFlag
) {
1067 (*ctx
->Exec
->ColorMask
)( red
, green
, blue
, alpha
);
1072 static void save_ColorMaterial( GLenum face
, GLenum mode
)
1074 GET_CURRENT_CONTEXT(ctx
);
1076 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1077 FLUSH_CURRENT(ctx
, 0);
1079 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_MATERIAL
, 2 );
1084 if (ctx
->ExecuteFlag
) {
1085 (*ctx
->Exec
->ColorMaterial
)( face
, mode
);
1090 static void save_ColorTable( GLenum target
, GLenum internalFormat
,
1091 GLsizei width
, GLenum format
, GLenum type
,
1092 const GLvoid
*table
)
1094 GET_CURRENT_CONTEXT(ctx
);
1095 if (target
== GL_PROXY_TEXTURE_1D
||
1096 target
== GL_PROXY_TEXTURE_2D
||
1097 target
== GL_PROXY_TEXTURE_3D
||
1098 target
== GL_PROXY_TEXTURE_CUBE_MAP_ARB
) {
1099 /* execute immediately */
1100 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1101 format
, type
, table
);
1104 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, table
,
1107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1108 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE
, 6 );
1111 n
[2].e
= internalFormat
;
1120 if (ctx
->ExecuteFlag
) {
1121 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1122 format
, type
, table
);
1130 save_ColorTableParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1132 GET_CURRENT_CONTEXT(ctx
);
1135 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1137 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6 );
1142 if (pname
== GL_COLOR_TABLE_SGI
||
1143 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1144 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1145 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1152 if (ctx
->ExecuteFlag
) {
1153 (*ctx
->Exec
->ColorTableParameterfv
)( target
, pname
, params
);
1159 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1161 GET_CURRENT_CONTEXT(ctx
);
1164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1166 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6 );
1171 if (pname
== GL_COLOR_TABLE_SGI
||
1172 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1173 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1174 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1181 if (ctx
->ExecuteFlag
) {
1182 (*ctx
->Exec
->ColorTableParameteriv
)( target
, pname
, params
);
1188 static void save_ColorSubTable( GLenum target
, GLsizei start
, GLsizei count
,
1189 GLenum format
, GLenum type
,
1190 const GLvoid
*table
)
1192 GET_CURRENT_CONTEXT(ctx
);
1193 GLvoid
*image
= _mesa_unpack_image(count
, 1, 1, format
, type
, table
,
1196 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1197 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_SUB_TABLE
, 6 );
1209 if (ctx
->ExecuteFlag
) {
1210 (*ctx
->Exec
->ColorSubTable
)(target
, start
, count
, format
, type
, table
);
1216 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1217 GLint x
, GLint y
, GLsizei width
)
1219 GET_CURRENT_CONTEXT(ctx
);
1222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1223 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5 );
1231 if (ctx
->ExecuteFlag
) {
1232 (*ctx
->Exec
->CopyColorSubTable
)(target
, start
, x
, y
, width
);
1238 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1239 GLint x
, GLint y
, GLsizei width
)
1241 GET_CURRENT_CONTEXT(ctx
);
1244 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1245 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_TABLE
, 5 );
1248 n
[2].e
= internalformat
;
1253 if (ctx
->ExecuteFlag
) {
1254 (*ctx
->Exec
->CopyColorTable
)(target
, internalformat
, x
, y
, width
);
1260 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1261 GLenum format
, GLenum type
, const GLvoid
*filter
)
1263 GET_CURRENT_CONTEXT(ctx
);
1264 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, filter
,
1267 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1268 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6 );
1271 n
[2].e
= internalFormat
;
1280 if (ctx
->ExecuteFlag
) {
1281 (*ctx
->Exec
->ConvolutionFilter1D
)( target
, internalFormat
, width
,
1282 format
, type
, filter
);
1288 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1289 GLsizei width
, GLsizei height
, GLenum format
,
1290 GLenum type
, const GLvoid
*filter
)
1292 GET_CURRENT_CONTEXT(ctx
);
1293 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
, filter
,
1296 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1297 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7 );
1300 n
[2].e
= internalFormat
;
1310 if (ctx
->ExecuteFlag
) {
1311 (*ctx
->Exec
->ConvolutionFilter2D
)( target
, internalFormat
, width
, height
,
1312 format
, type
, filter
);
1318 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1320 GET_CURRENT_CONTEXT(ctx
);
1322 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1323 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3 );
1329 if (ctx
->ExecuteFlag
) {
1330 (*ctx
->Exec
->ConvolutionParameteri
)( target
, pname
, param
);
1336 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1338 GET_CURRENT_CONTEXT(ctx
);
1340 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1341 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6 );
1346 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1347 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1348 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1354 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1357 if (ctx
->ExecuteFlag
) {
1358 (*ctx
->Exec
->ConvolutionParameteriv
)( target
, pname
, params
);
1364 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1366 GET_CURRENT_CONTEXT(ctx
);
1368 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1369 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3 );
1375 if (ctx
->ExecuteFlag
) {
1376 (*ctx
->Exec
->ConvolutionParameterf
)( target
, pname
, param
);
1382 save_ConvolutionParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1384 GET_CURRENT_CONTEXT(ctx
);
1386 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1387 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6 );
1392 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1393 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1394 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1400 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1403 if (ctx
->ExecuteFlag
) {
1404 (*ctx
->Exec
->ConvolutionParameterfv
)( target
, pname
, params
);
1410 save_CopyPixels( GLint x
, GLint y
,
1411 GLsizei width
, GLsizei height
, GLenum type
)
1413 GET_CURRENT_CONTEXT(ctx
);
1415 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1416 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_PIXELS
, 5 );
1420 n
[3].i
= (GLint
) width
;
1421 n
[4].i
= (GLint
) height
;
1424 if (ctx
->ExecuteFlag
) {
1425 (*ctx
->Exec
->CopyPixels
)( x
, y
, width
, height
, type
);
1432 save_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
1433 GLint x
, GLint y
, GLsizei width
, GLint border
)
1435 GET_CURRENT_CONTEXT(ctx
);
1437 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1438 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7 );
1442 n
[3].e
= internalformat
;
1448 if (ctx
->ExecuteFlag
) {
1449 (*ctx
->Exec
->CopyTexImage1D
)( target
, level
, internalformat
,
1450 x
, y
, width
, border
);
1456 save_CopyTexImage2D( GLenum target
, GLint level
,
1457 GLenum internalformat
,
1458 GLint x
, GLint y
, GLsizei width
,
1459 GLsizei height
, GLint border
)
1461 GET_CURRENT_CONTEXT(ctx
);
1463 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1464 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8 );
1468 n
[3].e
= internalformat
;
1475 if (ctx
->ExecuteFlag
) {
1476 (*ctx
->Exec
->CopyTexImage2D
)( target
, level
, internalformat
,
1477 x
, y
, width
, height
, border
);
1484 save_CopyTexSubImage1D( GLenum target
, GLint level
,
1485 GLint xoffset
, GLint x
, GLint y
,
1488 GET_CURRENT_CONTEXT(ctx
);
1490 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1491 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6 );
1500 if (ctx
->ExecuteFlag
) {
1501 (*ctx
->Exec
->CopyTexSubImage1D
)( target
, level
, xoffset
, x
, y
, width
);
1507 save_CopyTexSubImage2D( GLenum target
, GLint level
,
1508 GLint xoffset
, GLint yoffset
,
1510 GLsizei width
, GLint height
)
1512 GET_CURRENT_CONTEXT(ctx
);
1514 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1515 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8 );
1526 if (ctx
->ExecuteFlag
) {
1527 (*ctx
->Exec
->CopyTexSubImage2D
)( target
, level
, xoffset
, yoffset
,
1528 x
, y
, width
, height
);
1534 save_CopyTexSubImage3D( GLenum target
, GLint level
,
1535 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1537 GLsizei width
, GLint height
)
1539 GET_CURRENT_CONTEXT(ctx
);
1541 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1542 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9 );
1554 if (ctx
->ExecuteFlag
) {
1555 (*ctx
->Exec
->CopyTexSubImage3D
)( target
, level
,
1556 xoffset
, yoffset
, zoffset
,
1557 x
, y
, width
, height
);
1562 static void save_CullFace( GLenum mode
)
1564 GET_CURRENT_CONTEXT(ctx
);
1566 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1567 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CULL_FACE
, 1 );
1571 if (ctx
->ExecuteFlag
) {
1572 (*ctx
->Exec
->CullFace
)( mode
);
1577 static void save_DepthFunc( GLenum func
)
1579 GET_CURRENT_CONTEXT(ctx
);
1581 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1582 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_FUNC
, 1 );
1586 if (ctx
->ExecuteFlag
) {
1587 (*ctx
->Exec
->DepthFunc
)( func
);
1592 static void save_DepthMask( GLboolean mask
)
1594 GET_CURRENT_CONTEXT(ctx
);
1596 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1597 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_MASK
, 1 );
1601 if (ctx
->ExecuteFlag
) {
1602 (*ctx
->Exec
->DepthMask
)( mask
);
1607 static void save_DepthRange( GLclampd nearval
, GLclampd farval
)
1609 GET_CURRENT_CONTEXT(ctx
);
1611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1612 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_RANGE
, 2 );
1614 n
[1].f
= (GLfloat
) nearval
;
1615 n
[2].f
= (GLfloat
) farval
;
1617 if (ctx
->ExecuteFlag
) {
1618 (*ctx
->Exec
->DepthRange
)( nearval
, farval
);
1623 static void save_Disable( GLenum cap
)
1625 GET_CURRENT_CONTEXT(ctx
);
1627 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1628 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DISABLE
, 1 );
1632 if (ctx
->ExecuteFlag
) {
1633 (*ctx
->Exec
->Disable
)( cap
);
1638 static void save_DrawBuffer( GLenum mode
)
1640 GET_CURRENT_CONTEXT(ctx
);
1642 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1643 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_BUFFER
, 1 );
1647 if (ctx
->ExecuteFlag
) {
1648 (*ctx
->Exec
->DrawBuffer
)( mode
);
1653 static void save_DrawPixels( GLsizei width
, GLsizei height
,
1654 GLenum format
, GLenum type
,
1655 const GLvoid
*pixels
)
1657 GET_CURRENT_CONTEXT(ctx
);
1658 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
1659 pixels
, &ctx
->Unpack
);
1661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1662 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_PIXELS
, 5 );
1673 if (ctx
->ExecuteFlag
) {
1674 (*ctx
->Exec
->DrawPixels
)( width
, height
, format
, type
, pixels
);
1680 static void save_Enable( GLenum cap
)
1682 GET_CURRENT_CONTEXT(ctx
);
1684 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1685 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ENABLE
, 1 );
1689 if (ctx
->ExecuteFlag
) {
1690 (*ctx
->Exec
->Enable
)( cap
);
1696 void _mesa_save_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
1698 GET_CURRENT_CONTEXT(ctx
);
1700 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1701 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH1
, 3 );
1707 if (ctx
->ExecuteFlag
) {
1708 (*ctx
->Exec
->EvalMesh1
)( mode
, i1
, i2
);
1713 void _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1715 GET_CURRENT_CONTEXT(ctx
);
1717 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1718 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH2
, 5 );
1726 if (ctx
->ExecuteFlag
) {
1727 (*ctx
->Exec
->EvalMesh2
)( mode
, i1
, i2
, j1
, j2
);
1734 static void save_Fogfv( GLenum pname
, const GLfloat
*params
)
1736 GET_CURRENT_CONTEXT(ctx
);
1738 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1739 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FOG
, 5 );
1747 if (ctx
->ExecuteFlag
) {
1748 (*ctx
->Exec
->Fogfv
)( pname
, params
);
1753 static void save_Fogf( GLenum pname
, GLfloat param
)
1755 save_Fogfv(pname
, ¶m
);
1759 static void save_Fogiv(GLenum pname
, const GLint
*params
)
1764 case GL_FOG_DENSITY
:
1768 p
[0] = (GLfloat
) *params
;
1771 p
[0] = INT_TO_FLOAT( params
[0] );
1772 p
[1] = INT_TO_FLOAT( params
[1] );
1773 p
[2] = INT_TO_FLOAT( params
[2] );
1774 p
[3] = INT_TO_FLOAT( params
[3] );
1777 /* Error will be caught later in gl_Fogfv */
1780 save_Fogfv(pname
, p
);
1784 static void save_Fogi(GLenum pname
, GLint param
)
1786 save_Fogiv(pname
, ¶m
);
1790 static void save_FrontFace( GLenum mode
)
1792 GET_CURRENT_CONTEXT(ctx
);
1794 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1795 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRONT_FACE
, 1 );
1799 if (ctx
->ExecuteFlag
) {
1800 (*ctx
->Exec
->FrontFace
)( mode
);
1805 static void save_Frustum( GLdouble left
, GLdouble right
,
1806 GLdouble bottom
, GLdouble top
,
1807 GLdouble nearval
, GLdouble farval
)
1809 GET_CURRENT_CONTEXT(ctx
);
1811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1812 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRUSTUM
, 6 );
1814 n
[1].f
= (GLfloat
) left
;
1815 n
[2].f
= (GLfloat
) right
;
1816 n
[3].f
= (GLfloat
) bottom
;
1817 n
[4].f
= (GLfloat
) top
;
1818 n
[5].f
= (GLfloat
) nearval
;
1819 n
[6].f
= (GLfloat
) farval
;
1821 if (ctx
->ExecuteFlag
) {
1822 (*ctx
->Exec
->Frustum
)( left
, right
, bottom
, top
, nearval
, farval
);
1827 static void save_Hint( GLenum target
, GLenum mode
)
1829 GET_CURRENT_CONTEXT(ctx
);
1831 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1832 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HINT
, 2 );
1837 if (ctx
->ExecuteFlag
) {
1838 (*ctx
->Exec
->Hint
)( target
, mode
);
1844 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
, GLboolean sink
)
1846 GET_CURRENT_CONTEXT(ctx
);
1849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1850 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HISTOGRAM
, 4 );
1854 n
[3].e
= internalFormat
;
1857 if (ctx
->ExecuteFlag
) {
1858 (*ctx
->Exec
->Histogram
)( target
, width
, internalFormat
, sink
);
1863 static void save_IndexMask( GLuint mask
)
1865 GET_CURRENT_CONTEXT(ctx
);
1867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1868 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_INDEX_MASK
, 1 );
1872 if (ctx
->ExecuteFlag
) {
1873 (*ctx
->Exec
->IndexMask
)( mask
);
1878 static void save_InitNames( void )
1880 GET_CURRENT_CONTEXT(ctx
);
1881 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1882 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_INIT_NAMES
, 0 );
1883 if (ctx
->ExecuteFlag
) {
1884 (*ctx
->Exec
->InitNames
)();
1889 static void save_Lightfv( GLenum light
, GLenum pname
, const GLfloat
*params
)
1891 GET_CURRENT_CONTEXT(ctx
);
1893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1894 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT
, 6 );
1912 case GL_SPOT_DIRECTION
:
1915 case GL_SPOT_EXPONENT
:
1918 case GL_SPOT_CUTOFF
:
1921 case GL_CONSTANT_ATTENUATION
:
1924 case GL_LINEAR_ATTENUATION
:
1927 case GL_QUADRATIC_ATTENUATION
:
1933 for (i
= 0; i
< nParams
; i
++) {
1934 n
[3+i
].f
= params
[i
];
1937 if (ctx
->ExecuteFlag
) {
1938 (*ctx
->Exec
->Lightfv
)( light
, pname
, params
);
1943 static void save_Lightf( GLenum light
, GLenum pname
, GLfloat params
)
1945 save_Lightfv(light
, pname
, ¶ms
);
1949 static void save_Lightiv( GLenum light
, GLenum pname
, const GLint
*params
)
1956 fparam
[0] = INT_TO_FLOAT( params
[0] );
1957 fparam
[1] = INT_TO_FLOAT( params
[1] );
1958 fparam
[2] = INT_TO_FLOAT( params
[2] );
1959 fparam
[3] = INT_TO_FLOAT( params
[3] );
1962 fparam
[0] = (GLfloat
) params
[0];
1963 fparam
[1] = (GLfloat
) params
[1];
1964 fparam
[2] = (GLfloat
) params
[2];
1965 fparam
[3] = (GLfloat
) params
[3];
1967 case GL_SPOT_DIRECTION
:
1968 fparam
[0] = (GLfloat
) params
[0];
1969 fparam
[1] = (GLfloat
) params
[1];
1970 fparam
[2] = (GLfloat
) params
[2];
1972 case GL_SPOT_EXPONENT
:
1973 case GL_SPOT_CUTOFF
:
1974 case GL_CONSTANT_ATTENUATION
:
1975 case GL_LINEAR_ATTENUATION
:
1976 case GL_QUADRATIC_ATTENUATION
:
1977 fparam
[0] = (GLfloat
) params
[0];
1980 /* error will be caught later in gl_Lightfv */
1983 save_Lightfv( light
, pname
, fparam
);
1987 static void save_Lighti( GLenum light
, GLenum pname
, GLint param
)
1989 save_Lightiv( light
, pname
, ¶m
);
1993 static void save_LightModelfv( GLenum pname
, const GLfloat
*params
)
1995 GET_CURRENT_CONTEXT(ctx
);
1997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1998 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT_MODEL
, 5 );
2006 if (ctx
->ExecuteFlag
) {
2007 (*ctx
->Exec
->LightModelfv
)( pname
, params
);
2012 static void save_LightModelf( GLenum pname
, GLfloat param
)
2014 save_LightModelfv(pname
, ¶m
);
2018 static void save_LightModeliv( GLenum pname
, const GLint
*params
)
2022 case GL_LIGHT_MODEL_AMBIENT
:
2023 fparam
[0] = INT_TO_FLOAT( params
[0] );
2024 fparam
[1] = INT_TO_FLOAT( params
[1] );
2025 fparam
[2] = INT_TO_FLOAT( params
[2] );
2026 fparam
[3] = INT_TO_FLOAT( params
[3] );
2028 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2029 case GL_LIGHT_MODEL_TWO_SIDE
:
2030 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2031 fparam
[0] = (GLfloat
) params
[0];
2034 /* Error will be caught later in gl_LightModelfv */
2037 save_LightModelfv(pname
, fparam
);
2041 static void save_LightModeli( GLenum pname
, GLint param
)
2043 save_LightModeliv(pname
, ¶m
);
2047 static void save_LineStipple( GLint factor
, GLushort pattern
)
2049 GET_CURRENT_CONTEXT(ctx
);
2051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2052 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_STIPPLE
, 2 );
2057 if (ctx
->ExecuteFlag
) {
2058 (*ctx
->Exec
->LineStipple
)( factor
, pattern
);
2063 static void save_LineWidth( GLfloat width
)
2065 GET_CURRENT_CONTEXT(ctx
);
2067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2068 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_WIDTH
, 1 );
2072 if (ctx
->ExecuteFlag
) {
2073 (*ctx
->Exec
->LineWidth
)( width
);
2078 static void save_ListBase( GLuint base
)
2080 GET_CURRENT_CONTEXT(ctx
);
2082 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2083 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIST_BASE
, 1 );
2087 if (ctx
->ExecuteFlag
) {
2088 (*ctx
->Exec
->ListBase
)( base
);
2093 static void save_LoadIdentity( void )
2095 GET_CURRENT_CONTEXT(ctx
);
2096 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2097 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_IDENTITY
, 0 );
2098 if (ctx
->ExecuteFlag
) {
2099 (*ctx
->Exec
->LoadIdentity
)();
2104 static void save_LoadMatrixf( const GLfloat
*m
)
2106 GET_CURRENT_CONTEXT(ctx
);
2108 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2109 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_MATRIX
, 16 );
2112 for (i
=0;i
<16;i
++) {
2116 if (ctx
->ExecuteFlag
) {
2117 (*ctx
->Exec
->LoadMatrixf
)( m
);
2122 static void save_LoadMatrixd( const GLdouble
*m
)
2126 for (i
= 0; i
< 16; i
++) {
2127 f
[i
] = (GLfloat
) m
[i
];
2129 save_LoadMatrixf(f
);
2133 static void save_LoadName( GLuint name
)
2135 GET_CURRENT_CONTEXT(ctx
);
2137 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2138 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_NAME
, 1 );
2142 if (ctx
->ExecuteFlag
) {
2143 (*ctx
->Exec
->LoadName
)( name
);
2148 static void save_LogicOp( GLenum opcode
)
2150 GET_CURRENT_CONTEXT(ctx
);
2152 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2153 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOGIC_OP
, 1 );
2157 if (ctx
->ExecuteFlag
) {
2158 (*ctx
->Exec
->LogicOp
)( opcode
);
2163 static void save_Map1d( GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2164 GLint order
, const GLdouble
*points
)
2166 GET_CURRENT_CONTEXT(ctx
);
2168 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2169 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2171 GLfloat
*pnts
= _mesa_copy_map_points1d( target
, stride
, order
, points
);
2173 n
[2].f
= (GLfloat
) u1
;
2174 n
[3].f
= (GLfloat
) u2
;
2175 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2177 n
[6].data
= (void *) pnts
;
2179 if (ctx
->ExecuteFlag
) {
2180 (*ctx
->Exec
->Map1d
)( target
, u1
, u2
, stride
, order
, points
);
2184 static void save_Map1f( GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2185 GLint order
, const GLfloat
*points
)
2187 GET_CURRENT_CONTEXT(ctx
);
2189 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2190 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2192 GLfloat
*pnts
= _mesa_copy_map_points1f( target
, stride
, order
, points
);
2196 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2198 n
[6].data
= (void *) pnts
;
2200 if (ctx
->ExecuteFlag
) {
2201 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, stride
, order
, points
);
2206 static void save_Map2d( GLenum target
,
2207 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2208 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2209 const GLdouble
*points
)
2211 GET_CURRENT_CONTEXT(ctx
);
2213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2214 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2216 GLfloat
*pnts
= _mesa_copy_map_points2d( target
, ustride
, uorder
,
2217 vstride
, vorder
, points
);
2219 n
[2].f
= (GLfloat
) u1
;
2220 n
[3].f
= (GLfloat
) u2
;
2221 n
[4].f
= (GLfloat
) v1
;
2222 n
[5].f
= (GLfloat
) v2
;
2223 /* XXX verify these strides are correct */
2224 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2225 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2228 n
[10].data
= (void *) pnts
;
2230 if (ctx
->ExecuteFlag
) {
2231 (*ctx
->Exec
->Map2d
)( target
,
2232 u1
, u2
, ustride
, uorder
,
2233 v1
, v2
, vstride
, vorder
, points
);
2238 static void save_Map2f( GLenum target
,
2239 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2240 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2241 const GLfloat
*points
)
2243 GET_CURRENT_CONTEXT(ctx
);
2245 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2246 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2248 GLfloat
*pnts
= _mesa_copy_map_points2f( target
, ustride
, uorder
,
2249 vstride
, vorder
, points
);
2255 /* XXX verify these strides are correct */
2256 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2257 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2260 n
[10].data
= (void *) pnts
;
2262 if (ctx
->ExecuteFlag
) {
2263 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
2264 v1
, v2
, vstride
, vorder
, points
);
2269 static void save_MapGrid1f( GLint un
, GLfloat u1
, GLfloat u2
)
2271 GET_CURRENT_CONTEXT(ctx
);
2273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2274 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID1
, 3 );
2280 if (ctx
->ExecuteFlag
) {
2281 (*ctx
->Exec
->MapGrid1f
)( un
, u1
, u2
);
2286 static void save_MapGrid1d( GLint un
, GLdouble u1
, GLdouble u2
)
2288 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2292 static void save_MapGrid2f( GLint un
, GLfloat u1
, GLfloat u2
,
2293 GLint vn
, GLfloat v1
, GLfloat v2
)
2295 GET_CURRENT_CONTEXT(ctx
);
2297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2298 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID2
, 6 );
2307 if (ctx
->ExecuteFlag
) {
2308 (*ctx
->Exec
->MapGrid2f
)( un
, u1
, u2
, vn
, v1
, v2
);
2314 static void save_MapGrid2d( GLint un
, GLdouble u1
, GLdouble u2
,
2315 GLint vn
, GLdouble v1
, GLdouble v2
)
2317 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2318 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2322 static void save_MatrixMode( GLenum mode
)
2324 GET_CURRENT_CONTEXT(ctx
);
2326 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2327 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MATRIX_MODE
, 1 );
2331 if (ctx
->ExecuteFlag
) {
2332 (*ctx
->Exec
->MatrixMode
)( mode
);
2338 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2340 GET_CURRENT_CONTEXT(ctx
);
2343 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2344 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MIN_MAX
, 3 );
2347 n
[2].e
= internalFormat
;
2350 if (ctx
->ExecuteFlag
) {
2351 (*ctx
->Exec
->Minmax
)( target
, internalFormat
, sink
);
2356 static void save_MultMatrixf( const GLfloat
*m
)
2358 GET_CURRENT_CONTEXT(ctx
);
2360 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2361 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MULT_MATRIX
, 16 );
2364 for (i
=0;i
<16;i
++) {
2368 if (ctx
->ExecuteFlag
) {
2369 (*ctx
->Exec
->MultMatrixf
)( m
);
2374 static void save_MultMatrixd( const GLdouble
*m
)
2378 for (i
= 0; i
< 16; i
++) {
2379 f
[i
] = (GLfloat
) m
[i
];
2381 save_MultMatrixf(f
);
2385 static void save_NewList( GLuint list
, GLenum mode
)
2387 GET_CURRENT_CONTEXT(ctx
);
2388 /* It's an error to call this function while building a display list */
2389 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
2396 static void save_Ortho( GLdouble left
, GLdouble right
,
2397 GLdouble bottom
, GLdouble top
,
2398 GLdouble nearval
, GLdouble farval
)
2400 GET_CURRENT_CONTEXT(ctx
);
2402 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2403 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ORTHO
, 6 );
2405 n
[1].f
= (GLfloat
) left
;
2406 n
[2].f
= (GLfloat
) right
;
2407 n
[3].f
= (GLfloat
) bottom
;
2408 n
[4].f
= (GLfloat
) top
;
2409 n
[5].f
= (GLfloat
) nearval
;
2410 n
[6].f
= (GLfloat
) farval
;
2412 if (ctx
->ExecuteFlag
) {
2413 (*ctx
->Exec
->Ortho
)( left
, right
, bottom
, top
, nearval
, farval
);
2419 save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
2421 GET_CURRENT_CONTEXT(ctx
);
2423 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2424 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_MAP
, 3 );
2428 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
2429 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
2431 if (ctx
->ExecuteFlag
) {
2432 (*ctx
->Exec
->PixelMapfv
)( map
, mapsize
, values
);
2438 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2440 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2442 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2443 for (i
=0;i
<mapsize
;i
++) {
2444 fvalues
[i
] = (GLfloat
) values
[i
];
2448 for (i
=0;i
<mapsize
;i
++) {
2449 fvalues
[i
] = UINT_TO_FLOAT( values
[i
] );
2452 save_PixelMapfv(map
, mapsize
, fvalues
);
2457 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2459 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2461 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2462 for (i
=0;i
<mapsize
;i
++) {
2463 fvalues
[i
] = (GLfloat
) values
[i
];
2467 for (i
=0;i
<mapsize
;i
++) {
2468 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2471 save_PixelMapfv(map
, mapsize
, fvalues
);
2476 save_PixelTransferf( GLenum pname
, GLfloat param
)
2478 GET_CURRENT_CONTEXT(ctx
);
2480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2481 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2486 if (ctx
->ExecuteFlag
) {
2487 (*ctx
->Exec
->PixelTransferf
)( pname
, param
);
2493 save_PixelTransferi( GLenum pname
, GLint param
)
2495 save_PixelTransferf( pname
, (GLfloat
) param
);
2500 save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2502 GET_CURRENT_CONTEXT(ctx
);
2504 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2505 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2510 if (ctx
->ExecuteFlag
) {
2511 (*ctx
->Exec
->PixelZoom
)( xfactor
, yfactor
);
2517 save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2519 GET_CURRENT_CONTEXT(ctx
);
2521 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2522 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2529 if (ctx
->ExecuteFlag
) {
2530 (*ctx
->Exec
->PointParameterfvEXT
)( pname
, params
);
2535 static void save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2537 save_PointParameterfvEXT(pname
, ¶m
);
2540 static void save_PointParameteriNV( GLenum pname
, GLint param
)
2542 GLfloat p
= (GLfloat
) param
;
2543 save_PointParameterfvEXT(pname
, &p
);
2546 static void save_PointParameterivNV( GLenum pname
, const GLint
*param
)
2548 GLfloat p
= (GLfloat
) param
[0];
2549 save_PointParameterfvEXT(pname
, &p
);
2553 static void save_PointSize( GLfloat size
)
2555 GET_CURRENT_CONTEXT(ctx
);
2557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2558 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_SIZE
, 1 );
2562 if (ctx
->ExecuteFlag
) {
2563 (*ctx
->Exec
->PointSize
)( size
);
2568 static void save_PolygonMode( GLenum face
, GLenum mode
)
2570 GET_CURRENT_CONTEXT(ctx
);
2572 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2573 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_MODE
, 2 );
2578 if (ctx
->ExecuteFlag
) {
2579 (*ctx
->Exec
->PolygonMode
)( face
, mode
);
2585 * Polygon stipple must have been upacked already!
2587 static void save_PolygonStipple( const GLubyte
*pattern
)
2589 GET_CURRENT_CONTEXT(ctx
);
2591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2592 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2595 n
[1].data
= MALLOC( 32 * 4 );
2596 data
= n
[1].data
; /* This needed for Acorn compiler */
2597 MEMCPY( data
, pattern
, 32 * 4 );
2599 if (ctx
->ExecuteFlag
) {
2600 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) pattern
);
2605 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2607 GET_CURRENT_CONTEXT(ctx
);
2609 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2610 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2615 if (ctx
->ExecuteFlag
) {
2616 (*ctx
->Exec
->PolygonOffset
)( factor
, units
);
2621 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2623 GET_CURRENT_CONTEXT(ctx
);
2624 save_PolygonOffset(factor
, ctx
->DepthMaxF
* bias
);
2628 static void save_PopAttrib( void )
2630 GET_CURRENT_CONTEXT(ctx
);
2631 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2632 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_ATTRIB
, 0 );
2633 if (ctx
->ExecuteFlag
) {
2634 (*ctx
->Exec
->PopAttrib
)();
2639 static void save_PopMatrix( void )
2641 GET_CURRENT_CONTEXT(ctx
);
2642 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2643 FLUSH_CURRENT(ctx
, 0);
2644 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_MATRIX
, 0 );
2645 if (ctx
->ExecuteFlag
) {
2646 (*ctx
->Exec
->PopMatrix
)();
2651 static void save_PopName( void )
2653 GET_CURRENT_CONTEXT(ctx
);
2654 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2655 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_NAME
, 0 );
2656 if (ctx
->ExecuteFlag
) {
2657 (*ctx
->Exec
->PopName
)();
2662 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2663 const GLclampf
*priorities
)
2665 GET_CURRENT_CONTEXT(ctx
);
2667 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2669 for (i
=0;i
<num
;i
++) {
2671 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2673 n
[1].ui
= textures
[i
];
2674 n
[2].f
= priorities
[i
];
2677 if (ctx
->ExecuteFlag
) {
2678 (*ctx
->Exec
->PrioritizeTextures
)( num
, textures
, priorities
);
2683 static void save_PushAttrib( GLbitfield mask
)
2685 GET_CURRENT_CONTEXT(ctx
);
2687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2688 FLUSH_CURRENT(ctx
, 0);
2689 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2693 if (ctx
->ExecuteFlag
) {
2694 (*ctx
->Exec
->PushAttrib
)( mask
);
2699 static void save_PushMatrix( void )
2701 GET_CURRENT_CONTEXT(ctx
);
2702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2703 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2704 if (ctx
->ExecuteFlag
) {
2705 (*ctx
->Exec
->PushMatrix
)();
2710 static void save_PushName( GLuint name
)
2712 GET_CURRENT_CONTEXT(ctx
);
2714 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2715 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_NAME
, 1 );
2719 if (ctx
->ExecuteFlag
) {
2720 (*ctx
->Exec
->PushName
)( name
);
2725 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2727 GET_CURRENT_CONTEXT(ctx
);
2729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2730 FLUSH_CURRENT(ctx
, 0);
2731 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RASTER_POS
, 4 );
2738 if (ctx
->ExecuteFlag
) {
2739 (*ctx
->Exec
->RasterPos4f
)( x
, y
, z
, w
);
2743 static void save_RasterPos2d(GLdouble x
, GLdouble y
)
2745 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2748 static void save_RasterPos2f(GLfloat x
, GLfloat y
)
2750 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2753 static void save_RasterPos2i(GLint x
, GLint y
)
2755 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2758 static void save_RasterPos2s(GLshort x
, GLshort y
)
2760 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2763 static void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2765 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2768 static void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2770 save_RasterPos4f(x
, y
, z
, 1.0F
);
2773 static void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2775 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2778 static void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2780 save_RasterPos4f(x
, y
, z
, 1.0F
);
2783 static void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2785 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2788 static void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2790 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2793 static void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2795 save_RasterPos4f(x
, y
, z
, w
);
2798 static void save_RasterPos2dv(const GLdouble
*v
)
2800 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2803 static void save_RasterPos2fv(const GLfloat
*v
)
2805 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2808 static void save_RasterPos2iv(const GLint
*v
)
2810 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2813 static void save_RasterPos2sv(const GLshort
*v
)
2815 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2818 static void save_RasterPos3dv(const GLdouble
*v
)
2820 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2823 static void save_RasterPos3fv(const GLfloat
*v
)
2825 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2828 static void save_RasterPos3iv(const GLint
*v
)
2830 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2833 static void save_RasterPos3sv(const GLshort
*v
)
2835 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2838 static void save_RasterPos4dv(const GLdouble
*v
)
2840 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
2841 (GLfloat
) v
[2], (GLfloat
) v
[3]);
2844 static void save_RasterPos4fv(const GLfloat
*v
)
2846 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2849 static void save_RasterPos4iv(const GLint
*v
)
2851 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
2852 (GLfloat
) v
[2], (GLfloat
) v
[3]);
2855 static void save_RasterPos4sv(const GLshort
*v
)
2857 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2861 static void save_PassThrough( GLfloat token
)
2863 GET_CURRENT_CONTEXT(ctx
);
2865 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2866 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PASSTHROUGH
, 1 );
2870 if (ctx
->ExecuteFlag
) {
2871 (*ctx
->Exec
->PassThrough
)( token
);
2876 static void save_ReadBuffer( GLenum mode
)
2878 GET_CURRENT_CONTEXT(ctx
);
2880 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2881 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_READ_BUFFER
, 1 );
2885 if (ctx
->ExecuteFlag
) {
2886 (*ctx
->Exec
->ReadBuffer
)( mode
);
2892 save_ResetHistogram(GLenum target
)
2894 GET_CURRENT_CONTEXT(ctx
);
2896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2897 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_HISTOGRAM
, 1 );
2901 if (ctx
->ExecuteFlag
) {
2902 (*ctx
->Exec
->ResetHistogram
)( target
);
2908 save_ResetMinmax(GLenum target
)
2910 GET_CURRENT_CONTEXT(ctx
);
2912 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2913 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_MIN_MAX
, 1 );
2917 if (ctx
->ExecuteFlag
) {
2918 (*ctx
->Exec
->ResetMinmax
)( target
);
2923 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2925 GET_CURRENT_CONTEXT(ctx
);
2927 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2928 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ROTATE
, 4 );
2935 if (ctx
->ExecuteFlag
) {
2936 (*ctx
->Exec
->Rotatef
)( angle
, x
, y
, z
);
2941 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2943 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
2947 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2949 GET_CURRENT_CONTEXT(ctx
);
2951 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2952 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCALE
, 3 );
2958 if (ctx
->ExecuteFlag
) {
2959 (*ctx
->Exec
->Scalef
)( x
, y
, z
);
2964 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
2966 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
2970 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
2972 GET_CURRENT_CONTEXT(ctx
);
2974 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2975 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCISSOR
, 4 );
2982 if (ctx
->ExecuteFlag
) {
2983 (*ctx
->Exec
->Scissor
)( x
, y
, width
, height
);
2988 static void save_ShadeModel( GLenum mode
)
2990 GET_CURRENT_CONTEXT(ctx
);
2992 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2993 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SHADE_MODEL
, 1 );
2997 if (ctx
->ExecuteFlag
) {
2998 (*ctx
->Exec
->ShadeModel
)( mode
);
3003 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
3005 GET_CURRENT_CONTEXT(ctx
);
3007 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3008 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_FUNC
, 3 );
3014 if (ctx
->ExecuteFlag
) {
3015 (*ctx
->Exec
->StencilFunc
)( func
, ref
, mask
);
3020 static void save_StencilMask( GLuint mask
)
3022 GET_CURRENT_CONTEXT(ctx
);
3024 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3025 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_MASK
, 1 );
3029 if (ctx
->ExecuteFlag
) {
3030 (*ctx
->Exec
->StencilMask
)( mask
);
3035 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
3037 GET_CURRENT_CONTEXT(ctx
);
3039 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3040 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_OP
, 3 );
3046 if (ctx
->ExecuteFlag
) {
3047 (*ctx
->Exec
->StencilOp
)( fail
, zfail
, zpass
);
3052 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
3054 GET_CURRENT_CONTEXT(ctx
);
3056 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3057 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXENV
, 6 );
3066 if (ctx
->ExecuteFlag
) {
3067 (*ctx
->Exec
->TexEnvfv
)( target
, pname
, params
);
3072 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
3074 save_TexEnvfv( target
, pname
, ¶m
);
3078 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
3081 p
[0] = (GLfloat
) param
;
3082 p
[1] = p
[2] = p
[3] = 0.0;
3083 save_TexEnvfv( target
, pname
, p
);
3087 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
3090 p
[0] = INT_TO_FLOAT( param
[0] );
3091 p
[1] = INT_TO_FLOAT( param
[1] );
3092 p
[2] = INT_TO_FLOAT( param
[2] );
3093 p
[3] = INT_TO_FLOAT( param
[3] );
3094 save_TexEnvfv( target
, pname
, p
);
3098 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
3100 GET_CURRENT_CONTEXT(ctx
);
3102 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3103 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXGEN
, 6 );
3112 if (ctx
->ExecuteFlag
) {
3113 (*ctx
->Exec
->TexGenfv
)( coord
, pname
, params
);
3118 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3121 p
[0] = (GLfloat
) params
[0];
3122 p
[1] = (GLfloat
) params
[1];
3123 p
[2] = (GLfloat
) params
[2];
3124 p
[3] = (GLfloat
) params
[3];
3125 save_TexGenfv(coord
, pname
, p
);
3129 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3131 GLfloat p
= (GLfloat
) param
;
3132 save_TexGenfv( coord
, pname
, &p
);
3136 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3139 p
[0] = (GLfloat
) params
[0];
3140 p
[1] = (GLfloat
) params
[1];
3141 p
[2] = (GLfloat
) params
[2];
3142 p
[3] = (GLfloat
) params
[3];
3143 save_TexGenfv( coord
, pname
, p
);
3147 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
3149 save_TexGenfv(coord
, pname
, ¶m
);
3153 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
3155 save_TexGeniv( coord
, pname
, ¶m
);
3159 static void save_TexParameterfv( GLenum target
,
3160 GLenum pname
, const GLfloat
*params
)
3162 GET_CURRENT_CONTEXT(ctx
);
3164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3165 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXPARAMETER
, 6 );
3174 if (ctx
->ExecuteFlag
) {
3175 (*ctx
->Exec
->TexParameterfv
)( target
, pname
, params
);
3180 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
3182 save_TexParameterfv(target
, pname
, ¶m
);
3186 static void save_TexParameteri( GLenum target
, GLenum pname
, GLint param
)
3189 fparam
[0] = (GLfloat
) param
;
3190 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3191 save_TexParameterfv(target
, pname
, fparam
);
3195 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
3198 fparam
[0] = (GLfloat
) params
[0];
3199 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3200 save_TexParameterfv(target
, pname
, fparam
);
3204 static void save_TexImage1D( GLenum target
,
3205 GLint level
, GLint components
,
3206 GLsizei width
, GLint border
,
3207 GLenum format
, GLenum type
,
3208 const GLvoid
*pixels
)
3210 GET_CURRENT_CONTEXT(ctx
);
3211 if (target
== GL_PROXY_TEXTURE_1D
) {
3212 /* don't compile, execute immediately */
3213 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3214 border
, format
, type
, pixels
);
3217 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3218 pixels
, &ctx
->Unpack
);
3220 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3221 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
3225 n
[3].i
= components
;
3226 n
[4].i
= (GLint
) width
;
3235 if (ctx
->ExecuteFlag
) {
3236 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3237 border
, format
, type
, pixels
);
3243 static void save_TexImage2D( GLenum target
,
3244 GLint level
, GLint components
,
3245 GLsizei width
, GLsizei height
, GLint border
,
3246 GLenum format
, GLenum type
,
3247 const GLvoid
*pixels
)
3249 GET_CURRENT_CONTEXT(ctx
);
3250 if (target
== GL_PROXY_TEXTURE_2D
) {
3251 /* don't compile, execute immediately */
3252 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3253 height
, border
, format
, type
, pixels
);
3256 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3257 pixels
, &ctx
->Unpack
);
3259 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3260 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
3264 n
[3].i
= components
;
3265 n
[4].i
= (GLint
) width
;
3266 n
[5].i
= (GLint
) height
;
3275 if (ctx
->ExecuteFlag
) {
3276 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3277 height
, border
, format
, type
, pixels
);
3283 static void save_TexImage3D( GLenum target
,
3284 GLint level
, GLint internalFormat
,
3285 GLsizei width
, GLsizei height
, GLsizei depth
,
3287 GLenum format
, GLenum type
,
3288 const GLvoid
*pixels
)
3290 GET_CURRENT_CONTEXT(ctx
);
3291 if (target
== GL_PROXY_TEXTURE_3D
) {
3292 /* don't compile, execute immediately */
3293 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3294 height
, depth
, border
, format
, type
, pixels
);
3298 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3299 pixels
, &ctx
->Unpack
);
3300 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3301 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
3305 n
[3].i
= (GLint
) internalFormat
;
3306 n
[4].i
= (GLint
) width
;
3307 n
[5].i
= (GLint
) height
;
3308 n
[6].i
= (GLint
) depth
;
3317 if (ctx
->ExecuteFlag
) {
3318 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3319 height
, depth
, border
, format
, type
, pixels
);
3325 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
3326 GLsizei width
, GLenum format
, GLenum type
,
3327 const GLvoid
*pixels
)
3329 GET_CURRENT_CONTEXT(ctx
);
3331 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3332 pixels
, &ctx
->Unpack
);
3333 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3334 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
3339 n
[4].i
= (GLint
) width
;
3347 if (ctx
->ExecuteFlag
) {
3348 (*ctx
->Exec
->TexSubImage1D
)( target
, level
, xoffset
, width
,
3349 format
, type
, pixels
);
3354 static void save_TexSubImage2D( GLenum target
, GLint level
,
3355 GLint xoffset
, GLint yoffset
,
3356 GLsizei width
, GLsizei height
,
3357 GLenum format
, GLenum type
,
3358 const GLvoid
*pixels
)
3360 GET_CURRENT_CONTEXT(ctx
);
3362 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3363 pixels
, &ctx
->Unpack
);
3364 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3365 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
3371 n
[5].i
= (GLint
) width
;
3372 n
[6].i
= (GLint
) height
;
3380 if (ctx
->ExecuteFlag
) {
3381 (*ctx
->Exec
->TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
3382 width
, height
, format
, type
, pixels
);
3387 static void save_TexSubImage3D( GLenum target
, GLint level
,
3388 GLint xoffset
, GLint yoffset
,GLint zoffset
,
3389 GLsizei width
, GLsizei height
, GLsizei depth
,
3390 GLenum format
, GLenum type
,
3391 const GLvoid
*pixels
)
3393 GET_CURRENT_CONTEXT(ctx
);
3395 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3396 pixels
, &ctx
->Unpack
);
3397 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3398 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
3405 n
[6].i
= (GLint
) width
;
3406 n
[7].i
= (GLint
) height
;
3407 n
[8].i
= (GLint
) depth
;
3415 if (ctx
->ExecuteFlag
) {
3416 (*ctx
->Exec
->TexSubImage3D
)( target
, level
,
3417 xoffset
, yoffset
, zoffset
,
3418 width
, height
, depth
, format
, type
, pixels
);
3423 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
3425 GET_CURRENT_CONTEXT(ctx
);
3427 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3428 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRANSLATE
, 3 );
3434 if (ctx
->ExecuteFlag
) {
3435 (*ctx
->Exec
->Translatef
)( x
, y
, z
);
3440 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3442 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3447 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3449 GET_CURRENT_CONTEXT(ctx
);
3451 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3452 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_VIEWPORT
, 4 );
3456 n
[3].i
= (GLint
) width
;
3457 n
[4].i
= (GLint
) height
;
3459 if (ctx
->ExecuteFlag
) {
3460 (*ctx
->Exec
->Viewport
)( x
, y
, width
, height
);
3465 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3467 GET_CURRENT_CONTEXT(ctx
);
3469 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3470 FLUSH_CURRENT(ctx
, 0);
3471 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_WINDOW_POS
, 4 );
3478 if (ctx
->ExecuteFlag
) {
3479 (*ctx
->Exec
->WindowPos4fMESA
)( x
, y
, z
, w
);
3483 static void save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3485 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3488 static void save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3490 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3493 static void save_WindowPos2iMESA(GLint x
, GLint y
)
3495 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3498 static void save_WindowPos2sMESA(GLshort x
, GLshort y
)
3500 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3503 static void save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3505 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3508 static void save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3510 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3513 static void save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3515 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3518 static void save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3520 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3523 static void save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3525 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3528 static void save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3530 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3533 static void save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3535 save_WindowPos4fMESA(x
, y
, z
, w
);
3538 static void save_WindowPos2dvMESA(const GLdouble
*v
)
3540 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3543 static void save_WindowPos2fvMESA(const GLfloat
*v
)
3545 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3548 static void save_WindowPos2ivMESA(const GLint
*v
)
3550 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3553 static void save_WindowPos2svMESA(const GLshort
*v
)
3555 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3558 static void save_WindowPos3dvMESA(const GLdouble
*v
)
3560 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3563 static void save_WindowPos3fvMESA(const GLfloat
*v
)
3565 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3568 static void save_WindowPos3ivMESA(const GLint
*v
)
3570 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3573 static void save_WindowPos3svMESA(const GLshort
*v
)
3575 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3578 static void save_WindowPos4dvMESA(const GLdouble
*v
)
3580 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3581 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3584 static void save_WindowPos4fvMESA(const GLfloat
*v
)
3586 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3589 static void save_WindowPos4ivMESA(const GLint
*v
)
3591 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3592 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3595 static void save_WindowPos4svMESA(const GLshort
*v
)
3597 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3602 /* GL_ARB_multitexture */
3603 static void save_ActiveTextureARB( GLenum target
)
3605 GET_CURRENT_CONTEXT(ctx
);
3607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3608 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3612 if (ctx
->ExecuteFlag
) {
3613 (*ctx
->Exec
->ActiveTextureARB
)( target
);
3618 /* GL_ARB_transpose_matrix */
3620 static void save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3623 _math_transposefd(tm
, m
);
3624 save_LoadMatrixf(tm
);
3628 static void save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3631 _math_transposef(tm
, m
);
3632 save_LoadMatrixf(tm
);
3637 save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3640 _math_transposefd(tm
, m
);
3641 save_MultMatrixf(tm
);
3646 save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3649 _math_transposef(tm
, m
);
3650 save_MultMatrixf(tm
);
3655 save_PixelTexGenSGIX(GLenum mode
)
3657 GET_CURRENT_CONTEXT(ctx
);
3659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3660 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_SGIX
, 1 );
3664 if (ctx
->ExecuteFlag
) {
3665 (*ctx
->Exec
->PixelTexGenSGIX
)( mode
);
3670 /* GL_ARB_texture_compression */
3672 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3673 GLenum internalFormat
, GLsizei width
,
3674 GLint border
, GLsizei imageSize
,
3677 GET_CURRENT_CONTEXT(ctx
);
3678 if (target
== GL_PROXY_TEXTURE_1D
) {
3679 /* don't compile, execute immediately */
3680 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3681 width
, border
, imageSize
, data
);
3686 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3687 /* make copy of image */
3688 image
= MALLOC(imageSize
);
3690 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3693 MEMCPY(image
, data
, imageSize
);
3694 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7 );
3698 n
[3].e
= internalFormat
;
3699 n
[4].i
= (GLint
) width
;
3707 if (ctx
->ExecuteFlag
) {
3708 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3709 width
, border
, imageSize
, data
);
3716 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
3717 GLenum internalFormat
, GLsizei width
,
3718 GLsizei height
, GLint border
, GLsizei imageSize
,
3721 GET_CURRENT_CONTEXT(ctx
);
3722 if (target
== GL_PROXY_TEXTURE_2D
) {
3723 /* don't compile, execute immediately */
3724 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3725 width
, height
, border
, imageSize
, data
);
3730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3731 /* make copy of image */
3732 image
= MALLOC(imageSize
);
3734 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
3737 MEMCPY(image
, data
, imageSize
);
3738 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8 );
3742 n
[3].e
= internalFormat
;
3743 n
[4].i
= (GLint
) width
;
3744 n
[5].i
= (GLint
) height
;
3752 if (ctx
->ExecuteFlag
) {
3753 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3754 width
, height
, border
, imageSize
, data
);
3761 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
3762 GLenum internalFormat
, GLsizei width
,
3763 GLsizei height
, GLsizei depth
, GLint border
,
3764 GLsizei imageSize
, const GLvoid
*data
)
3766 GET_CURRENT_CONTEXT(ctx
);
3767 if (target
== GL_PROXY_TEXTURE_3D
) {
3768 /* don't compile, execute immediately */
3769 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3770 width
, height
, depth
, border
, imageSize
, data
);
3775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3776 /* make copy of image */
3777 image
= MALLOC(imageSize
);
3779 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
3782 MEMCPY(image
, data
, imageSize
);
3783 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9 );
3787 n
[3].e
= internalFormat
;
3788 n
[4].i
= (GLint
) width
;
3789 n
[5].i
= (GLint
) height
;
3790 n
[6].i
= (GLint
) depth
;
3798 if (ctx
->ExecuteFlag
) {
3799 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3800 width
, height
, depth
, border
, imageSize
, data
);
3807 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
3808 GLsizei width
, GLenum format
,
3809 GLsizei imageSize
, const GLvoid
*data
)
3814 GET_CURRENT_CONTEXT(ctx
);
3815 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3817 /* make copy of image */
3818 image
= MALLOC(imageSize
);
3820 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
3823 MEMCPY(image
, data
, imageSize
);
3824 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7 );
3829 n
[4].i
= (GLint
) width
;
3837 if (ctx
->ExecuteFlag
) {
3838 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(target
, level
, xoffset
,
3839 width
, format
, imageSize
, data
);
3845 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
3846 GLint yoffset
, GLsizei width
, GLsizei height
,
3847 GLenum format
, GLsizei imageSize
,
3853 GET_CURRENT_CONTEXT(ctx
);
3854 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3856 /* make copy of image */
3857 image
= MALLOC(imageSize
);
3859 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
3862 MEMCPY(image
, data
, imageSize
);
3863 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9 );
3869 n
[5].i
= (GLint
) width
;
3870 n
[6].i
= (GLint
) height
;
3878 if (ctx
->ExecuteFlag
) {
3879 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(target
, level
, xoffset
, yoffset
,
3880 width
, height
, format
, imageSize
, data
);
3886 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
3887 GLint yoffset
, GLint zoffset
, GLsizei width
,
3888 GLsizei height
, GLsizei depth
, GLenum format
,
3889 GLsizei imageSize
, const GLvoid
*data
)
3894 GET_CURRENT_CONTEXT(ctx
);
3895 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3897 /* make copy of image */
3898 image
= MALLOC(imageSize
);
3900 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
3903 MEMCPY(image
, data
, imageSize
);
3904 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11 );
3911 n
[6].i
= (GLint
) width
;
3912 n
[7].i
= (GLint
) height
;
3913 n
[8].i
= (GLint
) depth
;
3915 n
[10].i
= imageSize
;
3921 if (ctx
->ExecuteFlag
) {
3922 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(target
, level
, xoffset
, yoffset
,
3923 zoffset
, width
, height
, depth
, format
, imageSize
, data
);
3928 /* GL_ARB_multisample */
3930 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
3932 GET_CURRENT_CONTEXT(ctx
);
3934 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3935 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SAMPLE_COVERAGE
, 2 );
3940 if (ctx
->ExecuteFlag
) {
3941 (*ctx
->Exec
->SampleCoverageARB
)( value
, invert
);
3946 /* GL_SGIS_pixel_texture */
3949 save_PixelTexGenParameteriSGIS(GLenum target
, GLint value
)
3951 GET_CURRENT_CONTEXT(ctx
);
3953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3954 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
, 2 );
3959 if (ctx
->ExecuteFlag
) {
3960 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( target
, value
);
3966 save_PixelTexGenParameterfSGIS(GLenum target
, GLfloat value
)
3968 save_PixelTexGenParameteriSGIS(target
, (GLint
) value
);
3973 save_PixelTexGenParameterivSGIS(GLenum target
, const GLint
*value
)
3975 save_PixelTexGenParameteriSGIS(target
, *value
);
3980 save_PixelTexGenParameterfvSGIS(GLenum target
, const GLfloat
*value
)
3982 save_PixelTexGenParameteriSGIS(target
, (GLint
) *value
);
3987 * GL_NV_vertex_program
3989 #if FEATURE_NV_vertex_program
3991 save_BindProgramNV(GLenum target
, GLuint id
)
3993 GET_CURRENT_CONTEXT(ctx
);
3995 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3996 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_PROGRAM_NV
, 2 );
4001 if (ctx
->ExecuteFlag
) {
4002 (*ctx
->Exec
->BindProgramNV
)( target
, id
);
4007 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4009 GET_CURRENT_CONTEXT(ctx
);
4011 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4012 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6 );
4021 if (ctx
->ExecuteFlag
) {
4022 (*ctx
->Exec
->ExecuteProgramNV
)(target
, id
, params
);
4028 save_ProgramParameter4fNV(GLenum target
, GLuint index
,
4029 GLfloat x
, GLfloat y
,
4030 GLfloat z
, GLfloat w
)
4032 GET_CURRENT_CONTEXT(ctx
);
4034 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4035 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_PARAMETER4F_NV
, 6 );
4044 if (ctx
->ExecuteFlag
) {
4045 (*ctx
->Exec
->ProgramParameter4fNV
)(target
, index
, x
, y
, z
, w
);
4051 save_ProgramParameter4fvNV(GLenum target
, GLuint index
, const GLfloat
*params
)
4053 save_ProgramParameter4fNV(target
, index
, params
[0], params
[1],
4054 params
[2], params
[3]);
4059 save_ProgramParameter4dNV(GLenum target
, GLuint index
,
4060 GLdouble x
, GLdouble y
,
4061 GLdouble z
, GLdouble w
)
4063 save_ProgramParameter4fNV(target
, index
, (GLfloat
) x
, (GLfloat
) y
,
4064 (GLfloat
) z
, (GLfloat
) w
);
4069 save_ProgramParameter4dvNV(GLenum target
, GLuint index
,
4070 const GLdouble
*params
)
4072 save_ProgramParameter4fNV(target
, index
, (GLfloat
) params
[0],
4073 (GLfloat
) params
[1], (GLfloat
) params
[2],
4074 (GLfloat
) params
[3]);
4079 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4080 GLuint num
, const GLdouble
*params
)
4083 for (i
= 0; i
< num
; i
++) {
4084 save_ProgramParameter4dvNV(target
, index
+ i
, params
+ 4 * i
);
4090 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4091 GLuint num
, const GLfloat
*params
)
4094 for (i
= 0; i
< num
; i
++) {
4095 save_ProgramParameter4fvNV(target
, index
+ i
, params
+ 4 * i
);
4102 save_TrackMatrixNV(GLenum target
, GLuint address
,
4103 GLenum matrix
, GLenum transform
)
4105 GET_CURRENT_CONTEXT(ctx
);
4107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4108 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRACK_MATRIX_NV
, 4 );
4115 if (ctx
->ExecuteFlag
) {
4116 (*ctx
->Exec
->TrackMatrixNV
)(target
, address
, matrix
, transform
);
4119 #endif /* FEATURE_NV_vertex_program */
4122 /* GL_EXT_stencil_two_side */
4123 static void save_ActiveStencilFaceEXT( GLenum face
)
4125 GET_CURRENT_CONTEXT(ctx
);
4127 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4128 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1 );
4132 if (ctx
->ExecuteFlag
) {
4133 (*ctx
->Exec
->ActiveStencilFaceEXT
)( face
);
4139 /* KW: Compile commands
4141 * Will appear in the list before the vertex buffer containing the
4142 * command that provoked the error. I don't see this as a problem.
4145 _mesa_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
4148 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ERROR
, 2 );
4151 n
[2].data
= (void *) s
;
4153 /* execute already done */
4158 * Compile an error into current display list.
4161 _mesa_compile_error( GLcontext
*ctx
, GLenum error
, const char *s
)
4163 if (ctx
->CompileFlag
)
4164 _mesa_save_error( ctx
, error
, s
);
4166 if (ctx
->ExecuteFlag
)
4167 _mesa_error( ctx
, error
, s
);
4173 islist(GLcontext
*ctx
, GLuint list
)
4175 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
4185 /**********************************************************************/
4186 /* Display list execution */
4187 /**********************************************************************/
4191 * Execute a display list. Note that the ListBase offset must have already
4192 * been added before calling this function. I.e. the list argument is
4193 * the absolute list number, not relative to ListBase.
4194 * Input: list - display list number
4197 execute_list( GLcontext
*ctx
, GLuint list
)
4202 if (!islist(ctx
,list
))
4205 if (ctx
->Driver
.BeginCallList
)
4206 ctx
->Driver
.BeginCallList( ctx
, list
);
4210 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
4214 OpCode opcode
= n
[0].opcode
;
4215 int i
= (int)n
[0].opcode
- (int)OPCODE_DRV_0
;
4217 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
4218 ctx
->listext
.opcode
[i
].execute(ctx
, &n
[1]);
4219 n
+= ctx
->listext
.opcode
[i
].size
;
4224 _mesa_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
4227 (*ctx
->Exec
->Accum
)( n
[1].e
, n
[2].f
);
4229 case OPCODE_ALPHA_FUNC
:
4230 (*ctx
->Exec
->AlphaFunc
)( n
[1].e
, n
[2].f
);
4232 case OPCODE_BIND_TEXTURE
:
4233 (*ctx
->Exec
->BindTexture
)( n
[1].e
, n
[2].ui
);
4237 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4238 ctx
->Unpack
= _mesa_native_packing
;
4239 (*ctx
->Exec
->Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
4240 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (const GLubyte
*) n
[7].data
);
4241 ctx
->Unpack
= save
; /* restore */
4244 case OPCODE_BLEND_COLOR
:
4245 (*ctx
->Exec
->BlendColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4247 case OPCODE_BLEND_EQUATION
:
4248 (*ctx
->Exec
->BlendEquation
)( n
[1].e
);
4250 case OPCODE_BLEND_FUNC
:
4251 (*ctx
->Exec
->BlendFunc
)( n
[1].e
, n
[2].e
);
4253 case OPCODE_BLEND_FUNC_SEPARATE
:
4254 (*ctx
->Exec
->BlendFuncSeparateEXT
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
4256 case OPCODE_CALL_LIST
:
4257 /* Generated by glCallList(), don't add ListBase */
4258 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4259 execute_list( ctx
, n
[1].ui
);
4262 case OPCODE_CALL_LIST_OFFSET
:
4263 /* Generated by glCallLists() so we must add ListBase */
4265 /* user specified a bad datatype at compile time */
4266 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
4268 else if (ctx
->CallDepth
< MAX_LIST_NESTING
) {
4269 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
4273 (*ctx
->Exec
->Clear
)( n
[1].bf
);
4275 case OPCODE_CLEAR_COLOR
:
4276 (*ctx
->Exec
->ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4278 case OPCODE_CLEAR_ACCUM
:
4279 (*ctx
->Exec
->ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4281 case OPCODE_CLEAR_DEPTH
:
4282 (*ctx
->Exec
->ClearDepth
)( (GLclampd
) n
[1].f
);
4284 case OPCODE_CLEAR_INDEX
:
4285 (*ctx
->Exec
->ClearIndex
)( (GLfloat
) n
[1].ui
);
4287 case OPCODE_CLEAR_STENCIL
:
4288 (*ctx
->Exec
->ClearStencil
)( n
[1].i
);
4290 case OPCODE_CLIP_PLANE
:
4297 (*ctx
->Exec
->ClipPlane
)( n
[1].e
, eq
);
4300 case OPCODE_COLOR_MASK
:
4301 (*ctx
->Exec
->ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
4303 case OPCODE_COLOR_MATERIAL
:
4304 (*ctx
->Exec
->ColorMaterial
)( n
[1].e
, n
[2].e
);
4306 case OPCODE_COLOR_TABLE
:
4308 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4309 ctx
->Unpack
= _mesa_native_packing
;
4310 (*ctx
->Exec
->ColorTable
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
4311 n
[5].e
, n
[6].data
);
4312 ctx
->Unpack
= save
; /* restore */
4315 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
4322 (*ctx
->Exec
->ColorTableParameterfv
)( n
[1].e
, n
[2].e
, params
);
4325 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
4332 (*ctx
->Exec
->ColorTableParameteriv
)( n
[1].e
, n
[2].e
, params
);
4335 case OPCODE_COLOR_SUB_TABLE
:
4337 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4338 ctx
->Unpack
= _mesa_native_packing
;
4339 (*ctx
->Exec
->ColorSubTable
)( n
[1].e
, n
[2].i
, n
[3].i
,
4340 n
[4].e
, n
[5].e
, n
[6].data
);
4341 ctx
->Unpack
= save
; /* restore */
4344 case OPCODE_CONVOLUTION_FILTER_1D
:
4346 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4347 ctx
->Unpack
= _mesa_native_packing
;
4348 (*ctx
->Exec
->ConvolutionFilter1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4349 n
[4].e
, n
[5].e
, n
[6].data
);
4350 ctx
->Unpack
= save
; /* restore */
4353 case OPCODE_CONVOLUTION_FILTER_2D
:
4355 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4356 ctx
->Unpack
= _mesa_native_packing
;
4357 (*ctx
->Exec
->ConvolutionFilter2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4358 n
[4].i
, n
[5].e
, n
[6].e
, n
[7].data
);
4359 ctx
->Unpack
= save
; /* restore */
4362 case OPCODE_CONVOLUTION_PARAMETER_I
:
4363 (*ctx
->Exec
->ConvolutionParameteri
)( n
[1].e
, n
[2].e
, n
[3].i
);
4365 case OPCODE_CONVOLUTION_PARAMETER_IV
:
4372 (*ctx
->Exec
->ConvolutionParameteriv
)( n
[1].e
, n
[2].e
, params
);
4375 case OPCODE_CONVOLUTION_PARAMETER_F
:
4376 (*ctx
->Exec
->ConvolutionParameterf
)( n
[1].e
, n
[2].e
, n
[3].f
);
4378 case OPCODE_CONVOLUTION_PARAMETER_FV
:
4385 (*ctx
->Exec
->ConvolutionParameterfv
)( n
[1].e
, n
[2].e
, params
);
4388 case OPCODE_COPY_COLOR_SUB_TABLE
:
4389 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4390 n
[3].i
, n
[4].i
, n
[5].i
);
4392 case OPCODE_COPY_COLOR_TABLE
:
4393 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4394 n
[3].i
, n
[4].i
, n
[5].i
);
4396 case OPCODE_COPY_PIXELS
:
4397 (*ctx
->Exec
->CopyPixels
)( n
[1].i
, n
[2].i
,
4398 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
4400 case OPCODE_COPY_TEX_IMAGE1D
:
4401 (*ctx
->Exec
->CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4402 n
[5].i
, n
[6].i
, n
[7].i
);
4404 case OPCODE_COPY_TEX_IMAGE2D
:
4405 (*ctx
->Exec
->CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4406 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4408 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
4409 (*ctx
->Exec
->CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4410 n
[4].i
, n
[5].i
, n
[6].i
);
4412 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
4413 (*ctx
->Exec
->CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4414 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4416 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
4417 (*ctx
->Exec
->CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4418 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
4420 case OPCODE_CULL_FACE
:
4421 (*ctx
->Exec
->CullFace
)( n
[1].e
);
4423 case OPCODE_DEPTH_FUNC
:
4424 (*ctx
->Exec
->DepthFunc
)( n
[1].e
);
4426 case OPCODE_DEPTH_MASK
:
4427 (*ctx
->Exec
->DepthMask
)( n
[1].b
);
4429 case OPCODE_DEPTH_RANGE
:
4430 (*ctx
->Exec
->DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
4432 case OPCODE_DISABLE
:
4433 (*ctx
->Exec
->Disable
)( n
[1].e
);
4435 case OPCODE_DRAW_BUFFER
:
4436 (*ctx
->Exec
->DrawBuffer
)( n
[1].e
);
4438 case OPCODE_DRAW_PIXELS
:
4440 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4441 ctx
->Unpack
= _mesa_native_packing
;
4442 (*ctx
->Exec
->DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
4444 ctx
->Unpack
= save
; /* restore */
4448 (*ctx
->Exec
->Enable
)( n
[1].e
);
4450 case OPCODE_EVALMESH1
:
4451 (*ctx
->Exec
->EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
4453 case OPCODE_EVALMESH2
:
4454 (*ctx
->Exec
->EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
4463 (*ctx
->Exec
->Fogfv
)( n
[1].e
, p
);
4466 case OPCODE_FRONT_FACE
:
4467 (*ctx
->Exec
->FrontFace
)( n
[1].e
);
4469 case OPCODE_FRUSTUM
:
4470 (*ctx
->Exec
->Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4473 (*ctx
->Exec
->Hint
)( n
[1].e
, n
[2].e
);
4475 case OPCODE_HISTOGRAM
:
4476 (*ctx
->Exec
->Histogram
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
);
4478 case OPCODE_INDEX_MASK
:
4479 (*ctx
->Exec
->IndexMask
)( n
[1].ui
);
4481 case OPCODE_INIT_NAMES
:
4482 (*ctx
->Exec
->InitNames
)();
4491 (*ctx
->Exec
->Lightfv
)( n
[1].e
, n
[2].e
, p
);
4494 case OPCODE_LIGHT_MODEL
:
4501 (*ctx
->Exec
->LightModelfv
)( n
[1].e
, p
);
4504 case OPCODE_LINE_STIPPLE
:
4505 (*ctx
->Exec
->LineStipple
)( n
[1].i
, n
[2].us
);
4507 case OPCODE_LINE_WIDTH
:
4508 (*ctx
->Exec
->LineWidth
)( n
[1].f
);
4510 case OPCODE_LIST_BASE
:
4511 (*ctx
->Exec
->ListBase
)( n
[1].ui
);
4513 case OPCODE_LOAD_IDENTITY
:
4514 (*ctx
->Exec
->LoadIdentity
)();
4516 case OPCODE_LOAD_MATRIX
:
4517 if (sizeof(Node
)==sizeof(GLfloat
)) {
4518 (*ctx
->Exec
->LoadMatrixf
)( &n
[1].f
);
4523 for (i
=0;i
<16;i
++) {
4526 (*ctx
->Exec
->LoadMatrixf
)( m
);
4529 case OPCODE_LOAD_NAME
:
4530 (*ctx
->Exec
->LoadName
)( n
[1].ui
);
4532 case OPCODE_LOGIC_OP
:
4533 (*ctx
->Exec
->LogicOp
)( n
[1].e
);
4537 GLenum target
= n
[1].e
;
4538 GLint ustride
= _mesa_evaluator_components(target
);
4539 GLint uorder
= n
[5].i
;
4540 GLfloat u1
= n
[2].f
;
4541 GLfloat u2
= n
[3].f
;
4542 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, ustride
, uorder
,
4543 (GLfloat
*) n
[6].data
);
4548 GLenum target
= n
[1].e
;
4549 GLfloat u1
= n
[2].f
;
4550 GLfloat u2
= n
[3].f
;
4551 GLfloat v1
= n
[4].f
;
4552 GLfloat v2
= n
[5].f
;
4553 GLint ustride
= n
[6].i
;
4554 GLint vstride
= n
[7].i
;
4555 GLint uorder
= n
[8].i
;
4556 GLint vorder
= n
[9].i
;
4557 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
4558 v1
, v2
, vstride
, vorder
,
4559 (GLfloat
*) n
[10].data
);
4562 case OPCODE_MAPGRID1
:
4563 (*ctx
->Exec
->MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
4565 case OPCODE_MAPGRID2
:
4566 (*ctx
->Exec
->MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
4568 case OPCODE_MATRIX_MODE
:
4569 (*ctx
->Exec
->MatrixMode
)( n
[1].e
);
4571 case OPCODE_MIN_MAX
:
4572 (*ctx
->Exec
->Minmax
)(n
[1].e
, n
[2].e
, n
[3].b
);
4574 case OPCODE_MULT_MATRIX
:
4575 if (sizeof(Node
)==sizeof(GLfloat
)) {
4576 (*ctx
->Exec
->MultMatrixf
)( &n
[1].f
);
4581 for (i
=0;i
<16;i
++) {
4584 (*ctx
->Exec
->MultMatrixf
)( m
);
4588 (*ctx
->Exec
->Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4590 case OPCODE_PASSTHROUGH
:
4591 (*ctx
->Exec
->PassThrough
)( n
[1].f
);
4593 case OPCODE_PIXEL_MAP
:
4594 (*ctx
->Exec
->PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
4596 case OPCODE_PIXEL_TRANSFER
:
4597 (*ctx
->Exec
->PixelTransferf
)( n
[1].e
, n
[2].f
);
4599 case OPCODE_PIXEL_ZOOM
:
4600 (*ctx
->Exec
->PixelZoom
)( n
[1].f
, n
[2].f
);
4602 case OPCODE_POINT_SIZE
:
4603 (*ctx
->Exec
->PointSize
)( n
[1].f
);
4605 case OPCODE_POINT_PARAMETERS
:
4611 (*ctx
->Exec
->PointParameterfvEXT
)( n
[1].e
, params
);
4614 case OPCODE_POLYGON_MODE
:
4615 (*ctx
->Exec
->PolygonMode
)( n
[1].e
, n
[2].e
);
4617 case OPCODE_POLYGON_STIPPLE
:
4618 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) n
[1].data
);
4620 case OPCODE_POLYGON_OFFSET
:
4621 (*ctx
->Exec
->PolygonOffset
)( n
[1].f
, n
[2].f
);
4623 case OPCODE_POP_ATTRIB
:
4624 (*ctx
->Exec
->PopAttrib
)();
4626 case OPCODE_POP_MATRIX
:
4627 (*ctx
->Exec
->PopMatrix
)();
4629 case OPCODE_POP_NAME
:
4630 (*ctx
->Exec
->PopName
)();
4632 case OPCODE_PRIORITIZE_TEXTURE
:
4633 (*ctx
->Exec
->PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
4635 case OPCODE_PUSH_ATTRIB
:
4636 (*ctx
->Exec
->PushAttrib
)( n
[1].bf
);
4638 case OPCODE_PUSH_MATRIX
:
4639 (*ctx
->Exec
->PushMatrix
)();
4641 case OPCODE_PUSH_NAME
:
4642 (*ctx
->Exec
->PushName
)( n
[1].ui
);
4644 case OPCODE_RASTER_POS
:
4645 (*ctx
->Exec
->RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4647 case OPCODE_READ_BUFFER
:
4648 (*ctx
->Exec
->ReadBuffer
)( n
[1].e
);
4650 case OPCODE_RESET_HISTOGRAM
:
4651 (*ctx
->Exec
->ResetHistogram
)( n
[1].e
);
4653 case OPCODE_RESET_MIN_MAX
:
4654 (*ctx
->Exec
->ResetMinmax
)( n
[1].e
);
4657 (*ctx
->Exec
->Rotatef
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4660 (*ctx
->Exec
->Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4662 case OPCODE_SCISSOR
:
4663 (*ctx
->Exec
->Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
4665 case OPCODE_SHADE_MODEL
:
4666 (*ctx
->Exec
->ShadeModel
)( n
[1].e
);
4668 case OPCODE_STENCIL_FUNC
:
4669 (*ctx
->Exec
->StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
4671 case OPCODE_STENCIL_MASK
:
4672 (*ctx
->Exec
->StencilMask
)( n
[1].ui
);
4674 case OPCODE_STENCIL_OP
:
4675 (*ctx
->Exec
->StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
4684 (*ctx
->Exec
->TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
4694 (*ctx
->Exec
->TexGenfv
)( n
[1].e
, n
[2].e
, params
);
4697 case OPCODE_TEXPARAMETER
:
4704 (*ctx
->Exec
->TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
4707 case OPCODE_TEX_IMAGE1D
:
4709 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4710 ctx
->Unpack
= _mesa_native_packing
;
4711 (*ctx
->Exec
->TexImage1D
)(
4712 n
[1].e
, /* target */
4714 n
[3].i
, /* components */
4716 n
[5].e
, /* border */
4717 n
[6].e
, /* format */
4720 ctx
->Unpack
= save
; /* restore */
4723 case OPCODE_TEX_IMAGE2D
:
4725 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4726 ctx
->Unpack
= _mesa_native_packing
;
4727 (*ctx
->Exec
->TexImage2D
)(
4728 n
[1].e
, /* target */
4730 n
[3].i
, /* components */
4732 n
[5].i
, /* height */
4733 n
[6].e
, /* border */
4734 n
[7].e
, /* format */
4737 ctx
->Unpack
= save
; /* restore */
4740 case OPCODE_TEX_IMAGE3D
:
4742 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4743 ctx
->Unpack
= _mesa_native_packing
;
4744 (*ctx
->Exec
->TexImage3D
)(
4745 n
[1].e
, /* target */
4747 n
[3].i
, /* components */
4749 n
[5].i
, /* height */
4751 n
[7].e
, /* border */
4752 n
[8].e
, /* format */
4755 ctx
->Unpack
= save
; /* restore */
4758 case OPCODE_TEX_SUB_IMAGE1D
:
4760 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4761 ctx
->Unpack
= _mesa_native_packing
;
4762 (*ctx
->Exec
->TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4764 n
[6].e
, n
[7].data
);
4765 ctx
->Unpack
= save
; /* restore */
4768 case OPCODE_TEX_SUB_IMAGE2D
:
4770 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4771 ctx
->Unpack
= _mesa_native_packing
;
4772 (*ctx
->Exec
->TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4774 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
4775 ctx
->Unpack
= save
; /* restore */
4778 case OPCODE_TEX_SUB_IMAGE3D
:
4780 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4781 ctx
->Unpack
= _mesa_native_packing
;
4782 (*ctx
->Exec
->TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4783 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
4784 n
[8].i
, n
[9].e
, n
[10].e
,
4786 ctx
->Unpack
= save
; /* restore */
4789 case OPCODE_TRANSLATE
:
4790 (*ctx
->Exec
->Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4792 case OPCODE_VIEWPORT
:
4793 (*ctx
->Exec
->Viewport
)(n
[1].i
, n
[2].i
,
4794 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
4796 case OPCODE_WINDOW_POS
:
4797 (*ctx
->Exec
->WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4799 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
4800 (*ctx
->Exec
->ActiveTextureARB
)( n
[1].e
);
4802 case OPCODE_PIXEL_TEXGEN_SGIX
: /* GL_SGIX_pixel_texture */
4803 (*ctx
->Exec
->PixelTexGenSGIX
)( n
[1].e
);
4805 case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
: /* GL_SGIS_pixel_texture */
4806 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( n
[1].e
, n
[2].i
);
4808 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
4809 (*ctx
->Exec
->CompressedTexImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4810 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].data
);
4812 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
4813 (*ctx
->Exec
->CompressedTexImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4814 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].data
);
4816 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
4817 (*ctx
->Exec
->CompressedTexImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4818 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].data
);
4820 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
4821 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4822 n
[4].i
, n
[5].e
, n
[6].i
, n
[7].data
);
4824 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
4825 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4826 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
, n
[9].data
);
4828 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
4829 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4830 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
4831 n
[9].e
, n
[10].i
, n
[11].data
);
4833 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
4834 (*ctx
->Exec
->SampleCoverageARB
)(n
[1].f
, n
[2].b
);
4836 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
4837 (*ctx
->Exec
->WindowPos3fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
);
4839 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
4840 (*ctx
->Exec
->BindProgramNV
)( n
[1].e
, n
[2].ui
);
4842 case OPCODE_EXECUTE_PROGRAM_NV
:
4849 (*ctx
->Exec
->ExecuteProgramNV
)(n
[1].e
, n
[2].ui
, v
);
4852 case OPCODE_REQUEST_PROGRAMS_RESIDENT_NV
:
4854 (*ctx->Exec->RequestResidentProgramsNV)();
4857 case OPCODE_LOAD_PROGRAM_NV
:
4859 (*ctx->Exec->LoadProgramNV)();
4862 case OPCODE_PROGRAM_PARAMETER4F_NV
:
4863 (*ctx
->Exec
->ProgramParameter4fNV
)(n
[1].e
, n
[2].ui
, n
[3].f
,
4864 n
[4].f
, n
[5].f
, n
[6].f
);
4866 case OPCODE_TRACK_MATRIX_NV
:
4867 (*ctx
->Exec
->TrackMatrixNV
)(n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
);
4870 case OPCODE_CONTINUE
:
4871 n
= (Node
*) n
[1].next
;
4873 case OPCODE_END_OF_LIST
:
4879 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
4880 _mesa_problem(ctx
, msg
);
4885 /* increment n to point to next compiled command */
4886 if (opcode
!=OPCODE_CONTINUE
) {
4887 n
+= InstSize
[opcode
];
4893 if (ctx
->Driver
.EndCallList
)
4894 ctx
->Driver
.EndCallList( ctx
);
4901 /**********************************************************************/
4903 /**********************************************************************/
4909 * Test if a display list number is valid.
4912 _mesa_IsList( GLuint list
)
4914 GET_CURRENT_CONTEXT(ctx
);
4915 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4916 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
4917 return islist(ctx
, list
);
4922 * Delete a sequence of consecutive display lists.
4925 _mesa_DeleteLists( GLuint list
, GLsizei range
)
4927 GET_CURRENT_CONTEXT(ctx
);
4929 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4930 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4933 _mesa_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
4936 for (i
=list
;i
<list
+range
;i
++) {
4937 _mesa_destroy_list( ctx
, i
);
4944 * Return a display list number, n, such that lists n through n+range-1
4948 _mesa_GenLists(GLsizei range
)
4950 GET_CURRENT_CONTEXT(ctx
);
4952 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4953 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
4956 _mesa_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
4964 * Make this an atomic operation
4966 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
4968 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
4970 /* reserve the list IDs by with empty/dummy lists */
4972 for (i
=0; i
<range
; i
++) {
4973 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
4977 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
4985 * Begin a new display list.
4988 _mesa_NewList( GLuint list
, GLenum mode
)
4990 GET_CURRENT_CONTEXT(ctx
);
4991 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
4992 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4994 if (MESA_VERBOSE
&VERBOSE_API
)
4995 _mesa_debug(ctx
, "glNewList %u %s\n", list
,
4996 _mesa_lookup_enum_by_nr(mode
));
4999 _mesa_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
5003 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
5004 _mesa_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
5008 if (ctx
->CurrentListPtr
) {
5009 /* already compiling a display list */
5010 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
5014 /* Allocate new display list */
5015 ctx
->CurrentListNum
= list
;
5016 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
5017 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
5018 ctx
->CurrentPos
= 0;
5019 ctx
->CompileFlag
= GL_TRUE
;
5020 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
5022 ctx
->Driver
.NewList( ctx
, list
, mode
);
5024 ctx
->CurrentDispatch
= ctx
->Save
;
5025 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5031 * End definition of current display list. Is the current
5032 * ASSERT_OUTSIDE_BEGIN_END strong enough to really guarentee that
5033 * we are outside begin/end calls?
5036 _mesa_EndList( void )
5038 GET_CURRENT_CONTEXT(ctx
);
5039 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
5040 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
5042 if (MESA_VERBOSE
&VERBOSE_API
)
5043 _mesa_debug(ctx
, "glEndList\n");
5045 /* Check that a list is under construction */
5046 if (!ctx
->CurrentListPtr
) {
5047 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
5051 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_END_OF_LIST
, 0 );
5053 /* Destroy old list, if any */
5054 _mesa_destroy_list(ctx
, ctx
->CurrentListNum
);
5055 /* Install the list */
5056 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
5059 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
5060 mesa_print_display_list(ctx
->CurrentListNum
);
5062 ctx
->CurrentListNum
= 0;
5063 ctx
->CurrentListPtr
= NULL
;
5064 ctx
->ExecuteFlag
= GL_TRUE
;
5065 ctx
->CompileFlag
= GL_FALSE
;
5067 ctx
->Driver
.EndList( ctx
);
5069 ctx
->CurrentDispatch
= ctx
->Exec
;
5070 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5076 _mesa_CallList( GLuint list
)
5078 GLboolean save_compile_flag
;
5079 GET_CURRENT_CONTEXT(ctx
);
5080 FLUSH_CURRENT(ctx
, 0);
5081 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
5082 /* execute the display list, and restore the CompileFlag. */
5085 if (MESA_VERBOSE
& VERBOSE_API
)
5086 _mesa_debug(ctx
, "_mesa_CallList %d\n", list
);
5088 /* mesa_print_display_list( list ); */
5090 save_compile_flag
= ctx
->CompileFlag
;
5091 if (save_compile_flag
) {
5092 ctx
->CompileFlag
= GL_FALSE
;
5095 execute_list( ctx
, list
);
5096 ctx
->CompileFlag
= save_compile_flag
;
5098 /* also restore API function pointers to point to "save" versions */
5099 if (save_compile_flag
) {
5100 ctx
->CurrentDispatch
= ctx
->Save
;
5101 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5108 * Execute glCallLists: call multiple display lists.
5111 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
5113 GET_CURRENT_CONTEXT(ctx
);
5116 GLboolean save_compile_flag
;
5118 if (MESA_VERBOSE
& VERBOSE_API
)
5119 _mesa_debug(ctx
, "_mesa_CallLists %d\n", n
);
5123 case GL_UNSIGNED_BYTE
:
5125 case GL_UNSIGNED_SHORT
:
5127 case GL_UNSIGNED_INT
:
5135 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5139 /* Save the CompileFlag status, turn it off, execute display list,
5140 * and restore the CompileFlag.
5142 save_compile_flag
= ctx
->CompileFlag
;
5143 ctx
->CompileFlag
= GL_FALSE
;
5146 list
= translate_id( i
, type
, lists
);
5147 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
5150 ctx
->CompileFlag
= save_compile_flag
;
5152 /* also restore API function pointers to point to "save" versions */
5153 if (save_compile_flag
) {
5154 ctx
->CurrentDispatch
= ctx
->Save
;
5155 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5162 * Set the offset added to list numbers in glCallLists.
5165 _mesa_ListBase( GLuint base
)
5167 GET_CURRENT_CONTEXT(ctx
);
5168 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
5169 ASSERT_OUTSIDE_BEGIN_END(ctx
);
5170 ctx
->List
.ListBase
= base
;
5174 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
5176 static void exec_Finish( void )
5178 GET_CURRENT_CONTEXT(ctx
);
5179 FLUSH_VERTICES(ctx
, 0);
5180 ctx
->Exec
->Finish();
5183 static void exec_Flush( void )
5185 GET_CURRENT_CONTEXT(ctx
);
5186 FLUSH_VERTICES(ctx
, 0);
5187 ctx
->Exec
->Flush( );
5190 static void exec_GetBooleanv( GLenum pname
, GLboolean
*params
)
5192 GET_CURRENT_CONTEXT(ctx
);
5193 FLUSH_VERTICES(ctx
, 0);
5194 ctx
->Exec
->GetBooleanv( pname
, params
);
5197 static void exec_GetClipPlane( GLenum plane
, GLdouble
*equation
)
5199 GET_CURRENT_CONTEXT(ctx
);
5200 FLUSH_VERTICES(ctx
, 0);
5201 ctx
->Exec
->GetClipPlane( plane
, equation
);
5204 static void exec_GetDoublev( GLenum pname
, GLdouble
*params
)
5206 GET_CURRENT_CONTEXT(ctx
);
5207 FLUSH_VERTICES(ctx
, 0);
5208 ctx
->Exec
->GetDoublev( pname
, params
);
5211 static GLenum
exec_GetError( void )
5213 GET_CURRENT_CONTEXT(ctx
);
5214 FLUSH_VERTICES(ctx
, 0);
5215 return ctx
->Exec
->GetError( );
5218 static void exec_GetFloatv( GLenum pname
, GLfloat
*params
)
5220 GET_CURRENT_CONTEXT(ctx
);
5221 FLUSH_VERTICES(ctx
, 0);
5222 ctx
->Exec
->GetFloatv( pname
, params
);
5225 static void exec_GetIntegerv( GLenum pname
, GLint
*params
)
5227 GET_CURRENT_CONTEXT(ctx
);
5228 FLUSH_VERTICES(ctx
, 0);
5229 ctx
->Exec
->GetIntegerv( pname
, params
);
5232 static void exec_GetLightfv( GLenum light
, GLenum pname
, GLfloat
*params
)
5234 GET_CURRENT_CONTEXT(ctx
);
5235 FLUSH_VERTICES(ctx
, 0);
5236 ctx
->Exec
->GetLightfv( light
, pname
, params
);
5239 static void exec_GetLightiv( GLenum light
, GLenum pname
, GLint
*params
)
5241 GET_CURRENT_CONTEXT(ctx
);
5242 FLUSH_VERTICES(ctx
, 0);
5243 ctx
->Exec
->GetLightiv( light
, pname
, params
);
5246 static void exec_GetMapdv( GLenum target
, GLenum query
, GLdouble
*v
)
5248 GET_CURRENT_CONTEXT(ctx
);
5249 FLUSH_VERTICES(ctx
, 0);
5250 ctx
->Exec
->GetMapdv( target
, query
, v
);
5253 static void exec_GetMapfv( GLenum target
, GLenum query
, GLfloat
*v
)
5255 GET_CURRENT_CONTEXT(ctx
);
5256 FLUSH_VERTICES(ctx
, 0);
5257 ctx
->Exec
->GetMapfv( target
, query
, v
);
5260 static void exec_GetMapiv( GLenum target
, GLenum query
, GLint
*v
)
5262 GET_CURRENT_CONTEXT(ctx
);
5263 FLUSH_VERTICES(ctx
, 0);
5264 ctx
->Exec
->GetMapiv( target
, query
, v
);
5267 static void exec_GetMaterialfv( GLenum face
, GLenum pname
, GLfloat
*params
)
5269 GET_CURRENT_CONTEXT(ctx
);
5270 FLUSH_VERTICES(ctx
, 0);
5271 ctx
->Exec
->GetMaterialfv( face
, pname
, params
);
5274 static void exec_GetMaterialiv( GLenum face
, GLenum pname
, GLint
*params
)
5276 GET_CURRENT_CONTEXT(ctx
);
5277 FLUSH_VERTICES(ctx
, 0);
5278 ctx
->Exec
->GetMaterialiv( face
, pname
, params
);
5281 static void exec_GetPixelMapfv( GLenum map
, GLfloat
*values
)
5283 GET_CURRENT_CONTEXT(ctx
);
5284 FLUSH_VERTICES(ctx
, 0);
5285 ctx
->Exec
->GetPixelMapfv( map
, values
);
5288 static void exec_GetPixelMapuiv( GLenum map
, GLuint
*values
)
5290 GET_CURRENT_CONTEXT(ctx
);
5291 FLUSH_VERTICES(ctx
, 0);
5292 ctx
->Exec
->GetPixelMapuiv( map
, values
);
5295 static void exec_GetPixelMapusv( GLenum map
, GLushort
*values
)
5297 GET_CURRENT_CONTEXT(ctx
);
5298 FLUSH_VERTICES(ctx
, 0);
5299 ctx
->Exec
->GetPixelMapusv( map
, values
);
5302 static void exec_GetPolygonStipple( GLubyte
*dest
)
5304 GET_CURRENT_CONTEXT(ctx
);
5305 FLUSH_VERTICES(ctx
, 0);
5306 ctx
->Exec
->GetPolygonStipple( dest
);
5309 static const GLubyte
*exec_GetString( GLenum name
)
5311 GET_CURRENT_CONTEXT(ctx
);
5312 FLUSH_VERTICES(ctx
, 0);
5313 return ctx
->Exec
->GetString( name
);
5316 static void exec_GetTexEnvfv( GLenum target
, GLenum pname
, GLfloat
*params
)
5318 GET_CURRENT_CONTEXT(ctx
);
5319 FLUSH_VERTICES(ctx
, 0);
5320 ctx
->Exec
->GetTexEnvfv( target
, pname
, params
);
5323 static void exec_GetTexEnviv( GLenum target
, GLenum pname
, GLint
*params
)
5325 GET_CURRENT_CONTEXT(ctx
);
5326 FLUSH_VERTICES(ctx
, 0);
5327 ctx
->Exec
->GetTexEnviv( target
, pname
, params
);
5330 static void exec_GetTexGendv( GLenum coord
, GLenum pname
, GLdouble
*params
)
5332 GET_CURRENT_CONTEXT(ctx
);
5333 FLUSH_VERTICES(ctx
, 0);
5334 ctx
->Exec
->GetTexGendv( coord
, pname
, params
);
5337 static void exec_GetTexGenfv( GLenum coord
, GLenum pname
, GLfloat
*params
)
5339 GET_CURRENT_CONTEXT(ctx
);
5340 FLUSH_VERTICES(ctx
, 0);
5341 ctx
->Exec
->GetTexGenfv( coord
, pname
, params
);
5344 static void exec_GetTexGeniv( GLenum coord
, GLenum pname
, GLint
*params
)
5346 GET_CURRENT_CONTEXT(ctx
);
5347 FLUSH_VERTICES(ctx
, 0);
5348 ctx
->Exec
->GetTexGeniv( coord
, pname
, params
);
5351 static void exec_GetTexImage( GLenum target
, GLint level
, GLenum format
,
5352 GLenum type
, GLvoid
*pixels
)
5354 GET_CURRENT_CONTEXT(ctx
);
5355 FLUSH_VERTICES(ctx
, 0);
5356 ctx
->Exec
->GetTexImage( target
, level
, format
, type
, pixels
);
5359 static void exec_GetTexLevelParameterfv( GLenum target
, GLint level
,
5360 GLenum pname
, GLfloat
*params
)
5362 GET_CURRENT_CONTEXT(ctx
);
5363 FLUSH_VERTICES(ctx
, 0);
5364 ctx
->Exec
->GetTexLevelParameterfv( target
, level
, pname
, params
);
5367 static void exec_GetTexLevelParameteriv( GLenum target
, GLint level
,
5368 GLenum pname
, GLint
*params
)
5370 GET_CURRENT_CONTEXT(ctx
);
5371 FLUSH_VERTICES(ctx
, 0);
5372 ctx
->Exec
->GetTexLevelParameteriv( target
, level
, pname
, params
);
5375 static void exec_GetTexParameterfv( GLenum target
, GLenum pname
,
5378 GET_CURRENT_CONTEXT(ctx
);
5379 FLUSH_VERTICES(ctx
, 0);
5380 ctx
->Exec
->GetTexParameterfv( target
, pname
, params
);
5383 static void exec_GetTexParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
5385 GET_CURRENT_CONTEXT(ctx
);
5386 FLUSH_VERTICES(ctx
, 0);
5387 ctx
->Exec
->GetTexParameteriv( target
, pname
, params
);
5390 static GLboolean
exec_IsEnabled( GLenum cap
)
5392 GET_CURRENT_CONTEXT(ctx
);
5393 FLUSH_VERTICES(ctx
, 0);
5394 return ctx
->Exec
->IsEnabled( cap
);
5397 static void exec_PixelStoref( GLenum pname
, GLfloat param
)
5399 GET_CURRENT_CONTEXT(ctx
);
5400 FLUSH_VERTICES(ctx
, 0);
5401 ctx
->Exec
->PixelStoref( pname
, param
);
5404 static void exec_PixelStorei( GLenum pname
, GLint param
)
5406 GET_CURRENT_CONTEXT(ctx
);
5407 FLUSH_VERTICES(ctx
, 0);
5408 ctx
->Exec
->PixelStorei( pname
, param
);
5411 static void exec_ReadPixels( GLint x
, GLint y
, GLsizei width
, GLsizei height
,
5412 GLenum format
, GLenum type
, GLvoid
*pixels
)
5414 GET_CURRENT_CONTEXT(ctx
);
5415 FLUSH_VERTICES(ctx
, 0);
5416 ctx
->Exec
->ReadPixels( x
, y
, width
, height
, format
, type
, pixels
);
5419 static GLint
exec_RenderMode( GLenum mode
)
5421 GET_CURRENT_CONTEXT(ctx
);
5422 FLUSH_VERTICES(ctx
, 0);
5423 return ctx
->Exec
->RenderMode( mode
);
5426 static void exec_FeedbackBuffer( GLsizei size
, GLenum type
, GLfloat
*buffer
)
5428 GET_CURRENT_CONTEXT(ctx
);
5429 FLUSH_VERTICES(ctx
, 0);
5430 ctx
->Exec
->FeedbackBuffer( size
, type
, buffer
);
5433 static void exec_SelectBuffer( GLsizei size
, GLuint
*buffer
)
5435 GET_CURRENT_CONTEXT(ctx
);
5436 FLUSH_VERTICES(ctx
, 0);
5437 ctx
->Exec
->SelectBuffer( size
, buffer
);
5440 static GLboolean
exec_AreTexturesResident(GLsizei n
, const GLuint
*texName
,
5441 GLboolean
*residences
)
5443 GET_CURRENT_CONTEXT(ctx
);
5444 FLUSH_VERTICES(ctx
, 0);
5445 return ctx
->Exec
->AreTexturesResident( n
, texName
, residences
);
5448 static void exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
,
5451 GET_CURRENT_CONTEXT(ctx
);
5452 FLUSH_VERTICES(ctx
, 0);
5453 ctx
->Exec
->ColorPointer( size
, type
, stride
, ptr
);
5456 static void exec_DeleteTextures( GLsizei n
, const GLuint
*texName
)
5458 GET_CURRENT_CONTEXT(ctx
);
5459 FLUSH_VERTICES(ctx
, 0);
5460 ctx
->Exec
->DeleteTextures( n
, texName
);
5463 static void exec_DisableClientState( GLenum cap
)
5465 GET_CURRENT_CONTEXT(ctx
);
5466 FLUSH_VERTICES(ctx
, 0);
5467 ctx
->Exec
->DisableClientState( cap
);
5470 static void exec_EdgeFlagPointer(GLsizei stride
, const void *vptr
)
5472 GET_CURRENT_CONTEXT(ctx
);
5473 FLUSH_VERTICES(ctx
, 0);
5474 ctx
->Exec
->EdgeFlagPointer( stride
, vptr
);
5477 static void exec_EnableClientState( GLenum cap
)
5479 GET_CURRENT_CONTEXT(ctx
);
5480 FLUSH_VERTICES(ctx
, 0);
5481 ctx
->Exec
->EnableClientState( cap
);
5484 static void exec_GenTextures( GLsizei n
, GLuint
*texName
)
5486 GET_CURRENT_CONTEXT(ctx
);
5487 FLUSH_VERTICES(ctx
, 0);
5488 ctx
->Exec
->GenTextures( n
, texName
);
5491 static void exec_GetPointerv( GLenum pname
, GLvoid
**params
)
5493 GET_CURRENT_CONTEXT(ctx
);
5494 FLUSH_VERTICES(ctx
, 0);
5495 ctx
->Exec
->GetPointerv( pname
, params
);
5498 static void exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5500 GET_CURRENT_CONTEXT(ctx
);
5501 FLUSH_VERTICES(ctx
, 0);
5502 ctx
->Exec
->IndexPointer( type
, stride
, ptr
);
5505 static void exec_InterleavedArrays(GLenum format
, GLsizei stride
,
5506 const GLvoid
*pointer
)
5508 GET_CURRENT_CONTEXT(ctx
);
5509 FLUSH_VERTICES(ctx
, 0);
5510 ctx
->Exec
->InterleavedArrays( format
, stride
, pointer
);
5513 static GLboolean
exec_IsTexture( GLuint texture
)
5515 GET_CURRENT_CONTEXT(ctx
);
5516 FLUSH_VERTICES(ctx
, 0);
5517 return ctx
->Exec
->IsTexture( texture
);
5520 static void exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5522 GET_CURRENT_CONTEXT(ctx
);
5523 FLUSH_VERTICES(ctx
, 0);
5524 ctx
->Exec
->NormalPointer( type
, stride
, ptr
);
5527 static void exec_PopClientAttrib(void)
5529 GET_CURRENT_CONTEXT(ctx
);
5530 FLUSH_VERTICES(ctx
, 0);
5531 ctx
->Exec
->PopClientAttrib();
5534 static void exec_PushClientAttrib(GLbitfield mask
)
5536 GET_CURRENT_CONTEXT(ctx
);
5537 FLUSH_VERTICES(ctx
, 0);
5538 ctx
->Exec
->PushClientAttrib( mask
);
5541 static void exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
5544 GET_CURRENT_CONTEXT(ctx
);
5545 FLUSH_VERTICES(ctx
, 0);
5546 ctx
->Exec
->TexCoordPointer( size
, type
, stride
, ptr
);
5549 static void exec_GetCompressedTexImageARB(GLenum target
, GLint level
,
5552 GET_CURRENT_CONTEXT(ctx
);
5553 FLUSH_VERTICES(ctx
, 0);
5554 ctx
->Exec
->GetCompressedTexImageARB( target
, level
, img
);
5557 static void exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
5560 GET_CURRENT_CONTEXT(ctx
);
5561 FLUSH_VERTICES(ctx
, 0);
5562 ctx
->Exec
->VertexPointer( size
, type
, stride
, ptr
);
5565 static void exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
5566 GLint x
, GLint y
, GLsizei width
)
5568 GET_CURRENT_CONTEXT(ctx
);
5569 FLUSH_VERTICES(ctx
, 0);
5570 ctx
->Exec
->CopyConvolutionFilter1D( target
, internalFormat
, x
, y
, width
);
5573 static void exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
5574 GLint x
, GLint y
, GLsizei width
,
5577 GET_CURRENT_CONTEXT(ctx
);
5578 FLUSH_VERTICES(ctx
, 0);
5579 ctx
->Exec
->CopyConvolutionFilter2D( target
, internalFormat
, x
, y
, width
,
5583 static void exec_GetColorTable( GLenum target
, GLenum format
,
5584 GLenum type
, GLvoid
*data
)
5586 GET_CURRENT_CONTEXT(ctx
);
5587 FLUSH_VERTICES(ctx
, 0);
5588 ctx
->Exec
->GetColorTable( target
, format
, type
, data
);
5591 static void exec_GetColorTableParameterfv( GLenum target
, GLenum pname
,
5594 GET_CURRENT_CONTEXT(ctx
);
5595 FLUSH_VERTICES(ctx
, 0);
5596 ctx
->Exec
->GetColorTableParameterfv( target
, pname
, params
);
5599 static void exec_GetColorTableParameteriv( GLenum target
, GLenum pname
,
5602 GET_CURRENT_CONTEXT(ctx
);
5603 FLUSH_VERTICES(ctx
, 0);
5604 ctx
->Exec
->GetColorTableParameteriv( target
, pname
, params
);
5607 static void exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
5610 GET_CURRENT_CONTEXT(ctx
);
5611 FLUSH_VERTICES(ctx
, 0);
5612 ctx
->Exec
->GetConvolutionFilter( target
, format
, type
, image
);
5615 static void exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
,
5618 GET_CURRENT_CONTEXT(ctx
);
5619 FLUSH_VERTICES(ctx
, 0);
5620 ctx
->Exec
->GetConvolutionParameterfv( target
, pname
, params
);
5623 static void exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
,
5626 GET_CURRENT_CONTEXT(ctx
);
5627 FLUSH_VERTICES(ctx
, 0);
5628 ctx
->Exec
->GetConvolutionParameteriv( target
, pname
, params
);
5631 static void exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
5632 GLenum type
, GLvoid
*values
)
5634 GET_CURRENT_CONTEXT(ctx
);
5635 FLUSH_VERTICES(ctx
, 0);
5636 ctx
->Exec
->GetHistogram( target
, reset
, format
, type
, values
);
5639 static void exec_GetHistogramParameterfv(GLenum target
, GLenum pname
,
5642 GET_CURRENT_CONTEXT(ctx
);
5643 FLUSH_VERTICES(ctx
, 0);
5644 ctx
->Exec
->GetHistogramParameterfv( target
, pname
, params
);
5647 static void exec_GetHistogramParameteriv(GLenum target
, GLenum pname
,
5650 GET_CURRENT_CONTEXT(ctx
);
5651 FLUSH_VERTICES(ctx
, 0);
5652 ctx
->Exec
->GetHistogramParameteriv( target
, pname
, params
);
5655 static void exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
5656 GLenum type
, GLvoid
*values
)
5658 GET_CURRENT_CONTEXT(ctx
);
5659 FLUSH_VERTICES(ctx
, 0);
5660 ctx
->Exec
->GetMinmax( target
, reset
, format
, type
, values
);
5663 static void exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
,
5666 GET_CURRENT_CONTEXT(ctx
);
5667 FLUSH_VERTICES(ctx
, 0);
5668 ctx
->Exec
->GetMinmaxParameterfv( target
, pname
, params
);
5671 static void exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
,
5674 GET_CURRENT_CONTEXT(ctx
);
5675 FLUSH_VERTICES(ctx
, 0);
5676 ctx
->Exec
->GetMinmaxParameteriv( target
, pname
, params
);
5679 static void exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
5680 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
5682 GET_CURRENT_CONTEXT(ctx
);
5683 FLUSH_VERTICES(ctx
, 0);
5684 ctx
->Exec
->GetSeparableFilter( target
, format
, type
, row
, column
, span
);
5687 static void exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
5688 GLsizei width
, GLsizei height
, GLenum format
,
5689 GLenum type
, const GLvoid
*row
,
5690 const GLvoid
*column
)
5692 GET_CURRENT_CONTEXT(ctx
);
5693 FLUSH_VERTICES(ctx
, 0);
5694 ctx
->Exec
->SeparableFilter2D( target
, internalFormat
, width
, height
, format
,
5698 static void exec_GetPixelTexGenParameterivSGIS(GLenum target
, GLint
*value
)
5700 GET_CURRENT_CONTEXT(ctx
);
5701 FLUSH_VERTICES(ctx
, 0);
5702 ctx
->Exec
->GetPixelTexGenParameterivSGIS( target
, value
);
5705 static void exec_GetPixelTexGenParameterfvSGIS(GLenum target
, GLfloat
*value
)
5707 GET_CURRENT_CONTEXT(ctx
);
5708 FLUSH_VERTICES(ctx
, 0);
5709 ctx
->Exec
->GetPixelTexGenParameterfvSGIS( target
, value
);
5712 static void exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5713 GLsizei count
, const GLvoid
*ptr
)
5715 GET_CURRENT_CONTEXT(ctx
);
5716 FLUSH_VERTICES(ctx
, 0);
5717 ctx
->Exec
->ColorPointerEXT( size
, type
, stride
, count
, ptr
);
5720 static void exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
,
5721 const GLboolean
*ptr
)
5723 GET_CURRENT_CONTEXT(ctx
);
5724 FLUSH_VERTICES(ctx
, 0);
5725 ctx
->Exec
->EdgeFlagPointerEXT( stride
, count
, ptr
);
5728 static void exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
5731 GET_CURRENT_CONTEXT(ctx
);
5732 FLUSH_VERTICES(ctx
, 0);
5733 ctx
->Exec
->IndexPointerEXT( type
, stride
, count
, ptr
);
5736 static void exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
5739 GET_CURRENT_CONTEXT(ctx
);
5740 FLUSH_VERTICES(ctx
, 0);
5741 ctx
->Exec
->NormalPointerEXT( type
, stride
, count
, ptr
);
5744 static void exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5745 GLsizei count
, const GLvoid
*ptr
)
5747 GET_CURRENT_CONTEXT(ctx
);
5748 FLUSH_VERTICES(ctx
, 0);
5749 ctx
->Exec
->TexCoordPointerEXT( size
, type
, stride
, count
, ptr
);
5752 static void exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5753 GLsizei count
, const GLvoid
*ptr
)
5755 GET_CURRENT_CONTEXT(ctx
);
5756 FLUSH_VERTICES(ctx
, 0);
5757 ctx
->Exec
->VertexPointerEXT( size
, type
, stride
, count
, ptr
);
5760 static void exec_LockArraysEXT(GLint first
, GLsizei count
)
5762 GET_CURRENT_CONTEXT(ctx
);
5763 FLUSH_VERTICES(ctx
, 0);
5764 ctx
->Exec
->LockArraysEXT( first
, count
);
5767 static void exec_UnlockArraysEXT( void )
5769 GET_CURRENT_CONTEXT(ctx
);
5770 FLUSH_VERTICES(ctx
, 0);
5771 ctx
->Exec
->UnlockArraysEXT( );
5774 static void exec_ResizeBuffersMESA( void )
5776 GET_CURRENT_CONTEXT(ctx
);
5777 FLUSH_VERTICES(ctx
, 0);
5778 ctx
->Exec
->ResizeBuffersMESA( );
5782 static void exec_ClientActiveTextureARB( GLenum target
)
5784 GET_CURRENT_CONTEXT(ctx
);
5785 FLUSH_VERTICES(ctx
, 0);
5786 ctx
->Exec
->ClientActiveTextureARB(target
);
5789 static void exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
5790 GLsizei stride
, const GLvoid
*ptr
)
5792 GET_CURRENT_CONTEXT(ctx
);
5793 FLUSH_VERTICES(ctx
, 0);
5794 ctx
->Exec
->SecondaryColorPointerEXT( size
, type
, stride
, ptr
);
5797 static void exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
,
5800 GET_CURRENT_CONTEXT(ctx
);
5801 FLUSH_VERTICES(ctx
, 0);
5802 ctx
->Exec
->FogCoordPointerEXT( type
, stride
, ptr
);
5805 /* GL_EXT_multi_draw_arrays */
5806 static void exec_MultiDrawArraysEXT(GLenum mode
, GLint
*first
,
5807 GLsizei
*count
, GLsizei primcount
)
5809 GET_CURRENT_CONTEXT(ctx
);
5810 FLUSH_VERTICES(ctx
, 0);
5811 ctx
->Exec
->MultiDrawArraysEXT( mode
, first
, count
, primcount
);
5814 /* GL_EXT_multi_draw_arrays */
5815 static void exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
*count
,
5816 GLenum type
, const GLvoid
**indices
,
5819 GET_CURRENT_CONTEXT(ctx
);
5820 FLUSH_VERTICES(ctx
, 0);
5821 ctx
->Exec
->MultiDrawElementsEXT(mode
, count
, type
, indices
, primcount
);
5827 * Assign all the pointers in <table> to point to Mesa's display list
5828 * building functions.
5830 * This does not include any of the tnl functions - they are
5831 * initialized from _mesa_init_api_defaults and from the active vtxfmt
5835 _mesa_init_dlist_table( struct _glapi_table
*table
, GLuint tableSize
)
5837 _mesa_init_no_op_table(table
, tableSize
);
5839 _mesa_loopback_init_api_table( table
, GL_TRUE
);
5842 table
->Accum
= save_Accum
;
5843 table
->AlphaFunc
= save_AlphaFunc
;
5844 table
->Bitmap
= save_Bitmap
;
5845 table
->BlendFunc
= save_BlendFunc
;
5846 table
->CallList
= _mesa_save_CallList
;
5847 table
->CallLists
= _mesa_save_CallLists
;
5848 table
->Clear
= save_Clear
;
5849 table
->ClearAccum
= save_ClearAccum
;
5850 table
->ClearColor
= save_ClearColor
;
5851 table
->ClearDepth
= save_ClearDepth
;
5852 table
->ClearIndex
= save_ClearIndex
;
5853 table
->ClearStencil
= save_ClearStencil
;
5854 table
->ClipPlane
= save_ClipPlane
;
5855 table
->ColorMask
= save_ColorMask
;
5856 table
->ColorMaterial
= save_ColorMaterial
;
5857 table
->CopyPixels
= save_CopyPixels
;
5858 table
->CullFace
= save_CullFace
;
5859 table
->DeleteLists
= _mesa_DeleteLists
;
5860 table
->DepthFunc
= save_DepthFunc
;
5861 table
->DepthMask
= save_DepthMask
;
5862 table
->DepthRange
= save_DepthRange
;
5863 table
->Disable
= save_Disable
;
5864 table
->DrawBuffer
= save_DrawBuffer
;
5865 table
->DrawPixels
= save_DrawPixels
;
5866 table
->Enable
= save_Enable
;
5867 table
->EndList
= _mesa_EndList
;
5868 table
->EvalMesh1
= _mesa_save_EvalMesh1
;
5869 table
->EvalMesh2
= _mesa_save_EvalMesh2
;
5870 table
->Finish
= exec_Finish
;
5871 table
->Flush
= exec_Flush
;
5872 table
->Fogf
= save_Fogf
;
5873 table
->Fogfv
= save_Fogfv
;
5874 table
->Fogi
= save_Fogi
;
5875 table
->Fogiv
= save_Fogiv
;
5876 table
->FrontFace
= save_FrontFace
;
5877 table
->Frustum
= save_Frustum
;
5878 table
->GenLists
= _mesa_GenLists
;
5879 table
->GetBooleanv
= exec_GetBooleanv
;
5880 table
->GetClipPlane
= exec_GetClipPlane
;
5881 table
->GetDoublev
= exec_GetDoublev
;
5882 table
->GetError
= exec_GetError
;
5883 table
->GetFloatv
= exec_GetFloatv
;
5884 table
->GetIntegerv
= exec_GetIntegerv
;
5885 table
->GetLightfv
= exec_GetLightfv
;
5886 table
->GetLightiv
= exec_GetLightiv
;
5887 table
->GetMapdv
= exec_GetMapdv
;
5888 table
->GetMapfv
= exec_GetMapfv
;
5889 table
->GetMapiv
= exec_GetMapiv
;
5890 table
->GetMaterialfv
= exec_GetMaterialfv
;
5891 table
->GetMaterialiv
= exec_GetMaterialiv
;
5892 table
->GetPixelMapfv
= exec_GetPixelMapfv
;
5893 table
->GetPixelMapuiv
= exec_GetPixelMapuiv
;
5894 table
->GetPixelMapusv
= exec_GetPixelMapusv
;
5895 table
->GetPolygonStipple
= exec_GetPolygonStipple
;
5896 table
->GetString
= exec_GetString
;
5897 table
->GetTexEnvfv
= exec_GetTexEnvfv
;
5898 table
->GetTexEnviv
= exec_GetTexEnviv
;
5899 table
->GetTexGendv
= exec_GetTexGendv
;
5900 table
->GetTexGenfv
= exec_GetTexGenfv
;
5901 table
->GetTexGeniv
= exec_GetTexGeniv
;
5902 table
->GetTexImage
= exec_GetTexImage
;
5903 table
->GetTexLevelParameterfv
= exec_GetTexLevelParameterfv
;
5904 table
->GetTexLevelParameteriv
= exec_GetTexLevelParameteriv
;
5905 table
->GetTexParameterfv
= exec_GetTexParameterfv
;
5906 table
->GetTexParameteriv
= exec_GetTexParameteriv
;
5907 table
->Hint
= save_Hint
;
5908 table
->IndexMask
= save_IndexMask
;
5909 table
->InitNames
= save_InitNames
;
5910 table
->IsEnabled
= exec_IsEnabled
;
5911 table
->IsList
= _mesa_IsList
;
5912 table
->LightModelf
= save_LightModelf
;
5913 table
->LightModelfv
= save_LightModelfv
;
5914 table
->LightModeli
= save_LightModeli
;
5915 table
->LightModeliv
= save_LightModeliv
;
5916 table
->Lightf
= save_Lightf
;
5917 table
->Lightfv
= save_Lightfv
;
5918 table
->Lighti
= save_Lighti
;
5919 table
->Lightiv
= save_Lightiv
;
5920 table
->LineStipple
= save_LineStipple
;
5921 table
->LineWidth
= save_LineWidth
;
5922 table
->ListBase
= save_ListBase
;
5923 table
->LoadIdentity
= save_LoadIdentity
;
5924 table
->LoadMatrixd
= save_LoadMatrixd
;
5925 table
->LoadMatrixf
= save_LoadMatrixf
;
5926 table
->LoadName
= save_LoadName
;
5927 table
->LogicOp
= save_LogicOp
;
5928 table
->Map1d
= save_Map1d
;
5929 table
->Map1f
= save_Map1f
;
5930 table
->Map2d
= save_Map2d
;
5931 table
->Map2f
= save_Map2f
;
5932 table
->MapGrid1d
= save_MapGrid1d
;
5933 table
->MapGrid1f
= save_MapGrid1f
;
5934 table
->MapGrid2d
= save_MapGrid2d
;
5935 table
->MapGrid2f
= save_MapGrid2f
;
5936 table
->MatrixMode
= save_MatrixMode
;
5937 table
->MultMatrixd
= save_MultMatrixd
;
5938 table
->MultMatrixf
= save_MultMatrixf
;
5939 table
->NewList
= save_NewList
;
5940 table
->Ortho
= save_Ortho
;
5941 table
->PassThrough
= save_PassThrough
;
5942 table
->PixelMapfv
= save_PixelMapfv
;
5943 table
->PixelMapuiv
= save_PixelMapuiv
;
5944 table
->PixelMapusv
= save_PixelMapusv
;
5945 table
->PixelStoref
= exec_PixelStoref
;
5946 table
->PixelStorei
= exec_PixelStorei
;
5947 table
->PixelTransferf
= save_PixelTransferf
;
5948 table
->PixelTransferi
= save_PixelTransferi
;
5949 table
->PixelZoom
= save_PixelZoom
;
5950 table
->PointSize
= save_PointSize
;
5951 table
->PolygonMode
= save_PolygonMode
;
5952 table
->PolygonOffset
= save_PolygonOffset
;
5953 table
->PolygonStipple
= save_PolygonStipple
;
5954 table
->PopAttrib
= save_PopAttrib
;
5955 table
->PopMatrix
= save_PopMatrix
;
5956 table
->PopName
= save_PopName
;
5957 table
->PushAttrib
= save_PushAttrib
;
5958 table
->PushMatrix
= save_PushMatrix
;
5959 table
->PushName
= save_PushName
;
5960 table
->RasterPos2d
= save_RasterPos2d
;
5961 table
->RasterPos2dv
= save_RasterPos2dv
;
5962 table
->RasterPos2f
= save_RasterPos2f
;
5963 table
->RasterPos2fv
= save_RasterPos2fv
;
5964 table
->RasterPos2i
= save_RasterPos2i
;
5965 table
->RasterPos2iv
= save_RasterPos2iv
;
5966 table
->RasterPos2s
= save_RasterPos2s
;
5967 table
->RasterPos2sv
= save_RasterPos2sv
;
5968 table
->RasterPos3d
= save_RasterPos3d
;
5969 table
->RasterPos3dv
= save_RasterPos3dv
;
5970 table
->RasterPos3f
= save_RasterPos3f
;
5971 table
->RasterPos3fv
= save_RasterPos3fv
;
5972 table
->RasterPos3i
= save_RasterPos3i
;
5973 table
->RasterPos3iv
= save_RasterPos3iv
;
5974 table
->RasterPos3s
= save_RasterPos3s
;
5975 table
->RasterPos3sv
= save_RasterPos3sv
;
5976 table
->RasterPos4d
= save_RasterPos4d
;
5977 table
->RasterPos4dv
= save_RasterPos4dv
;
5978 table
->RasterPos4f
= save_RasterPos4f
;
5979 table
->RasterPos4fv
= save_RasterPos4fv
;
5980 table
->RasterPos4i
= save_RasterPos4i
;
5981 table
->RasterPos4iv
= save_RasterPos4iv
;
5982 table
->RasterPos4s
= save_RasterPos4s
;
5983 table
->RasterPos4sv
= save_RasterPos4sv
;
5984 table
->ReadBuffer
= save_ReadBuffer
;
5985 table
->ReadPixels
= exec_ReadPixels
;
5986 table
->RenderMode
= exec_RenderMode
;
5987 table
->Rotated
= save_Rotated
;
5988 table
->Rotatef
= save_Rotatef
;
5989 table
->Scaled
= save_Scaled
;
5990 table
->Scalef
= save_Scalef
;
5991 table
->Scissor
= save_Scissor
;
5992 table
->FeedbackBuffer
= exec_FeedbackBuffer
;
5993 table
->SelectBuffer
= exec_SelectBuffer
;
5994 table
->ShadeModel
= save_ShadeModel
;
5995 table
->StencilFunc
= save_StencilFunc
;
5996 table
->StencilMask
= save_StencilMask
;
5997 table
->StencilOp
= save_StencilOp
;
5998 table
->TexEnvf
= save_TexEnvf
;
5999 table
->TexEnvfv
= save_TexEnvfv
;
6000 table
->TexEnvi
= save_TexEnvi
;
6001 table
->TexEnviv
= save_TexEnviv
;
6002 table
->TexGend
= save_TexGend
;
6003 table
->TexGendv
= save_TexGendv
;
6004 table
->TexGenf
= save_TexGenf
;
6005 table
->TexGenfv
= save_TexGenfv
;
6006 table
->TexGeni
= save_TexGeni
;
6007 table
->TexGeniv
= save_TexGeniv
;
6008 table
->TexImage1D
= save_TexImage1D
;
6009 table
->TexImage2D
= save_TexImage2D
;
6010 table
->TexParameterf
= save_TexParameterf
;
6011 table
->TexParameterfv
= save_TexParameterfv
;
6012 table
->TexParameteri
= save_TexParameteri
;
6013 table
->TexParameteriv
= save_TexParameteriv
;
6014 table
->Translated
= save_Translated
;
6015 table
->Translatef
= save_Translatef
;
6016 table
->Viewport
= save_Viewport
;
6019 table
->AreTexturesResident
= exec_AreTexturesResident
;
6020 table
->AreTexturesResidentEXT
= exec_AreTexturesResident
;
6021 table
->BindTexture
= save_BindTexture
;
6022 table
->ColorPointer
= exec_ColorPointer
;
6023 table
->CopyTexImage1D
= save_CopyTexImage1D
;
6024 table
->CopyTexImage2D
= save_CopyTexImage2D
;
6025 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
6026 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
6027 table
->DeleteTextures
= exec_DeleteTextures
;
6028 table
->DisableClientState
= exec_DisableClientState
;
6029 table
->EdgeFlagPointer
= exec_EdgeFlagPointer
;
6030 table
->EnableClientState
= exec_EnableClientState
;
6031 table
->GenTextures
= exec_GenTextures
;
6032 table
->GenTexturesEXT
= exec_GenTextures
;
6033 table
->GetPointerv
= exec_GetPointerv
;
6034 table
->IndexPointer
= exec_IndexPointer
;
6035 table
->InterleavedArrays
= exec_InterleavedArrays
;
6036 table
->IsTexture
= exec_IsTexture
;
6037 table
->IsTextureEXT
= exec_IsTexture
;
6038 table
->NormalPointer
= exec_NormalPointer
;
6039 table
->PopClientAttrib
= exec_PopClientAttrib
;
6040 table
->PrioritizeTextures
= save_PrioritizeTextures
;
6041 table
->PushClientAttrib
= exec_PushClientAttrib
;
6042 table
->TexCoordPointer
= exec_TexCoordPointer
;
6043 table
->TexSubImage1D
= save_TexSubImage1D
;
6044 table
->TexSubImage2D
= save_TexSubImage2D
;
6045 table
->VertexPointer
= exec_VertexPointer
;
6048 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
6049 table
->TexImage3D
= save_TexImage3D
;
6050 table
->TexSubImage3D
= save_TexSubImage3D
;
6052 /* GL_ARB_imaging */
6053 /* Not all are supported */
6054 table
->BlendColor
= save_BlendColor
;
6055 table
->BlendEquation
= save_BlendEquation
;
6056 table
->ColorSubTable
= save_ColorSubTable
;
6057 table
->ColorTable
= save_ColorTable
;
6058 table
->ColorTableParameterfv
= save_ColorTableParameterfv
;
6059 table
->ColorTableParameteriv
= save_ColorTableParameteriv
;
6060 table
->ConvolutionFilter1D
= save_ConvolutionFilter1D
;
6061 table
->ConvolutionFilter2D
= save_ConvolutionFilter2D
;
6062 table
->ConvolutionParameterf
= save_ConvolutionParameterf
;
6063 table
->ConvolutionParameterfv
= save_ConvolutionParameterfv
;
6064 table
->ConvolutionParameteri
= save_ConvolutionParameteri
;
6065 table
->ConvolutionParameteriv
= save_ConvolutionParameteriv
;
6066 table
->CopyColorSubTable
= save_CopyColorSubTable
;
6067 table
->CopyColorTable
= save_CopyColorTable
;
6068 table
->CopyConvolutionFilter1D
= exec_CopyConvolutionFilter1D
;
6069 table
->CopyConvolutionFilter2D
= exec_CopyConvolutionFilter2D
;
6070 table
->GetColorTable
= exec_GetColorTable
;
6071 table
->GetColorTableEXT
= exec_GetColorTable
;
6072 table
->GetColorTableParameterfv
= exec_GetColorTableParameterfv
;
6073 table
->GetColorTableParameterfvEXT
= exec_GetColorTableParameterfv
;
6074 table
->GetColorTableParameteriv
= exec_GetColorTableParameteriv
;
6075 table
->GetColorTableParameterivEXT
= exec_GetColorTableParameteriv
;
6076 table
->GetConvolutionFilter
= exec_GetConvolutionFilter
;
6077 table
->GetConvolutionFilterEXT
= exec_GetConvolutionFilter
;
6078 table
->GetConvolutionParameterfv
= exec_GetConvolutionParameterfv
;
6079 table
->GetConvolutionParameterfvEXT
= exec_GetConvolutionParameterfv
;
6080 table
->GetConvolutionParameteriv
= exec_GetConvolutionParameteriv
;
6081 table
->GetConvolutionParameterivEXT
= exec_GetConvolutionParameteriv
;
6082 table
->GetHistogram
= exec_GetHistogram
;
6083 table
->GetHistogramEXT
= exec_GetHistogram
;
6084 table
->GetHistogramParameterfv
= exec_GetHistogramParameterfv
;
6085 table
->GetHistogramParameterfvEXT
= exec_GetHistogramParameterfv
;
6086 table
->GetHistogramParameteriv
= exec_GetHistogramParameteriv
;
6087 table
->GetHistogramParameterivEXT
= exec_GetHistogramParameteriv
;
6088 table
->GetMinmax
= exec_GetMinmax
;
6089 table
->GetMinmaxEXT
= exec_GetMinmax
;
6090 table
->GetMinmaxParameterfv
= exec_GetMinmaxParameterfv
;
6091 table
->GetMinmaxParameterfvEXT
= exec_GetMinmaxParameterfv
;
6092 table
->GetMinmaxParameteriv
= exec_GetMinmaxParameteriv
;
6093 table
->GetMinmaxParameterivEXT
= exec_GetMinmaxParameteriv
;
6094 table
->GetSeparableFilter
= exec_GetSeparableFilter
;
6095 table
->GetSeparableFilterEXT
= exec_GetSeparableFilter
;
6096 table
->Histogram
= save_Histogram
;
6097 table
->Minmax
= save_Minmax
;
6098 table
->ResetHistogram
= save_ResetHistogram
;
6099 table
->ResetMinmax
= save_ResetMinmax
;
6100 table
->SeparableFilter2D
= exec_SeparableFilter2D
;
6102 /* 2. GL_EXT_blend_color */
6104 table
->BlendColorEXT
= save_BlendColorEXT
;
6107 /* 3. GL_EXT_polygon_offset */
6108 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
6110 /* 6. GL_EXT_texture3d */
6112 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
6113 table
->TexImage3DEXT
= save_TexImage3DEXT
;
6114 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
6117 /* 15. GL_SGIX_pixel_texture */
6118 table
->PixelTexGenSGIX
= save_PixelTexGenSGIX
;
6120 /* 15. GL_SGIS_pixel_texture */
6121 table
->PixelTexGenParameteriSGIS
= save_PixelTexGenParameteriSGIS
;
6122 table
->PixelTexGenParameterfSGIS
= save_PixelTexGenParameterfSGIS
;
6123 table
->PixelTexGenParameterivSGIS
= save_PixelTexGenParameterivSGIS
;
6124 table
->PixelTexGenParameterfvSGIS
= save_PixelTexGenParameterfvSGIS
;
6125 table
->GetPixelTexGenParameterivSGIS
= exec_GetPixelTexGenParameterivSGIS
;
6126 table
->GetPixelTexGenParameterfvSGIS
= exec_GetPixelTexGenParameterfvSGIS
;
6128 /* 30. GL_EXT_vertex_array */
6129 table
->ColorPointerEXT
= exec_ColorPointerEXT
;
6130 table
->EdgeFlagPointerEXT
= exec_EdgeFlagPointerEXT
;
6131 table
->IndexPointerEXT
= exec_IndexPointerEXT
;
6132 table
->NormalPointerEXT
= exec_NormalPointerEXT
;
6133 table
->TexCoordPointerEXT
= exec_TexCoordPointerEXT
;
6134 table
->VertexPointerEXT
= exec_VertexPointerEXT
;
6136 /* 37. GL_EXT_blend_minmax */
6138 table
->BlendEquationEXT
= save_BlendEquationEXT
;
6141 /* 54. GL_EXT_point_parameters */
6142 table
->PointParameterfEXT
= save_PointParameterfEXT
;
6143 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
6145 /* 78. GL_EXT_paletted_texture */
6147 table
->ColorTableEXT
= save_ColorTable
;
6148 table
->ColorSubTableEXT
= save_ColorSubTable
;
6150 table
->GetColorTableEXT
= exec_GetColorTable
;
6151 table
->GetColorTableParameterfvEXT
= exec_GetColorTableParameterfv
;
6152 table
->GetColorTableParameterivEXT
= exec_GetColorTableParameteriv
;
6154 /* 97. GL_EXT_compiled_vertex_array */
6155 table
->LockArraysEXT
= exec_LockArraysEXT
;
6156 table
->UnlockArraysEXT
= exec_UnlockArraysEXT
;
6158 /* 145. GL_EXT_secondary_color */
6159 table
->SecondaryColorPointerEXT
= exec_SecondaryColorPointerEXT
;
6161 /* 148. GL_EXT_multi_draw_arrays */
6162 table
->MultiDrawArraysEXT
= exec_MultiDrawArraysEXT
;
6163 table
->MultiDrawElementsEXT
= exec_MultiDrawElementsEXT
;
6165 /* 149. GL_EXT_fog_coord */
6166 table
->FogCoordPointerEXT
= exec_FogCoordPointerEXT
;
6168 /* 173. GL_EXT_blend_func_separate */
6169 table
->BlendFuncSeparateEXT
= save_BlendFuncSeparateEXT
;
6171 /* 196. GL_MESA_resize_buffers */
6172 table
->ResizeBuffersMESA
= exec_ResizeBuffersMESA
;
6174 /* 197. GL_MESA_window_pos */
6175 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
6176 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
6177 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
6178 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
6179 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
6180 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
6181 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
6182 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
6183 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
6184 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
6185 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
6186 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
6187 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
6188 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
6189 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
6190 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
6191 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
6192 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
6193 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
6194 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
6195 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
6196 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
6197 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
6198 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
6200 #if FEATURE_NV_vertex_program
6201 /* 233. GL_NV_vertex_program */
6202 /* The following commands DO NOT go into display lists:
6203 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
6204 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
6206 table
->BindProgramNV
= save_BindProgramNV
;
6207 table
->DeleteProgramsNV
= _mesa_DeleteProgramsNV
;
6208 table
->ExecuteProgramNV
= save_ExecuteProgramNV
;
6209 table
->GenProgramsNV
= _mesa_GenProgramsNV
;
6210 table
->AreProgramsResidentNV
= _mesa_AreProgramsResidentNV
;
6211 table
->RequestResidentProgramsNV
= _mesa_RequestResidentProgramsNV
;
6212 table
->GetProgramParameterfvNV
= _mesa_GetProgramParameterfvNV
;
6213 table
->GetProgramParameterdvNV
= _mesa_GetProgramParameterdvNV
;
6214 table
->GetProgramivNV
= _mesa_GetProgramivNV
;
6215 table
->GetProgramStringNV
= _mesa_GetProgramStringNV
;
6216 table
->GetTrackMatrixivNV
= _mesa_GetTrackMatrixivNV
;
6217 table
->GetVertexAttribdvNV
= _mesa_GetVertexAttribdvNV
;
6218 table
->GetVertexAttribfvNV
= _mesa_GetVertexAttribfvNV
;
6219 table
->GetVertexAttribivNV
= _mesa_GetVertexAttribivNV
;
6220 table
->GetVertexAttribPointervNV
= _mesa_GetVertexAttribPointervNV
;
6221 table
->IsProgramNV
= _mesa_IsProgramNV
;
6222 table
->LoadProgramNV
= _mesa_LoadProgramNV
;
6223 table
->ProgramParameter4dNV
= save_ProgramParameter4dNV
;
6224 table
->ProgramParameter4dvNV
= save_ProgramParameter4dvNV
;
6225 table
->ProgramParameter4fNV
= save_ProgramParameter4fNV
;
6226 table
->ProgramParameter4fvNV
= save_ProgramParameter4fvNV
;
6227 table
->ProgramParameters4dvNV
= save_ProgramParameters4dvNV
;
6228 table
->ProgramParameters4fvNV
= save_ProgramParameters4fvNV
;
6229 table
->TrackMatrixNV
= save_TrackMatrixNV
;
6230 table
->VertexAttribPointerNV
= _mesa_VertexAttribPointerNV
;
6233 /* 262. GL_NV_point_sprite */
6234 table
->PointParameteriNV
= save_PointParameteriNV
;
6235 table
->PointParameterivNV
= save_PointParameterivNV
;
6237 /* 268. GL_EXT_stencil_two_side */
6238 table
->ActiveStencilFaceEXT
= save_ActiveStencilFaceEXT
;
6240 /* ARB 1. GL_ARB_multitexture */
6241 table
->ActiveTextureARB
= save_ActiveTextureARB
;
6242 table
->ClientActiveTextureARB
= exec_ClientActiveTextureARB
;
6244 /* ARB 3. GL_ARB_transpose_matrix */
6245 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
6246 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
6247 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
6248 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
6250 /* ARB 5. GL_ARB_multisample */
6251 table
->SampleCoverageARB
= save_SampleCoverageARB
;
6253 /* ARB 12. GL_ARB_texture_compression */
6254 table
->CompressedTexImage3DARB
= save_CompressedTexImage3DARB
;
6255 table
->CompressedTexImage2DARB
= save_CompressedTexImage2DARB
;
6256 table
->CompressedTexImage1DARB
= save_CompressedTexImage1DARB
;
6257 table
->CompressedTexSubImage3DARB
= save_CompressedTexSubImage3DARB
;
6258 table
->CompressedTexSubImage2DARB
= save_CompressedTexSubImage2DARB
;
6259 table
->CompressedTexSubImage1DARB
= save_CompressedTexSubImage1DARB
;
6260 table
->GetCompressedTexImageARB
= exec_GetCompressedTexImageARB
;
6262 /* ARB 14. GL_ARB_point_parameters */
6263 /* re-use EXT_point_parameters functions */
6265 /* ARB 25. GL_ARB_window_pos */
6266 /* re-use MESA_window_pos functions */
6274 static const char *enum_string( GLenum k
)
6276 return _mesa_lookup_enum_by_nr( k
);
6281 * Print the commands in a display list. For debugging only.
6282 * TODO: many commands aren't handled yet.
6284 static void print_list( GLcontext
*ctx
, GLuint list
)
6289 if (!glIsList(list
)) {
6290 _mesa_printf("%u is not a display list ID\n", list
);
6294 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
6296 _mesa_printf("START-LIST %u, address %p\n", list
, (void*)n
);
6298 done
= n
? GL_FALSE
: GL_TRUE
;
6300 OpCode opcode
= n
[0].opcode
;
6301 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_DRV_0
;
6303 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
6304 ctx
->listext
.opcode
[i
].print(ctx
, &n
[1]);
6305 n
+= ctx
->listext
.opcode
[i
].size
;
6310 _mesa_printf("accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
6313 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
6314 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
6316 case OPCODE_CALL_LIST
:
6317 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
6319 case OPCODE_CALL_LIST_OFFSET
:
6320 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
6321 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
6323 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
6324 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
6325 enum_string(n
[1].e
), enum_string(n
[2].e
),
6326 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6328 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
6329 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
6330 enum_string(n
[1].e
), enum_string(n
[2].e
),
6331 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
6333 case OPCODE_DISABLE
:
6334 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
6337 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
6339 case OPCODE_FRUSTUM
:
6340 _mesa_printf("Frustum %g %g %g %g %g %g\n",
6341 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6343 case OPCODE_LINE_STIPPLE
:
6344 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
6346 case OPCODE_LOAD_IDENTITY
:
6347 _mesa_printf("LoadIdentity\n");
6349 case OPCODE_LOAD_MATRIX
:
6350 _mesa_printf("LoadMatrix\n");
6351 _mesa_printf(" %8f %8f %8f %8f\n",
6352 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
6353 _mesa_printf(" %8f %8f %8f %8f\n",
6354 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
6355 _mesa_printf(" %8f %8f %8f %8f\n",
6356 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
6357 _mesa_printf(" %8f %8f %8f %8f\n",
6358 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
6360 case OPCODE_MULT_MATRIX
:
6361 _mesa_printf("MultMatrix (or Rotate)\n");
6362 _mesa_printf(" %8f %8f %8f %8f\n",
6363 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
6364 _mesa_printf(" %8f %8f %8f %8f\n",
6365 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
6366 _mesa_printf(" %8f %8f %8f %8f\n",
6367 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
6368 _mesa_printf(" %8f %8f %8f %8f\n",
6369 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
6372 _mesa_printf("Ortho %g %g %g %g %g %g\n",
6373 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6375 case OPCODE_POP_ATTRIB
:
6376 _mesa_printf("PopAttrib\n");
6378 case OPCODE_POP_MATRIX
:
6379 _mesa_printf("PopMatrix\n");
6381 case OPCODE_POP_NAME
:
6382 _mesa_printf("PopName\n");
6384 case OPCODE_PUSH_ATTRIB
:
6385 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
6387 case OPCODE_PUSH_MATRIX
:
6388 _mesa_printf("PushMatrix\n");
6390 case OPCODE_PUSH_NAME
:
6391 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
6393 case OPCODE_RASTER_POS
:
6394 _mesa_printf("RasterPos %g %g %g %g\n",
6395 n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
6398 _mesa_printf("Rotate %g %g %g %g\n",
6399 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6402 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
6404 case OPCODE_TRANSLATE
:
6405 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
6407 case OPCODE_BIND_TEXTURE
:
6408 _mesa_printf("BindTexture %s %d\n",
6409 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
6411 case OPCODE_SHADE_MODEL
:
6412 _mesa_printf("ShadeModel %s\n",
6413 _mesa_lookup_enum_by_nr(n
[1].ui
));
6416 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
6417 _mesa_lookup_enum_by_nr(n
[1].ui
),
6418 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
6421 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
6422 _mesa_lookup_enum_by_nr(n
[1].ui
),
6423 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
6424 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
6426 case OPCODE_MAPGRID1
:
6427 _mesa_printf("MapGrid1 %d %.3f %.3f\n",
6428 n
[1].i
, n
[2].f
, n
[3].f
);
6430 case OPCODE_MAPGRID2
:
6431 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
6432 n
[1].i
, n
[2].f
, n
[3].f
,
6433 n
[4].i
, n
[5].f
, n
[6].f
);
6435 case OPCODE_EVALMESH1
:
6436 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
6438 case OPCODE_EVALMESH2
:
6439 _mesa_printf("EvalMesh2 %d %d %d %d\n",
6440 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
6444 * meta opcodes/commands
6447 _mesa_printf("Error: %s %s\n",
6448 enum_string(n
[1].e
), (const char *)n
[2].data
);
6450 case OPCODE_CONTINUE
:
6451 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
6452 n
= (Node
*) n
[1].next
;
6454 case OPCODE_END_OF_LIST
:
6455 _mesa_printf("END-LIST %u\n", list
);
6459 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
6460 _mesa_printf("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
6465 _mesa_printf("command %d, %u operands\n", opcode
, InstSize
[opcode
]);
6468 /* increment n to point to next compiled command */
6469 if (opcode
!=OPCODE_CONTINUE
) {
6470 n
+= InstSize
[opcode
];
6479 * Clients may call this function to help debug display list problems.
6480 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
6481 * changed, or break in the future without notice.
6483 void mesa_print_display_list( GLuint list
)
6485 GET_CURRENT_CONTEXT(ctx
);
6486 print_list( ctx
, list
);