1 /* $Id: dlist.c,v 1.99 2002/10/24 23:57:20 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
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
) {
1151 if (ctx
->ExecuteFlag
) {
1152 (*ctx
->Exec
->ColorTableParameterfv
)( target
, pname
, params
);
1158 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1160 GET_CURRENT_CONTEXT(ctx
);
1163 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1165 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6 );
1170 if (pname
== GL_COLOR_TABLE_SGI
||
1171 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1172 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
) {
1179 if (ctx
->ExecuteFlag
) {
1180 (*ctx
->Exec
->ColorTableParameteriv
)( target
, pname
, params
);
1186 static void save_ColorSubTable( GLenum target
, GLsizei start
, GLsizei count
,
1187 GLenum format
, GLenum type
,
1188 const GLvoid
*table
)
1190 GET_CURRENT_CONTEXT(ctx
);
1191 GLvoid
*image
= _mesa_unpack_image(count
, 1, 1, format
, type
, table
,
1194 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1195 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_SUB_TABLE
, 6 );
1207 if (ctx
->ExecuteFlag
) {
1208 (*ctx
->Exec
->ColorSubTable
)(target
, start
, count
, format
, type
, table
);
1214 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1215 GLint x
, GLint y
, GLsizei width
)
1217 GET_CURRENT_CONTEXT(ctx
);
1220 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1221 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5 );
1229 if (ctx
->ExecuteFlag
) {
1230 (*ctx
->Exec
->CopyColorSubTable
)(target
, start
, x
, y
, width
);
1236 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1237 GLint x
, GLint y
, GLsizei width
)
1239 GET_CURRENT_CONTEXT(ctx
);
1242 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1243 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_TABLE
, 5 );
1246 n
[2].e
= internalformat
;
1251 if (ctx
->ExecuteFlag
) {
1252 (*ctx
->Exec
->CopyColorTable
)(target
, internalformat
, x
, y
, width
);
1258 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1259 GLenum format
, GLenum type
, const GLvoid
*filter
)
1261 GET_CURRENT_CONTEXT(ctx
);
1262 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, filter
,
1265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1266 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6 );
1269 n
[2].e
= internalFormat
;
1278 if (ctx
->ExecuteFlag
) {
1279 (*ctx
->Exec
->ConvolutionFilter1D
)( target
, internalFormat
, width
,
1280 format
, type
, filter
);
1286 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1287 GLsizei width
, GLsizei height
, GLenum format
,
1288 GLenum type
, const GLvoid
*filter
)
1290 GET_CURRENT_CONTEXT(ctx
);
1291 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
, filter
,
1294 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1295 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7 );
1298 n
[2].e
= internalFormat
;
1308 if (ctx
->ExecuteFlag
) {
1309 (*ctx
->Exec
->ConvolutionFilter2D
)( target
, internalFormat
, width
, height
,
1310 format
, type
, filter
);
1316 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1318 GET_CURRENT_CONTEXT(ctx
);
1320 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1321 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3 );
1327 if (ctx
->ExecuteFlag
) {
1328 (*ctx
->Exec
->ConvolutionParameteri
)( target
, pname
, param
);
1334 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1336 GET_CURRENT_CONTEXT(ctx
);
1338 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1339 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6 );
1344 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1345 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1346 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1352 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1355 if (ctx
->ExecuteFlag
) {
1356 (*ctx
->Exec
->ConvolutionParameteriv
)( target
, pname
, params
);
1362 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1364 GET_CURRENT_CONTEXT(ctx
);
1366 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1367 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3 );
1373 if (ctx
->ExecuteFlag
) {
1374 (*ctx
->Exec
->ConvolutionParameterf
)( target
, pname
, param
);
1380 save_ConvolutionParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1382 GET_CURRENT_CONTEXT(ctx
);
1384 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1385 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6 );
1390 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1391 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1392 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1398 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1401 if (ctx
->ExecuteFlag
) {
1402 (*ctx
->Exec
->ConvolutionParameterfv
)( target
, pname
, params
);
1408 save_CopyPixels( GLint x
, GLint y
,
1409 GLsizei width
, GLsizei height
, GLenum type
)
1411 GET_CURRENT_CONTEXT(ctx
);
1413 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1414 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_PIXELS
, 5 );
1418 n
[3].i
= (GLint
) width
;
1419 n
[4].i
= (GLint
) height
;
1422 if (ctx
->ExecuteFlag
) {
1423 (*ctx
->Exec
->CopyPixels
)( x
, y
, width
, height
, type
);
1430 save_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
1431 GLint x
, GLint y
, GLsizei width
, GLint border
)
1433 GET_CURRENT_CONTEXT(ctx
);
1435 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1436 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7 );
1440 n
[3].e
= internalformat
;
1446 if (ctx
->ExecuteFlag
) {
1447 (*ctx
->Exec
->CopyTexImage1D
)( target
, level
, internalformat
,
1448 x
, y
, width
, border
);
1454 save_CopyTexImage2D( GLenum target
, GLint level
,
1455 GLenum internalformat
,
1456 GLint x
, GLint y
, GLsizei width
,
1457 GLsizei height
, GLint border
)
1459 GET_CURRENT_CONTEXT(ctx
);
1461 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1462 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8 );
1466 n
[3].e
= internalformat
;
1473 if (ctx
->ExecuteFlag
) {
1474 (*ctx
->Exec
->CopyTexImage2D
)( target
, level
, internalformat
,
1475 x
, y
, width
, height
, border
);
1482 save_CopyTexSubImage1D( GLenum target
, GLint level
,
1483 GLint xoffset
, GLint x
, GLint y
,
1486 GET_CURRENT_CONTEXT(ctx
);
1488 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1489 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6 );
1498 if (ctx
->ExecuteFlag
) {
1499 (*ctx
->Exec
->CopyTexSubImage1D
)( target
, level
, xoffset
, x
, y
, width
);
1505 save_CopyTexSubImage2D( GLenum target
, GLint level
,
1506 GLint xoffset
, GLint yoffset
,
1508 GLsizei width
, GLint height
)
1510 GET_CURRENT_CONTEXT(ctx
);
1512 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1513 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8 );
1524 if (ctx
->ExecuteFlag
) {
1525 (*ctx
->Exec
->CopyTexSubImage2D
)( target
, level
, xoffset
, yoffset
,
1526 x
, y
, width
, height
);
1532 save_CopyTexSubImage3D( GLenum target
, GLint level
,
1533 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1535 GLsizei width
, GLint height
)
1537 GET_CURRENT_CONTEXT(ctx
);
1539 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1540 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9 );
1552 if (ctx
->ExecuteFlag
) {
1553 (*ctx
->Exec
->CopyTexSubImage3D
)( target
, level
,
1554 xoffset
, yoffset
, zoffset
,
1555 x
, y
, width
, height
);
1560 static void save_CullFace( GLenum mode
)
1562 GET_CURRENT_CONTEXT(ctx
);
1564 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1565 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CULL_FACE
, 1 );
1569 if (ctx
->ExecuteFlag
) {
1570 (*ctx
->Exec
->CullFace
)( mode
);
1575 static void save_DepthFunc( GLenum func
)
1577 GET_CURRENT_CONTEXT(ctx
);
1579 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1580 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_FUNC
, 1 );
1584 if (ctx
->ExecuteFlag
) {
1585 (*ctx
->Exec
->DepthFunc
)( func
);
1590 static void save_DepthMask( GLboolean mask
)
1592 GET_CURRENT_CONTEXT(ctx
);
1594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1595 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_MASK
, 1 );
1599 if (ctx
->ExecuteFlag
) {
1600 (*ctx
->Exec
->DepthMask
)( mask
);
1605 static void save_DepthRange( GLclampd nearval
, GLclampd farval
)
1607 GET_CURRENT_CONTEXT(ctx
);
1609 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1610 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_RANGE
, 2 );
1612 n
[1].f
= (GLfloat
) nearval
;
1613 n
[2].f
= (GLfloat
) farval
;
1615 if (ctx
->ExecuteFlag
) {
1616 (*ctx
->Exec
->DepthRange
)( nearval
, farval
);
1621 static void save_Disable( GLenum cap
)
1623 GET_CURRENT_CONTEXT(ctx
);
1625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1626 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DISABLE
, 1 );
1630 if (ctx
->ExecuteFlag
) {
1631 (*ctx
->Exec
->Disable
)( cap
);
1636 static void save_DrawBuffer( GLenum mode
)
1638 GET_CURRENT_CONTEXT(ctx
);
1640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1641 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_BUFFER
, 1 );
1645 if (ctx
->ExecuteFlag
) {
1646 (*ctx
->Exec
->DrawBuffer
)( mode
);
1651 static void save_DrawPixels( GLsizei width
, GLsizei height
,
1652 GLenum format
, GLenum type
,
1653 const GLvoid
*pixels
)
1655 GET_CURRENT_CONTEXT(ctx
);
1656 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
1657 pixels
, &ctx
->Unpack
);
1659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1660 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_PIXELS
, 5 );
1671 if (ctx
->ExecuteFlag
) {
1672 (*ctx
->Exec
->DrawPixels
)( width
, height
, format
, type
, pixels
);
1678 static void save_Enable( GLenum cap
)
1680 GET_CURRENT_CONTEXT(ctx
);
1682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1683 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ENABLE
, 1 );
1687 if (ctx
->ExecuteFlag
) {
1688 (*ctx
->Exec
->Enable
)( cap
);
1694 void _mesa_save_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
1696 GET_CURRENT_CONTEXT(ctx
);
1698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1699 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH1
, 3 );
1705 if (ctx
->ExecuteFlag
) {
1706 (*ctx
->Exec
->EvalMesh1
)( mode
, i1
, i2
);
1711 void _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1713 GET_CURRENT_CONTEXT(ctx
);
1715 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1716 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH2
, 5 );
1724 if (ctx
->ExecuteFlag
) {
1725 (*ctx
->Exec
->EvalMesh2
)( mode
, i1
, i2
, j1
, j2
);
1732 static void save_Fogfv( GLenum pname
, const GLfloat
*params
)
1734 GET_CURRENT_CONTEXT(ctx
);
1736 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1737 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FOG
, 5 );
1745 if (ctx
->ExecuteFlag
) {
1746 (*ctx
->Exec
->Fogfv
)( pname
, params
);
1751 static void save_Fogf( GLenum pname
, GLfloat param
)
1753 save_Fogfv(pname
, ¶m
);
1757 static void save_Fogiv(GLenum pname
, const GLint
*params
)
1762 case GL_FOG_DENSITY
:
1766 p
[0] = (GLfloat
) *params
;
1769 p
[0] = INT_TO_FLOAT( params
[0] );
1770 p
[1] = INT_TO_FLOAT( params
[1] );
1771 p
[2] = INT_TO_FLOAT( params
[2] );
1772 p
[3] = INT_TO_FLOAT( params
[3] );
1775 /* Error will be caught later in gl_Fogfv */
1778 save_Fogfv(pname
, p
);
1782 static void save_Fogi(GLenum pname
, GLint param
)
1784 save_Fogiv(pname
, ¶m
);
1788 static void save_FrontFace( GLenum mode
)
1790 GET_CURRENT_CONTEXT(ctx
);
1792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1793 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRONT_FACE
, 1 );
1797 if (ctx
->ExecuteFlag
) {
1798 (*ctx
->Exec
->FrontFace
)( mode
);
1803 static void save_Frustum( GLdouble left
, GLdouble right
,
1804 GLdouble bottom
, GLdouble top
,
1805 GLdouble nearval
, GLdouble farval
)
1807 GET_CURRENT_CONTEXT(ctx
);
1809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1810 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRUSTUM
, 6 );
1812 n
[1].f
= (GLfloat
) left
;
1813 n
[2].f
= (GLfloat
) right
;
1814 n
[3].f
= (GLfloat
) bottom
;
1815 n
[4].f
= (GLfloat
) top
;
1816 n
[5].f
= (GLfloat
) nearval
;
1817 n
[6].f
= (GLfloat
) farval
;
1819 if (ctx
->ExecuteFlag
) {
1820 (*ctx
->Exec
->Frustum
)( left
, right
, bottom
, top
, nearval
, farval
);
1825 static void save_Hint( GLenum target
, GLenum mode
)
1827 GET_CURRENT_CONTEXT(ctx
);
1829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1830 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HINT
, 2 );
1835 if (ctx
->ExecuteFlag
) {
1836 (*ctx
->Exec
->Hint
)( target
, mode
);
1842 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
, GLboolean sink
)
1844 GET_CURRENT_CONTEXT(ctx
);
1847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1848 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HISTOGRAM
, 4 );
1852 n
[3].e
= internalFormat
;
1855 if (ctx
->ExecuteFlag
) {
1856 (*ctx
->Exec
->Histogram
)( target
, width
, internalFormat
, sink
);
1861 static void save_IndexMask( GLuint mask
)
1863 GET_CURRENT_CONTEXT(ctx
);
1865 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1866 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_INDEX_MASK
, 1 );
1870 if (ctx
->ExecuteFlag
) {
1871 (*ctx
->Exec
->IndexMask
)( mask
);
1876 static void save_InitNames( void )
1878 GET_CURRENT_CONTEXT(ctx
);
1879 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1880 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_INIT_NAMES
, 0 );
1881 if (ctx
->ExecuteFlag
) {
1882 (*ctx
->Exec
->InitNames
)();
1887 static void save_Lightfv( GLenum light
, GLenum pname
, const GLfloat
*params
)
1889 GET_CURRENT_CONTEXT(ctx
);
1891 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1892 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT
, 6 );
1910 case GL_SPOT_DIRECTION
:
1913 case GL_SPOT_EXPONENT
:
1916 case GL_SPOT_CUTOFF
:
1919 case GL_CONSTANT_ATTENUATION
:
1922 case GL_LINEAR_ATTENUATION
:
1925 case GL_QUADRATIC_ATTENUATION
:
1931 for (i
= 0; i
< nParams
; i
++) {
1932 n
[3+i
].f
= params
[i
];
1935 if (ctx
->ExecuteFlag
) {
1936 (*ctx
->Exec
->Lightfv
)( light
, pname
, params
);
1941 static void save_Lightf( GLenum light
, GLenum pname
, GLfloat params
)
1943 save_Lightfv(light
, pname
, ¶ms
);
1947 static void save_Lightiv( GLenum light
, GLenum pname
, const GLint
*params
)
1954 fparam
[0] = INT_TO_FLOAT( params
[0] );
1955 fparam
[1] = INT_TO_FLOAT( params
[1] );
1956 fparam
[2] = INT_TO_FLOAT( params
[2] );
1957 fparam
[3] = INT_TO_FLOAT( params
[3] );
1960 fparam
[0] = (GLfloat
) params
[0];
1961 fparam
[1] = (GLfloat
) params
[1];
1962 fparam
[2] = (GLfloat
) params
[2];
1963 fparam
[3] = (GLfloat
) params
[3];
1965 case GL_SPOT_DIRECTION
:
1966 fparam
[0] = (GLfloat
) params
[0];
1967 fparam
[1] = (GLfloat
) params
[1];
1968 fparam
[2] = (GLfloat
) params
[2];
1970 case GL_SPOT_EXPONENT
:
1971 case GL_SPOT_CUTOFF
:
1972 case GL_CONSTANT_ATTENUATION
:
1973 case GL_LINEAR_ATTENUATION
:
1974 case GL_QUADRATIC_ATTENUATION
:
1975 fparam
[0] = (GLfloat
) params
[0];
1978 /* error will be caught later in gl_Lightfv */
1981 save_Lightfv( light
, pname
, fparam
);
1985 static void save_Lighti( GLenum light
, GLenum pname
, GLint param
)
1987 save_Lightiv( light
, pname
, ¶m
);
1991 static void save_LightModelfv( GLenum pname
, const GLfloat
*params
)
1993 GET_CURRENT_CONTEXT(ctx
);
1995 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1996 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT_MODEL
, 5 );
2004 if (ctx
->ExecuteFlag
) {
2005 (*ctx
->Exec
->LightModelfv
)( pname
, params
);
2010 static void save_LightModelf( GLenum pname
, GLfloat param
)
2012 save_LightModelfv(pname
, ¶m
);
2016 static void save_LightModeliv( GLenum pname
, const GLint
*params
)
2020 case GL_LIGHT_MODEL_AMBIENT
:
2021 fparam
[0] = INT_TO_FLOAT( params
[0] );
2022 fparam
[1] = INT_TO_FLOAT( params
[1] );
2023 fparam
[2] = INT_TO_FLOAT( params
[2] );
2024 fparam
[3] = INT_TO_FLOAT( params
[3] );
2026 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2027 case GL_LIGHT_MODEL_TWO_SIDE
:
2028 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2029 fparam
[0] = (GLfloat
) params
[0];
2032 /* Error will be caught later in gl_LightModelfv */
2035 save_LightModelfv(pname
, fparam
);
2039 static void save_LightModeli( GLenum pname
, GLint param
)
2041 save_LightModeliv(pname
, ¶m
);
2045 static void save_LineStipple( GLint factor
, GLushort pattern
)
2047 GET_CURRENT_CONTEXT(ctx
);
2049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2050 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_STIPPLE
, 2 );
2055 if (ctx
->ExecuteFlag
) {
2056 (*ctx
->Exec
->LineStipple
)( factor
, pattern
);
2061 static void save_LineWidth( GLfloat width
)
2063 GET_CURRENT_CONTEXT(ctx
);
2065 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2066 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_WIDTH
, 1 );
2070 if (ctx
->ExecuteFlag
) {
2071 (*ctx
->Exec
->LineWidth
)( width
);
2076 static void save_ListBase( GLuint base
)
2078 GET_CURRENT_CONTEXT(ctx
);
2080 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2081 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIST_BASE
, 1 );
2085 if (ctx
->ExecuteFlag
) {
2086 (*ctx
->Exec
->ListBase
)( base
);
2091 static void save_LoadIdentity( void )
2093 GET_CURRENT_CONTEXT(ctx
);
2094 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2095 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_IDENTITY
, 0 );
2096 if (ctx
->ExecuteFlag
) {
2097 (*ctx
->Exec
->LoadIdentity
)();
2102 static void save_LoadMatrixf( const GLfloat
*m
)
2104 GET_CURRENT_CONTEXT(ctx
);
2106 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2107 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_MATRIX
, 16 );
2110 for (i
=0;i
<16;i
++) {
2114 if (ctx
->ExecuteFlag
) {
2115 (*ctx
->Exec
->LoadMatrixf
)( m
);
2120 static void save_LoadMatrixd( const GLdouble
*m
)
2124 for (i
= 0; i
< 16; i
++) {
2125 f
[i
] = (GLfloat
) m
[i
];
2127 save_LoadMatrixf(f
);
2131 static void save_LoadName( GLuint name
)
2133 GET_CURRENT_CONTEXT(ctx
);
2135 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2136 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_NAME
, 1 );
2140 if (ctx
->ExecuteFlag
) {
2141 (*ctx
->Exec
->LoadName
)( name
);
2146 static void save_LogicOp( GLenum opcode
)
2148 GET_CURRENT_CONTEXT(ctx
);
2150 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2151 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOGIC_OP
, 1 );
2155 if (ctx
->ExecuteFlag
) {
2156 (*ctx
->Exec
->LogicOp
)( opcode
);
2161 static void save_Map1d( GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2162 GLint order
, const GLdouble
*points
)
2164 GET_CURRENT_CONTEXT(ctx
);
2166 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2167 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2169 GLfloat
*pnts
= _mesa_copy_map_points1d( target
, stride
, order
, points
);
2171 n
[2].f
= (GLfloat
) u1
;
2172 n
[3].f
= (GLfloat
) u2
;
2173 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2175 n
[6].data
= (void *) pnts
;
2177 if (ctx
->ExecuteFlag
) {
2178 (*ctx
->Exec
->Map1d
)( target
, u1
, u2
, stride
, order
, points
);
2182 static void save_Map1f( GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2183 GLint order
, const GLfloat
*points
)
2185 GET_CURRENT_CONTEXT(ctx
);
2187 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2188 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2190 GLfloat
*pnts
= _mesa_copy_map_points1f( target
, stride
, order
, points
);
2194 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2196 n
[6].data
= (void *) pnts
;
2198 if (ctx
->ExecuteFlag
) {
2199 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, stride
, order
, points
);
2204 static void save_Map2d( GLenum target
,
2205 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2206 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2207 const GLdouble
*points
)
2209 GET_CURRENT_CONTEXT(ctx
);
2211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2212 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2214 GLfloat
*pnts
= _mesa_copy_map_points2d( target
, ustride
, uorder
,
2215 vstride
, vorder
, points
);
2217 n
[2].f
= (GLfloat
) u1
;
2218 n
[3].f
= (GLfloat
) u2
;
2219 n
[4].f
= (GLfloat
) v1
;
2220 n
[5].f
= (GLfloat
) v2
;
2221 /* XXX verify these strides are correct */
2222 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2223 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2226 n
[10].data
= (void *) pnts
;
2228 if (ctx
->ExecuteFlag
) {
2229 (*ctx
->Exec
->Map2d
)( target
,
2230 u1
, u2
, ustride
, uorder
,
2231 v1
, v2
, vstride
, vorder
, points
);
2236 static void save_Map2f( GLenum target
,
2237 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2238 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2239 const GLfloat
*points
)
2241 GET_CURRENT_CONTEXT(ctx
);
2243 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2244 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2246 GLfloat
*pnts
= _mesa_copy_map_points2f( target
, ustride
, uorder
,
2247 vstride
, vorder
, points
);
2253 /* XXX verify these strides are correct */
2254 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2255 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2258 n
[10].data
= (void *) pnts
;
2260 if (ctx
->ExecuteFlag
) {
2261 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
2262 v1
, v2
, vstride
, vorder
, points
);
2267 static void save_MapGrid1f( GLint un
, GLfloat u1
, GLfloat u2
)
2269 GET_CURRENT_CONTEXT(ctx
);
2271 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2272 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID1
, 3 );
2278 if (ctx
->ExecuteFlag
) {
2279 (*ctx
->Exec
->MapGrid1f
)( un
, u1
, u2
);
2284 static void save_MapGrid1d( GLint un
, GLdouble u1
, GLdouble u2
)
2286 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2290 static void save_MapGrid2f( GLint un
, GLfloat u1
, GLfloat u2
,
2291 GLint vn
, GLfloat v1
, GLfloat v2
)
2293 GET_CURRENT_CONTEXT(ctx
);
2295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2296 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID2
, 6 );
2305 if (ctx
->ExecuteFlag
) {
2306 (*ctx
->Exec
->MapGrid2f
)( un
, u1
, u2
, vn
, v1
, v2
);
2312 static void save_MapGrid2d( GLint un
, GLdouble u1
, GLdouble u2
,
2313 GLint vn
, GLdouble v1
, GLdouble v2
)
2315 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2316 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2320 static void save_MatrixMode( GLenum mode
)
2322 GET_CURRENT_CONTEXT(ctx
);
2324 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2325 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MATRIX_MODE
, 1 );
2329 if (ctx
->ExecuteFlag
) {
2330 (*ctx
->Exec
->MatrixMode
)( mode
);
2336 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2338 GET_CURRENT_CONTEXT(ctx
);
2341 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2342 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MIN_MAX
, 3 );
2345 n
[2].e
= internalFormat
;
2348 if (ctx
->ExecuteFlag
) {
2349 (*ctx
->Exec
->Minmax
)( target
, internalFormat
, sink
);
2354 static void save_MultMatrixf( const GLfloat
*m
)
2356 GET_CURRENT_CONTEXT(ctx
);
2358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2359 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MULT_MATRIX
, 16 );
2362 for (i
=0;i
<16;i
++) {
2366 if (ctx
->ExecuteFlag
) {
2367 (*ctx
->Exec
->MultMatrixf
)( m
);
2372 static void save_MultMatrixd( const GLdouble
*m
)
2376 for (i
= 0; i
< 16; i
++) {
2377 f
[i
] = (GLfloat
) m
[i
];
2379 save_MultMatrixf(f
);
2383 static void save_NewList( GLuint list
, GLenum mode
)
2385 GET_CURRENT_CONTEXT(ctx
);
2386 /* It's an error to call this function while building a display list */
2387 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
2394 static void save_Ortho( GLdouble left
, GLdouble right
,
2395 GLdouble bottom
, GLdouble top
,
2396 GLdouble nearval
, GLdouble farval
)
2398 GET_CURRENT_CONTEXT(ctx
);
2400 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2401 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ORTHO
, 6 );
2403 n
[1].f
= (GLfloat
) left
;
2404 n
[2].f
= (GLfloat
) right
;
2405 n
[3].f
= (GLfloat
) bottom
;
2406 n
[4].f
= (GLfloat
) top
;
2407 n
[5].f
= (GLfloat
) nearval
;
2408 n
[6].f
= (GLfloat
) farval
;
2410 if (ctx
->ExecuteFlag
) {
2411 (*ctx
->Exec
->Ortho
)( left
, right
, bottom
, top
, nearval
, farval
);
2417 save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
2419 GET_CURRENT_CONTEXT(ctx
);
2421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2422 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_MAP
, 3 );
2426 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
2427 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
2429 if (ctx
->ExecuteFlag
) {
2430 (*ctx
->Exec
->PixelMapfv
)( map
, mapsize
, values
);
2436 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2438 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2440 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2441 for (i
=0;i
<mapsize
;i
++) {
2442 fvalues
[i
] = (GLfloat
) values
[i
];
2446 for (i
=0;i
<mapsize
;i
++) {
2447 fvalues
[i
] = UINT_TO_FLOAT( values
[i
] );
2450 save_PixelMapfv(map
, mapsize
, fvalues
);
2455 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2457 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2459 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2460 for (i
=0;i
<mapsize
;i
++) {
2461 fvalues
[i
] = (GLfloat
) values
[i
];
2465 for (i
=0;i
<mapsize
;i
++) {
2466 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2469 save_PixelMapfv(map
, mapsize
, fvalues
);
2474 save_PixelTransferf( GLenum pname
, GLfloat param
)
2476 GET_CURRENT_CONTEXT(ctx
);
2478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2479 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2484 if (ctx
->ExecuteFlag
) {
2485 (*ctx
->Exec
->PixelTransferf
)( pname
, param
);
2491 save_PixelTransferi( GLenum pname
, GLint param
)
2493 save_PixelTransferf( pname
, (GLfloat
) param
);
2498 save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2500 GET_CURRENT_CONTEXT(ctx
);
2502 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2503 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2508 if (ctx
->ExecuteFlag
) {
2509 (*ctx
->Exec
->PixelZoom
)( xfactor
, yfactor
);
2515 save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2517 GET_CURRENT_CONTEXT(ctx
);
2519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2520 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2527 if (ctx
->ExecuteFlag
) {
2528 (*ctx
->Exec
->PointParameterfvEXT
)( pname
, params
);
2533 static void save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2535 save_PointParameterfvEXT(pname
, ¶m
);
2538 static void save_PointParameteriNV( GLenum pname
, GLint param
)
2540 GLfloat p
= (GLfloat
) param
;
2541 save_PointParameterfvEXT(pname
, &p
);
2544 static void save_PointParameterivNV( GLenum pname
, const GLint
*param
)
2546 GLfloat p
= (GLfloat
) param
[0];
2547 save_PointParameterfvEXT(pname
, &p
);
2551 static void save_PointSize( GLfloat size
)
2553 GET_CURRENT_CONTEXT(ctx
);
2555 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2556 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_SIZE
, 1 );
2560 if (ctx
->ExecuteFlag
) {
2561 (*ctx
->Exec
->PointSize
)( size
);
2566 static void save_PolygonMode( GLenum face
, GLenum mode
)
2568 GET_CURRENT_CONTEXT(ctx
);
2570 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2571 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_MODE
, 2 );
2576 if (ctx
->ExecuteFlag
) {
2577 (*ctx
->Exec
->PolygonMode
)( face
, mode
);
2583 * Polygon stipple must have been upacked already!
2585 static void save_PolygonStipple( const GLubyte
*pattern
)
2587 GET_CURRENT_CONTEXT(ctx
);
2589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2590 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2593 n
[1].data
= MALLOC( 32 * 4 );
2594 data
= n
[1].data
; /* This needed for Acorn compiler */
2595 MEMCPY( data
, pattern
, 32 * 4 );
2597 if (ctx
->ExecuteFlag
) {
2598 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) pattern
);
2603 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2605 GET_CURRENT_CONTEXT(ctx
);
2607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2608 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2613 if (ctx
->ExecuteFlag
) {
2614 (*ctx
->Exec
->PolygonOffset
)( factor
, units
);
2619 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2621 GET_CURRENT_CONTEXT(ctx
);
2622 save_PolygonOffset(factor
, ctx
->DepthMaxF
* bias
);
2626 static void save_PopAttrib( void )
2628 GET_CURRENT_CONTEXT(ctx
);
2629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2630 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_ATTRIB
, 0 );
2631 if (ctx
->ExecuteFlag
) {
2632 (*ctx
->Exec
->PopAttrib
)();
2637 static void save_PopMatrix( void )
2639 GET_CURRENT_CONTEXT(ctx
);
2640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2641 FLUSH_CURRENT(ctx
, 0);
2642 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_MATRIX
, 0 );
2643 if (ctx
->ExecuteFlag
) {
2644 (*ctx
->Exec
->PopMatrix
)();
2649 static void save_PopName( void )
2651 GET_CURRENT_CONTEXT(ctx
);
2652 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2653 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_NAME
, 0 );
2654 if (ctx
->ExecuteFlag
) {
2655 (*ctx
->Exec
->PopName
)();
2660 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2661 const GLclampf
*priorities
)
2663 GET_CURRENT_CONTEXT(ctx
);
2665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2667 for (i
=0;i
<num
;i
++) {
2669 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2671 n
[1].ui
= textures
[i
];
2672 n
[2].f
= priorities
[i
];
2675 if (ctx
->ExecuteFlag
) {
2676 (*ctx
->Exec
->PrioritizeTextures
)( num
, textures
, priorities
);
2681 static void save_PushAttrib( GLbitfield mask
)
2683 GET_CURRENT_CONTEXT(ctx
);
2685 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2686 FLUSH_CURRENT(ctx
, 0);
2687 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2691 if (ctx
->ExecuteFlag
) {
2692 (*ctx
->Exec
->PushAttrib
)( mask
);
2697 static void save_PushMatrix( void )
2699 GET_CURRENT_CONTEXT(ctx
);
2700 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2701 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2702 if (ctx
->ExecuteFlag
) {
2703 (*ctx
->Exec
->PushMatrix
)();
2708 static void save_PushName( GLuint name
)
2710 GET_CURRENT_CONTEXT(ctx
);
2712 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2713 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_NAME
, 1 );
2717 if (ctx
->ExecuteFlag
) {
2718 (*ctx
->Exec
->PushName
)( name
);
2723 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2725 GET_CURRENT_CONTEXT(ctx
);
2727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2728 FLUSH_CURRENT(ctx
, 0);
2729 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RASTER_POS
, 4 );
2736 if (ctx
->ExecuteFlag
) {
2737 (*ctx
->Exec
->RasterPos4f
)( x
, y
, z
, w
);
2741 static void save_RasterPos2d(GLdouble x
, GLdouble y
)
2743 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2746 static void save_RasterPos2f(GLfloat x
, GLfloat y
)
2748 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2751 static void save_RasterPos2i(GLint x
, GLint y
)
2753 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2756 static void save_RasterPos2s(GLshort x
, GLshort y
)
2758 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2761 static void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2763 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2766 static void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2768 save_RasterPos4f(x
, y
, z
, 1.0F
);
2771 static void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2773 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2776 static void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2778 save_RasterPos4f(x
, y
, z
, 1.0F
);
2781 static void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2783 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2786 static void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2788 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2791 static void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2793 save_RasterPos4f(x
, y
, z
, w
);
2796 static void save_RasterPos2dv(const GLdouble
*v
)
2798 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2801 static void save_RasterPos2fv(const GLfloat
*v
)
2803 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2806 static void save_RasterPos2iv(const GLint
*v
)
2808 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2811 static void save_RasterPos2sv(const GLshort
*v
)
2813 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2816 static void save_RasterPos3dv(const GLdouble
*v
)
2818 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2821 static void save_RasterPos3fv(const GLfloat
*v
)
2823 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2826 static void save_RasterPos3iv(const GLint
*v
)
2828 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2831 static void save_RasterPos3sv(const GLshort
*v
)
2833 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2836 static void save_RasterPos4dv(const GLdouble
*v
)
2838 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
2839 (GLfloat
) v
[2], (GLfloat
) v
[3]);
2842 static void save_RasterPos4fv(const GLfloat
*v
)
2844 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2847 static void save_RasterPos4iv(const GLint
*v
)
2849 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
2850 (GLfloat
) v
[2], (GLfloat
) v
[3]);
2853 static void save_RasterPos4sv(const GLshort
*v
)
2855 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2859 static void save_PassThrough( GLfloat token
)
2861 GET_CURRENT_CONTEXT(ctx
);
2863 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2864 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PASSTHROUGH
, 1 );
2868 if (ctx
->ExecuteFlag
) {
2869 (*ctx
->Exec
->PassThrough
)( token
);
2874 static void save_ReadBuffer( GLenum mode
)
2876 GET_CURRENT_CONTEXT(ctx
);
2878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2879 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_READ_BUFFER
, 1 );
2883 if (ctx
->ExecuteFlag
) {
2884 (*ctx
->Exec
->ReadBuffer
)( mode
);
2890 save_ResetHistogram(GLenum target
)
2892 GET_CURRENT_CONTEXT(ctx
);
2894 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2895 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_HISTOGRAM
, 1 );
2899 if (ctx
->ExecuteFlag
) {
2900 (*ctx
->Exec
->ResetHistogram
)( target
);
2906 save_ResetMinmax(GLenum target
)
2908 GET_CURRENT_CONTEXT(ctx
);
2910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2911 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_MIN_MAX
, 1 );
2915 if (ctx
->ExecuteFlag
) {
2916 (*ctx
->Exec
->ResetMinmax
)( target
);
2921 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2923 GET_CURRENT_CONTEXT(ctx
);
2925 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2926 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ROTATE
, 4 );
2933 if (ctx
->ExecuteFlag
) {
2934 (*ctx
->Exec
->Rotatef
)( angle
, x
, y
, z
);
2939 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2941 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
2945 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2947 GET_CURRENT_CONTEXT(ctx
);
2949 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2950 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCALE
, 3 );
2956 if (ctx
->ExecuteFlag
) {
2957 (*ctx
->Exec
->Scalef
)( x
, y
, z
);
2962 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
2964 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
2968 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
2970 GET_CURRENT_CONTEXT(ctx
);
2972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2973 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCISSOR
, 4 );
2980 if (ctx
->ExecuteFlag
) {
2981 (*ctx
->Exec
->Scissor
)( x
, y
, width
, height
);
2986 static void save_ShadeModel( GLenum mode
)
2988 GET_CURRENT_CONTEXT(ctx
);
2990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2991 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SHADE_MODEL
, 1 );
2995 if (ctx
->ExecuteFlag
) {
2996 (*ctx
->Exec
->ShadeModel
)( mode
);
3001 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
3003 GET_CURRENT_CONTEXT(ctx
);
3005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3006 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_FUNC
, 3 );
3012 if (ctx
->ExecuteFlag
) {
3013 (*ctx
->Exec
->StencilFunc
)( func
, ref
, mask
);
3018 static void save_StencilMask( GLuint mask
)
3020 GET_CURRENT_CONTEXT(ctx
);
3022 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3023 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_MASK
, 1 );
3027 if (ctx
->ExecuteFlag
) {
3028 (*ctx
->Exec
->StencilMask
)( mask
);
3033 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
3035 GET_CURRENT_CONTEXT(ctx
);
3037 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3038 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_OP
, 3 );
3044 if (ctx
->ExecuteFlag
) {
3045 (*ctx
->Exec
->StencilOp
)( fail
, zfail
, zpass
);
3050 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
3052 GET_CURRENT_CONTEXT(ctx
);
3054 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3055 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXENV
, 6 );
3064 if (ctx
->ExecuteFlag
) {
3065 (*ctx
->Exec
->TexEnvfv
)( target
, pname
, params
);
3070 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
3072 save_TexEnvfv( target
, pname
, ¶m
);
3076 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
3079 p
[0] = (GLfloat
) param
;
3080 p
[1] = p
[2] = p
[3] = 0.0;
3081 save_TexEnvfv( target
, pname
, p
);
3085 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
3088 p
[0] = INT_TO_FLOAT( param
[0] );
3089 p
[1] = INT_TO_FLOAT( param
[1] );
3090 p
[2] = INT_TO_FLOAT( param
[2] );
3091 p
[3] = INT_TO_FLOAT( param
[3] );
3092 save_TexEnvfv( target
, pname
, p
);
3096 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
3098 GET_CURRENT_CONTEXT(ctx
);
3100 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3101 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXGEN
, 6 );
3110 if (ctx
->ExecuteFlag
) {
3111 (*ctx
->Exec
->TexGenfv
)( coord
, pname
, params
);
3116 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3119 p
[0] = (GLfloat
) params
[0];
3120 p
[1] = (GLfloat
) params
[1];
3121 p
[2] = (GLfloat
) params
[2];
3122 p
[3] = (GLfloat
) params
[3];
3123 save_TexGenfv(coord
, pname
, p
);
3127 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3129 GLfloat p
= (GLfloat
) param
;
3130 save_TexGenfv( coord
, pname
, &p
);
3134 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3137 p
[0] = (GLfloat
) params
[0];
3138 p
[1] = (GLfloat
) params
[1];
3139 p
[2] = (GLfloat
) params
[2];
3140 p
[3] = (GLfloat
) params
[3];
3141 save_TexGenfv( coord
, pname
, p
);
3145 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
3147 save_TexGenfv(coord
, pname
, ¶m
);
3151 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
3153 save_TexGeniv( coord
, pname
, ¶m
);
3157 static void save_TexParameterfv( GLenum target
,
3158 GLenum pname
, const GLfloat
*params
)
3160 GET_CURRENT_CONTEXT(ctx
);
3162 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3163 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXPARAMETER
, 6 );
3172 if (ctx
->ExecuteFlag
) {
3173 (*ctx
->Exec
->TexParameterfv
)( target
, pname
, params
);
3178 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
3180 save_TexParameterfv(target
, pname
, ¶m
);
3184 static void save_TexParameteri( GLenum target
, GLenum pname
, GLint param
)
3187 fparam
[0] = (GLfloat
) param
;
3188 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3189 save_TexParameterfv(target
, pname
, fparam
);
3193 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
3196 fparam
[0] = (GLfloat
) params
[0];
3197 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3198 save_TexParameterfv(target
, pname
, fparam
);
3202 static void save_TexImage1D( GLenum target
,
3203 GLint level
, GLint components
,
3204 GLsizei width
, GLint border
,
3205 GLenum format
, GLenum type
,
3206 const GLvoid
*pixels
)
3208 GET_CURRENT_CONTEXT(ctx
);
3209 if (target
== GL_PROXY_TEXTURE_1D
) {
3210 /* don't compile, execute immediately */
3211 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3212 border
, format
, type
, pixels
);
3215 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3216 pixels
, &ctx
->Unpack
);
3218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3219 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
3223 n
[3].i
= components
;
3224 n
[4].i
= (GLint
) width
;
3233 if (ctx
->ExecuteFlag
) {
3234 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3235 border
, format
, type
, pixels
);
3241 static void save_TexImage2D( GLenum target
,
3242 GLint level
, GLint components
,
3243 GLsizei width
, GLsizei height
, GLint border
,
3244 GLenum format
, GLenum type
,
3245 const GLvoid
*pixels
)
3247 GET_CURRENT_CONTEXT(ctx
);
3248 if (target
== GL_PROXY_TEXTURE_2D
) {
3249 /* don't compile, execute immediately */
3250 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3251 height
, border
, format
, type
, pixels
);
3254 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3255 pixels
, &ctx
->Unpack
);
3257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3258 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
3262 n
[3].i
= components
;
3263 n
[4].i
= (GLint
) width
;
3264 n
[5].i
= (GLint
) height
;
3273 if (ctx
->ExecuteFlag
) {
3274 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3275 height
, border
, format
, type
, pixels
);
3281 static void save_TexImage3D( GLenum target
,
3282 GLint level
, GLint internalFormat
,
3283 GLsizei width
, GLsizei height
, GLsizei depth
,
3285 GLenum format
, GLenum type
,
3286 const GLvoid
*pixels
)
3288 GET_CURRENT_CONTEXT(ctx
);
3289 if (target
== GL_PROXY_TEXTURE_3D
) {
3290 /* don't compile, execute immediately */
3291 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3292 height
, depth
, border
, format
, type
, pixels
);
3296 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3297 pixels
, &ctx
->Unpack
);
3298 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3299 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
3303 n
[3].i
= (GLint
) internalFormat
;
3304 n
[4].i
= (GLint
) width
;
3305 n
[5].i
= (GLint
) height
;
3306 n
[6].i
= (GLint
) depth
;
3315 if (ctx
->ExecuteFlag
) {
3316 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3317 height
, depth
, border
, format
, type
, pixels
);
3323 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
3324 GLsizei width
, GLenum format
, GLenum type
,
3325 const GLvoid
*pixels
)
3327 GET_CURRENT_CONTEXT(ctx
);
3329 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3330 pixels
, &ctx
->Unpack
);
3331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3332 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
3337 n
[4].i
= (GLint
) width
;
3345 if (ctx
->ExecuteFlag
) {
3346 (*ctx
->Exec
->TexSubImage1D
)( target
, level
, xoffset
, width
,
3347 format
, type
, pixels
);
3352 static void save_TexSubImage2D( GLenum target
, GLint level
,
3353 GLint xoffset
, GLint yoffset
,
3354 GLsizei width
, GLsizei height
,
3355 GLenum format
, GLenum type
,
3356 const GLvoid
*pixels
)
3358 GET_CURRENT_CONTEXT(ctx
);
3360 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3361 pixels
, &ctx
->Unpack
);
3362 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3363 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
3369 n
[5].i
= (GLint
) width
;
3370 n
[6].i
= (GLint
) height
;
3378 if (ctx
->ExecuteFlag
) {
3379 (*ctx
->Exec
->TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
3380 width
, height
, format
, type
, pixels
);
3385 static void save_TexSubImage3D( GLenum target
, GLint level
,
3386 GLint xoffset
, GLint yoffset
,GLint zoffset
,
3387 GLsizei width
, GLsizei height
, GLsizei depth
,
3388 GLenum format
, GLenum type
,
3389 const GLvoid
*pixels
)
3391 GET_CURRENT_CONTEXT(ctx
);
3393 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3394 pixels
, &ctx
->Unpack
);
3395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3396 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
3403 n
[6].i
= (GLint
) width
;
3404 n
[7].i
= (GLint
) height
;
3405 n
[8].i
= (GLint
) depth
;
3413 if (ctx
->ExecuteFlag
) {
3414 (*ctx
->Exec
->TexSubImage3D
)( target
, level
,
3415 xoffset
, yoffset
, zoffset
,
3416 width
, height
, depth
, format
, type
, pixels
);
3421 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
3423 GET_CURRENT_CONTEXT(ctx
);
3425 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3426 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRANSLATE
, 3 );
3432 if (ctx
->ExecuteFlag
) {
3433 (*ctx
->Exec
->Translatef
)( x
, y
, z
);
3438 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3440 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3445 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3447 GET_CURRENT_CONTEXT(ctx
);
3449 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3450 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_VIEWPORT
, 4 );
3454 n
[3].i
= (GLint
) width
;
3455 n
[4].i
= (GLint
) height
;
3457 if (ctx
->ExecuteFlag
) {
3458 (*ctx
->Exec
->Viewport
)( x
, y
, width
, height
);
3463 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3465 GET_CURRENT_CONTEXT(ctx
);
3467 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3468 FLUSH_CURRENT(ctx
, 0);
3469 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_WINDOW_POS
, 4 );
3476 if (ctx
->ExecuteFlag
) {
3477 (*ctx
->Exec
->WindowPos4fMESA
)( x
, y
, z
, w
);
3481 static void save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3483 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3486 static void save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3488 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3491 static void save_WindowPos2iMESA(GLint x
, GLint y
)
3493 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3496 static void save_WindowPos2sMESA(GLshort x
, GLshort y
)
3498 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3501 static void save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3503 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3506 static void save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3508 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3511 static void save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3513 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3516 static void save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3518 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3521 static void save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3523 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3526 static void save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3528 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3531 static void save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3533 save_WindowPos4fMESA(x
, y
, z
, w
);
3536 static void save_WindowPos2dvMESA(const GLdouble
*v
)
3538 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3541 static void save_WindowPos2fvMESA(const GLfloat
*v
)
3543 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3546 static void save_WindowPos2ivMESA(const GLint
*v
)
3548 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3551 static void save_WindowPos2svMESA(const GLshort
*v
)
3553 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3556 static void save_WindowPos3dvMESA(const GLdouble
*v
)
3558 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3561 static void save_WindowPos3fvMESA(const GLfloat
*v
)
3563 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3566 static void save_WindowPos3ivMESA(const GLint
*v
)
3568 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3571 static void save_WindowPos3svMESA(const GLshort
*v
)
3573 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3576 static void save_WindowPos4dvMESA(const GLdouble
*v
)
3578 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3579 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3582 static void save_WindowPos4fvMESA(const GLfloat
*v
)
3584 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3587 static void save_WindowPos4ivMESA(const GLint
*v
)
3589 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3590 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3593 static void save_WindowPos4svMESA(const GLshort
*v
)
3595 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3600 /* GL_ARB_multitexture */
3601 static void save_ActiveTextureARB( GLenum target
)
3603 GET_CURRENT_CONTEXT(ctx
);
3605 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3606 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3610 if (ctx
->ExecuteFlag
) {
3611 (*ctx
->Exec
->ActiveTextureARB
)( target
);
3616 /* GL_ARB_transpose_matrix */
3618 static void save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3621 _math_transposefd(tm
, m
);
3622 save_LoadMatrixf(tm
);
3626 static void save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3629 _math_transposef(tm
, m
);
3630 save_LoadMatrixf(tm
);
3635 save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3638 _math_transposefd(tm
, m
);
3639 save_MultMatrixf(tm
);
3644 save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3647 _math_transposef(tm
, m
);
3648 save_MultMatrixf(tm
);
3653 save_PixelTexGenSGIX(GLenum mode
)
3655 GET_CURRENT_CONTEXT(ctx
);
3657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3658 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_SGIX
, 1 );
3662 if (ctx
->ExecuteFlag
) {
3663 (*ctx
->Exec
->PixelTexGenSGIX
)( mode
);
3668 /* GL_ARB_texture_compression */
3670 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3671 GLenum internalFormat
, GLsizei width
,
3672 GLint border
, GLsizei imageSize
,
3675 GET_CURRENT_CONTEXT(ctx
);
3676 if (target
== GL_PROXY_TEXTURE_1D
) {
3677 /* don't compile, execute immediately */
3678 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3679 width
, border
, imageSize
, data
);
3684 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3685 /* make copy of image */
3686 image
= MALLOC(imageSize
);
3688 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3691 MEMCPY(image
, data
, imageSize
);
3692 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7 );
3696 n
[3].e
= internalFormat
;
3697 n
[4].i
= (GLint
) width
;
3705 if (ctx
->ExecuteFlag
) {
3706 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3707 width
, border
, imageSize
, data
);
3714 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
3715 GLenum internalFormat
, GLsizei width
,
3716 GLsizei height
, GLint border
, GLsizei imageSize
,
3719 GET_CURRENT_CONTEXT(ctx
);
3720 if (target
== GL_PROXY_TEXTURE_2D
) {
3721 /* don't compile, execute immediately */
3722 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3723 width
, height
, border
, imageSize
, data
);
3728 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3729 /* make copy of image */
3730 image
= MALLOC(imageSize
);
3732 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
3735 MEMCPY(image
, data
, imageSize
);
3736 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8 );
3740 n
[3].e
= internalFormat
;
3741 n
[4].i
= (GLint
) width
;
3742 n
[5].i
= (GLint
) height
;
3750 if (ctx
->ExecuteFlag
) {
3751 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3752 width
, height
, border
, imageSize
, data
);
3759 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
3760 GLenum internalFormat
, GLsizei width
,
3761 GLsizei height
, GLsizei depth
, GLint border
,
3762 GLsizei imageSize
, const GLvoid
*data
)
3764 GET_CURRENT_CONTEXT(ctx
);
3765 if (target
== GL_PROXY_TEXTURE_3D
) {
3766 /* don't compile, execute immediately */
3767 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3768 width
, height
, depth
, border
, imageSize
, data
);
3773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3774 /* make copy of image */
3775 image
= MALLOC(imageSize
);
3777 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
3780 MEMCPY(image
, data
, imageSize
);
3781 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9 );
3785 n
[3].e
= internalFormat
;
3786 n
[4].i
= (GLint
) width
;
3787 n
[5].i
= (GLint
) height
;
3788 n
[6].i
= (GLint
) depth
;
3796 if (ctx
->ExecuteFlag
) {
3797 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3798 width
, height
, depth
, border
, imageSize
, data
);
3805 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
3806 GLsizei width
, GLenum format
,
3807 GLsizei imageSize
, const GLvoid
*data
)
3812 GET_CURRENT_CONTEXT(ctx
);
3813 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3815 /* make copy of image */
3816 image
= MALLOC(imageSize
);
3818 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
3821 MEMCPY(image
, data
, imageSize
);
3822 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7 );
3827 n
[4].i
= (GLint
) width
;
3835 if (ctx
->ExecuteFlag
) {
3836 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(target
, level
, xoffset
,
3837 width
, format
, imageSize
, data
);
3843 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
3844 GLint yoffset
, GLsizei width
, GLsizei height
,
3845 GLenum format
, GLsizei imageSize
,
3851 GET_CURRENT_CONTEXT(ctx
);
3852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3854 /* make copy of image */
3855 image
= MALLOC(imageSize
);
3857 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
3860 MEMCPY(image
, data
, imageSize
);
3861 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9 );
3867 n
[5].i
= (GLint
) width
;
3868 n
[6].i
= (GLint
) height
;
3876 if (ctx
->ExecuteFlag
) {
3877 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(target
, level
, xoffset
, yoffset
,
3878 width
, height
, format
, imageSize
, data
);
3884 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
3885 GLint yoffset
, GLint zoffset
, GLsizei width
,
3886 GLsizei height
, GLsizei depth
, GLenum format
,
3887 GLsizei imageSize
, const GLvoid
*data
)
3892 GET_CURRENT_CONTEXT(ctx
);
3893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3895 /* make copy of image */
3896 image
= MALLOC(imageSize
);
3898 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
3901 MEMCPY(image
, data
, imageSize
);
3902 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11 );
3909 n
[6].i
= (GLint
) width
;
3910 n
[7].i
= (GLint
) height
;
3911 n
[8].i
= (GLint
) depth
;
3913 n
[10].i
= imageSize
;
3919 if (ctx
->ExecuteFlag
) {
3920 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(target
, level
, xoffset
, yoffset
,
3921 zoffset
, width
, height
, depth
, format
, imageSize
, data
);
3926 /* GL_ARB_multisample */
3928 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
3930 GET_CURRENT_CONTEXT(ctx
);
3932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3933 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SAMPLE_COVERAGE
, 2 );
3938 if (ctx
->ExecuteFlag
) {
3939 (*ctx
->Exec
->SampleCoverageARB
)( value
, invert
);
3944 /* GL_SGIS_pixel_texture */
3947 save_PixelTexGenParameteriSGIS(GLenum target
, GLint value
)
3949 GET_CURRENT_CONTEXT(ctx
);
3951 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3952 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
, 2 );
3957 if (ctx
->ExecuteFlag
) {
3958 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( target
, value
);
3964 save_PixelTexGenParameterfSGIS(GLenum target
, GLfloat value
)
3966 save_PixelTexGenParameteriSGIS(target
, (GLint
) value
);
3971 save_PixelTexGenParameterivSGIS(GLenum target
, const GLint
*value
)
3973 save_PixelTexGenParameteriSGIS(target
, *value
);
3978 save_PixelTexGenParameterfvSGIS(GLenum target
, const GLfloat
*value
)
3980 save_PixelTexGenParameteriSGIS(target
, (GLint
) *value
);
3985 * GL_NV_vertex_program
3987 #if FEATURE_NV_vertex_program
3989 save_BindProgramNV(GLenum target
, GLuint id
)
3991 GET_CURRENT_CONTEXT(ctx
);
3993 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3994 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_PROGRAM_NV
, 2 );
3999 if (ctx
->ExecuteFlag
) {
4000 (*ctx
->Exec
->BindProgramNV
)( target
, id
);
4005 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4007 GET_CURRENT_CONTEXT(ctx
);
4009 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4010 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6 );
4019 if (ctx
->ExecuteFlag
) {
4020 (*ctx
->Exec
->ExecuteProgramNV
)(target
, id
, params
);
4026 save_ProgramParameter4fNV(GLenum target
, GLuint index
,
4027 GLfloat x
, GLfloat y
,
4028 GLfloat z
, GLfloat w
)
4030 GET_CURRENT_CONTEXT(ctx
);
4032 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4033 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_PARAMETER4F_NV
, 6 );
4042 if (ctx
->ExecuteFlag
) {
4043 (*ctx
->Exec
->ProgramParameter4fNV
)(target
, index
, x
, y
, z
, w
);
4049 save_ProgramParameter4fvNV(GLenum target
, GLuint index
, const GLfloat
*params
)
4051 save_ProgramParameter4fNV(target
, index
, params
[0], params
[1],
4052 params
[2], params
[3]);
4057 save_ProgramParameter4dNV(GLenum target
, GLuint index
,
4058 GLdouble x
, GLdouble y
,
4059 GLdouble z
, GLdouble w
)
4061 save_ProgramParameter4fNV(target
, index
, (GLfloat
) x
, (GLfloat
) y
,
4062 (GLfloat
) z
, (GLfloat
) w
);
4067 save_ProgramParameter4dvNV(GLenum target
, GLuint index
,
4068 const GLdouble
*params
)
4070 save_ProgramParameter4fNV(target
, index
, (GLfloat
) params
[0],
4071 (GLfloat
) params
[1], (GLfloat
) params
[2],
4072 (GLfloat
) params
[3]);
4077 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4078 GLuint num
, const GLdouble
*params
)
4081 for (i
= 0; i
< num
; i
++) {
4082 save_ProgramParameter4dvNV(target
, index
+ i
, params
+ 4 * i
);
4088 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4089 GLuint num
, const GLfloat
*params
)
4092 for (i
= 0; i
< num
; i
++) {
4093 save_ProgramParameter4fvNV(target
, index
+ i
, params
+ 4 * i
);
4100 save_TrackMatrixNV(GLenum target
, GLuint address
,
4101 GLenum matrix
, GLenum transform
)
4103 GET_CURRENT_CONTEXT(ctx
);
4105 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4106 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRACK_MATRIX_NV
, 4 );
4113 if (ctx
->ExecuteFlag
) {
4114 (*ctx
->Exec
->TrackMatrixNV
)(target
, address
, matrix
, transform
);
4117 #endif /* FEATURE_NV_vertex_program */
4120 /* GL_EXT_stencil_two_side */
4121 static void save_ActiveStencilFaceEXT( GLenum face
)
4123 GET_CURRENT_CONTEXT(ctx
);
4125 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4126 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1 );
4130 if (ctx
->ExecuteFlag
) {
4131 (*ctx
->Exec
->ActiveStencilFaceEXT
)( face
);
4137 /* KW: Compile commands
4139 * Will appear in the list before the vertex buffer containing the
4140 * command that provoked the error. I don't see this as a problem.
4143 _mesa_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
4146 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ERROR
, 2 );
4149 n
[2].data
= (void *) s
;
4151 /* execute already done */
4156 * Compile an error into current display list.
4159 _mesa_compile_error( GLcontext
*ctx
, GLenum error
, const char *s
)
4161 if (ctx
->CompileFlag
)
4162 _mesa_save_error( ctx
, error
, s
);
4164 if (ctx
->ExecuteFlag
)
4165 _mesa_error( ctx
, error
, s
);
4171 islist(GLcontext
*ctx
, GLuint list
)
4173 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
4183 /**********************************************************************/
4184 /* Display list execution */
4185 /**********************************************************************/
4189 * Execute a display list. Note that the ListBase offset must have already
4190 * been added before calling this function. I.e. the list argument is
4191 * the absolute list number, not relative to ListBase.
4192 * Input: list - display list number
4195 execute_list( GLcontext
*ctx
, GLuint list
)
4200 if (!islist(ctx
,list
))
4203 if (ctx
->Driver
.BeginCallList
)
4204 ctx
->Driver
.BeginCallList( ctx
, list
);
4208 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
4212 OpCode opcode
= n
[0].opcode
;
4213 int i
= (int)n
[0].opcode
- (int)OPCODE_DRV_0
;
4215 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
4216 ctx
->listext
.opcode
[i
].execute(ctx
, &n
[1]);
4217 n
+= ctx
->listext
.opcode
[i
].size
;
4222 _mesa_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
4225 (*ctx
->Exec
->Accum
)( n
[1].e
, n
[2].f
);
4227 case OPCODE_ALPHA_FUNC
:
4228 (*ctx
->Exec
->AlphaFunc
)( n
[1].e
, n
[2].f
);
4230 case OPCODE_BIND_TEXTURE
:
4231 (*ctx
->Exec
->BindTexture
)( n
[1].e
, n
[2].ui
);
4235 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4236 ctx
->Unpack
= _mesa_native_packing
;
4237 (*ctx
->Exec
->Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
4238 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (const GLubyte
*) n
[7].data
);
4239 ctx
->Unpack
= save
; /* restore */
4242 case OPCODE_BLEND_COLOR
:
4243 (*ctx
->Exec
->BlendColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4245 case OPCODE_BLEND_EQUATION
:
4246 (*ctx
->Exec
->BlendEquation
)( n
[1].e
);
4248 case OPCODE_BLEND_FUNC
:
4249 (*ctx
->Exec
->BlendFunc
)( n
[1].e
, n
[2].e
);
4251 case OPCODE_BLEND_FUNC_SEPARATE
:
4252 (*ctx
->Exec
->BlendFuncSeparateEXT
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
4254 case OPCODE_CALL_LIST
:
4255 /* Generated by glCallList(), don't add ListBase */
4256 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4257 execute_list( ctx
, n
[1].ui
);
4260 case OPCODE_CALL_LIST_OFFSET
:
4261 /* Generated by glCallLists() so we must add ListBase */
4263 /* user specified a bad datatype at compile time */
4264 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
4266 else if (ctx
->CallDepth
< MAX_LIST_NESTING
) {
4267 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
4271 (*ctx
->Exec
->Clear
)( n
[1].bf
);
4273 case OPCODE_CLEAR_COLOR
:
4274 (*ctx
->Exec
->ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4276 case OPCODE_CLEAR_ACCUM
:
4277 (*ctx
->Exec
->ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4279 case OPCODE_CLEAR_DEPTH
:
4280 (*ctx
->Exec
->ClearDepth
)( (GLclampd
) n
[1].f
);
4282 case OPCODE_CLEAR_INDEX
:
4283 (*ctx
->Exec
->ClearIndex
)( (GLfloat
) n
[1].ui
);
4285 case OPCODE_CLEAR_STENCIL
:
4286 (*ctx
->Exec
->ClearStencil
)( n
[1].i
);
4288 case OPCODE_CLIP_PLANE
:
4295 (*ctx
->Exec
->ClipPlane
)( n
[1].e
, eq
);
4298 case OPCODE_COLOR_MASK
:
4299 (*ctx
->Exec
->ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
4301 case OPCODE_COLOR_MATERIAL
:
4302 (*ctx
->Exec
->ColorMaterial
)( n
[1].e
, n
[2].e
);
4304 case OPCODE_COLOR_TABLE
:
4306 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4307 ctx
->Unpack
= _mesa_native_packing
;
4308 (*ctx
->Exec
->ColorTable
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
4309 n
[5].e
, n
[6].data
);
4310 ctx
->Unpack
= save
; /* restore */
4313 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
4320 (*ctx
->Exec
->ColorTableParameterfv
)( n
[1].e
, n
[2].e
, params
);
4323 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
4330 (*ctx
->Exec
->ColorTableParameteriv
)( n
[1].e
, n
[2].e
, params
);
4333 case OPCODE_COLOR_SUB_TABLE
:
4335 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4336 ctx
->Unpack
= _mesa_native_packing
;
4337 (*ctx
->Exec
->ColorSubTable
)( n
[1].e
, n
[2].i
, n
[3].i
,
4338 n
[4].e
, n
[5].e
, n
[6].data
);
4339 ctx
->Unpack
= save
; /* restore */
4342 case OPCODE_CONVOLUTION_FILTER_1D
:
4344 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4345 ctx
->Unpack
= _mesa_native_packing
;
4346 (*ctx
->Exec
->ConvolutionFilter1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4347 n
[4].e
, n
[5].e
, n
[6].data
);
4348 ctx
->Unpack
= save
; /* restore */
4351 case OPCODE_CONVOLUTION_FILTER_2D
:
4353 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4354 ctx
->Unpack
= _mesa_native_packing
;
4355 (*ctx
->Exec
->ConvolutionFilter2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4356 n
[4].i
, n
[5].e
, n
[6].e
, n
[7].data
);
4357 ctx
->Unpack
= save
; /* restore */
4360 case OPCODE_CONVOLUTION_PARAMETER_I
:
4361 (*ctx
->Exec
->ConvolutionParameteri
)( n
[1].e
, n
[2].e
, n
[3].i
);
4363 case OPCODE_CONVOLUTION_PARAMETER_IV
:
4370 (*ctx
->Exec
->ConvolutionParameteriv
)( n
[1].e
, n
[2].e
, params
);
4373 case OPCODE_CONVOLUTION_PARAMETER_F
:
4374 (*ctx
->Exec
->ConvolutionParameterf
)( n
[1].e
, n
[2].e
, n
[3].f
);
4376 case OPCODE_CONVOLUTION_PARAMETER_FV
:
4383 (*ctx
->Exec
->ConvolutionParameterfv
)( n
[1].e
, n
[2].e
, params
);
4386 case OPCODE_COPY_COLOR_SUB_TABLE
:
4387 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4388 n
[3].i
, n
[4].i
, n
[5].i
);
4390 case OPCODE_COPY_COLOR_TABLE
:
4391 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4392 n
[3].i
, n
[4].i
, n
[5].i
);
4394 case OPCODE_COPY_PIXELS
:
4395 (*ctx
->Exec
->CopyPixels
)( n
[1].i
, n
[2].i
,
4396 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
4398 case OPCODE_COPY_TEX_IMAGE1D
:
4399 (*ctx
->Exec
->CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4400 n
[5].i
, n
[6].i
, n
[7].i
);
4402 case OPCODE_COPY_TEX_IMAGE2D
:
4403 (*ctx
->Exec
->CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4404 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4406 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
4407 (*ctx
->Exec
->CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4408 n
[4].i
, n
[5].i
, n
[6].i
);
4410 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
4411 (*ctx
->Exec
->CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4412 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4414 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
4415 (*ctx
->Exec
->CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4416 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
4418 case OPCODE_CULL_FACE
:
4419 (*ctx
->Exec
->CullFace
)( n
[1].e
);
4421 case OPCODE_DEPTH_FUNC
:
4422 (*ctx
->Exec
->DepthFunc
)( n
[1].e
);
4424 case OPCODE_DEPTH_MASK
:
4425 (*ctx
->Exec
->DepthMask
)( n
[1].b
);
4427 case OPCODE_DEPTH_RANGE
:
4428 (*ctx
->Exec
->DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
4430 case OPCODE_DISABLE
:
4431 (*ctx
->Exec
->Disable
)( n
[1].e
);
4433 case OPCODE_DRAW_BUFFER
:
4434 (*ctx
->Exec
->DrawBuffer
)( n
[1].e
);
4436 case OPCODE_DRAW_PIXELS
:
4438 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4439 ctx
->Unpack
= _mesa_native_packing
;
4440 (*ctx
->Exec
->DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
4442 ctx
->Unpack
= save
; /* restore */
4446 (*ctx
->Exec
->Enable
)( n
[1].e
);
4448 case OPCODE_EVALMESH1
:
4449 (*ctx
->Exec
->EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
4451 case OPCODE_EVALMESH2
:
4452 (*ctx
->Exec
->EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
4461 (*ctx
->Exec
->Fogfv
)( n
[1].e
, p
);
4464 case OPCODE_FRONT_FACE
:
4465 (*ctx
->Exec
->FrontFace
)( n
[1].e
);
4467 case OPCODE_FRUSTUM
:
4468 (*ctx
->Exec
->Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4471 (*ctx
->Exec
->Hint
)( n
[1].e
, n
[2].e
);
4473 case OPCODE_HISTOGRAM
:
4474 (*ctx
->Exec
->Histogram
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
);
4476 case OPCODE_INDEX_MASK
:
4477 (*ctx
->Exec
->IndexMask
)( n
[1].ui
);
4479 case OPCODE_INIT_NAMES
:
4480 (*ctx
->Exec
->InitNames
)();
4489 (*ctx
->Exec
->Lightfv
)( n
[1].e
, n
[2].e
, p
);
4492 case OPCODE_LIGHT_MODEL
:
4499 (*ctx
->Exec
->LightModelfv
)( n
[1].e
, p
);
4502 case OPCODE_LINE_STIPPLE
:
4503 (*ctx
->Exec
->LineStipple
)( n
[1].i
, n
[2].us
);
4505 case OPCODE_LINE_WIDTH
:
4506 (*ctx
->Exec
->LineWidth
)( n
[1].f
);
4508 case OPCODE_LIST_BASE
:
4509 (*ctx
->Exec
->ListBase
)( n
[1].ui
);
4511 case OPCODE_LOAD_IDENTITY
:
4512 (*ctx
->Exec
->LoadIdentity
)();
4514 case OPCODE_LOAD_MATRIX
:
4515 if (sizeof(Node
)==sizeof(GLfloat
)) {
4516 (*ctx
->Exec
->LoadMatrixf
)( &n
[1].f
);
4521 for (i
=0;i
<16;i
++) {
4524 (*ctx
->Exec
->LoadMatrixf
)( m
);
4527 case OPCODE_LOAD_NAME
:
4528 (*ctx
->Exec
->LoadName
)( n
[1].ui
);
4530 case OPCODE_LOGIC_OP
:
4531 (*ctx
->Exec
->LogicOp
)( n
[1].e
);
4535 GLenum target
= n
[1].e
;
4536 GLint ustride
= _mesa_evaluator_components(target
);
4537 GLint uorder
= n
[5].i
;
4538 GLfloat u1
= n
[2].f
;
4539 GLfloat u2
= n
[3].f
;
4540 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, ustride
, uorder
,
4541 (GLfloat
*) n
[6].data
);
4546 GLenum target
= n
[1].e
;
4547 GLfloat u1
= n
[2].f
;
4548 GLfloat u2
= n
[3].f
;
4549 GLfloat v1
= n
[4].f
;
4550 GLfloat v2
= n
[5].f
;
4551 GLint ustride
= n
[6].i
;
4552 GLint vstride
= n
[7].i
;
4553 GLint uorder
= n
[8].i
;
4554 GLint vorder
= n
[9].i
;
4555 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
4556 v1
, v2
, vstride
, vorder
,
4557 (GLfloat
*) n
[10].data
);
4560 case OPCODE_MAPGRID1
:
4561 (*ctx
->Exec
->MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
4563 case OPCODE_MAPGRID2
:
4564 (*ctx
->Exec
->MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
4566 case OPCODE_MATRIX_MODE
:
4567 (*ctx
->Exec
->MatrixMode
)( n
[1].e
);
4569 case OPCODE_MIN_MAX
:
4570 (*ctx
->Exec
->Minmax
)(n
[1].e
, n
[2].e
, n
[3].b
);
4572 case OPCODE_MULT_MATRIX
:
4573 if (sizeof(Node
)==sizeof(GLfloat
)) {
4574 (*ctx
->Exec
->MultMatrixf
)( &n
[1].f
);
4579 for (i
=0;i
<16;i
++) {
4582 (*ctx
->Exec
->MultMatrixf
)( m
);
4586 (*ctx
->Exec
->Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4588 case OPCODE_PASSTHROUGH
:
4589 (*ctx
->Exec
->PassThrough
)( n
[1].f
);
4591 case OPCODE_PIXEL_MAP
:
4592 (*ctx
->Exec
->PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
4594 case OPCODE_PIXEL_TRANSFER
:
4595 (*ctx
->Exec
->PixelTransferf
)( n
[1].e
, n
[2].f
);
4597 case OPCODE_PIXEL_ZOOM
:
4598 (*ctx
->Exec
->PixelZoom
)( n
[1].f
, n
[2].f
);
4600 case OPCODE_POINT_SIZE
:
4601 (*ctx
->Exec
->PointSize
)( n
[1].f
);
4603 case OPCODE_POINT_PARAMETERS
:
4609 (*ctx
->Exec
->PointParameterfvEXT
)( n
[1].e
, params
);
4612 case OPCODE_POLYGON_MODE
:
4613 (*ctx
->Exec
->PolygonMode
)( n
[1].e
, n
[2].e
);
4615 case OPCODE_POLYGON_STIPPLE
:
4616 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) n
[1].data
);
4618 case OPCODE_POLYGON_OFFSET
:
4619 (*ctx
->Exec
->PolygonOffset
)( n
[1].f
, n
[2].f
);
4621 case OPCODE_POP_ATTRIB
:
4622 (*ctx
->Exec
->PopAttrib
)();
4624 case OPCODE_POP_MATRIX
:
4625 (*ctx
->Exec
->PopMatrix
)();
4627 case OPCODE_POP_NAME
:
4628 (*ctx
->Exec
->PopName
)();
4630 case OPCODE_PRIORITIZE_TEXTURE
:
4631 (*ctx
->Exec
->PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
4633 case OPCODE_PUSH_ATTRIB
:
4634 (*ctx
->Exec
->PushAttrib
)( n
[1].bf
);
4636 case OPCODE_PUSH_MATRIX
:
4637 (*ctx
->Exec
->PushMatrix
)();
4639 case OPCODE_PUSH_NAME
:
4640 (*ctx
->Exec
->PushName
)( n
[1].ui
);
4642 case OPCODE_RASTER_POS
:
4643 (*ctx
->Exec
->RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4645 case OPCODE_READ_BUFFER
:
4646 (*ctx
->Exec
->ReadBuffer
)( n
[1].e
);
4648 case OPCODE_RESET_HISTOGRAM
:
4649 (*ctx
->Exec
->ResetHistogram
)( n
[1].e
);
4651 case OPCODE_RESET_MIN_MAX
:
4652 (*ctx
->Exec
->ResetMinmax
)( n
[1].e
);
4655 (*ctx
->Exec
->Rotatef
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4658 (*ctx
->Exec
->Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4660 case OPCODE_SCISSOR
:
4661 (*ctx
->Exec
->Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
4663 case OPCODE_SHADE_MODEL
:
4664 (*ctx
->Exec
->ShadeModel
)( n
[1].e
);
4666 case OPCODE_STENCIL_FUNC
:
4667 (*ctx
->Exec
->StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
4669 case OPCODE_STENCIL_MASK
:
4670 (*ctx
->Exec
->StencilMask
)( n
[1].ui
);
4672 case OPCODE_STENCIL_OP
:
4673 (*ctx
->Exec
->StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
4682 (*ctx
->Exec
->TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
4692 (*ctx
->Exec
->TexGenfv
)( n
[1].e
, n
[2].e
, params
);
4695 case OPCODE_TEXPARAMETER
:
4702 (*ctx
->Exec
->TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
4705 case OPCODE_TEX_IMAGE1D
:
4707 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4708 ctx
->Unpack
= _mesa_native_packing
;
4709 (*ctx
->Exec
->TexImage1D
)(
4710 n
[1].e
, /* target */
4712 n
[3].i
, /* components */
4714 n
[5].e
, /* border */
4715 n
[6].e
, /* format */
4718 ctx
->Unpack
= save
; /* restore */
4721 case OPCODE_TEX_IMAGE2D
:
4723 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4724 ctx
->Unpack
= _mesa_native_packing
;
4725 (*ctx
->Exec
->TexImage2D
)(
4726 n
[1].e
, /* target */
4728 n
[3].i
, /* components */
4730 n
[5].i
, /* height */
4731 n
[6].e
, /* border */
4732 n
[7].e
, /* format */
4735 ctx
->Unpack
= save
; /* restore */
4738 case OPCODE_TEX_IMAGE3D
:
4740 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4741 ctx
->Unpack
= _mesa_native_packing
;
4742 (*ctx
->Exec
->TexImage3D
)(
4743 n
[1].e
, /* target */
4745 n
[3].i
, /* components */
4747 n
[5].i
, /* height */
4749 n
[7].e
, /* border */
4750 n
[8].e
, /* format */
4753 ctx
->Unpack
= save
; /* restore */
4756 case OPCODE_TEX_SUB_IMAGE1D
:
4758 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4759 ctx
->Unpack
= _mesa_native_packing
;
4760 (*ctx
->Exec
->TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4762 n
[6].e
, n
[7].data
);
4763 ctx
->Unpack
= save
; /* restore */
4766 case OPCODE_TEX_SUB_IMAGE2D
:
4768 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4769 ctx
->Unpack
= _mesa_native_packing
;
4770 (*ctx
->Exec
->TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4772 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
4773 ctx
->Unpack
= save
; /* restore */
4776 case OPCODE_TEX_SUB_IMAGE3D
:
4778 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4779 ctx
->Unpack
= _mesa_native_packing
;
4780 (*ctx
->Exec
->TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4781 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
4782 n
[8].i
, n
[9].e
, n
[10].e
,
4784 ctx
->Unpack
= save
; /* restore */
4787 case OPCODE_TRANSLATE
:
4788 (*ctx
->Exec
->Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4790 case OPCODE_VIEWPORT
:
4791 (*ctx
->Exec
->Viewport
)(n
[1].i
, n
[2].i
,
4792 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
4794 case OPCODE_WINDOW_POS
:
4795 (*ctx
->Exec
->WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4797 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
4798 (*ctx
->Exec
->ActiveTextureARB
)( n
[1].e
);
4800 case OPCODE_PIXEL_TEXGEN_SGIX
: /* GL_SGIX_pixel_texture */
4801 (*ctx
->Exec
->PixelTexGenSGIX
)( n
[1].e
);
4803 case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
: /* GL_SGIS_pixel_texture */
4804 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( n
[1].e
, n
[2].i
);
4806 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
4807 (*ctx
->Exec
->CompressedTexImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4808 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].data
);
4810 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
4811 (*ctx
->Exec
->CompressedTexImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4812 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].data
);
4814 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
4815 (*ctx
->Exec
->CompressedTexImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4816 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].data
);
4818 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
4819 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4820 n
[4].i
, n
[5].e
, n
[6].i
, n
[7].data
);
4822 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
4823 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4824 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
, n
[9].data
);
4826 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
4827 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4828 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
4829 n
[9].e
, n
[10].i
, n
[11].data
);
4831 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
4832 (*ctx
->Exec
->SampleCoverageARB
)(n
[1].f
, n
[2].b
);
4834 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
4835 (*ctx
->Exec
->WindowPos3fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
);
4837 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
4838 (*ctx
->Exec
->BindProgramNV
)( n
[1].e
, n
[2].ui
);
4840 case OPCODE_EXECUTE_PROGRAM_NV
:
4847 (*ctx
->Exec
->ExecuteProgramNV
)(n
[1].e
, n
[2].ui
, v
);
4850 case OPCODE_REQUEST_PROGRAMS_RESIDENT_NV
:
4852 (*ctx->Exec->RequestResidentProgramsNV)();
4855 case OPCODE_LOAD_PROGRAM_NV
:
4857 (*ctx->Exec->LoadProgramNV)();
4860 case OPCODE_PROGRAM_PARAMETER4F_NV
:
4861 (*ctx
->Exec
->ProgramParameter4fNV
)(n
[1].e
, n
[2].ui
, n
[3].f
,
4862 n
[4].f
, n
[5].f
, n
[6].f
);
4864 case OPCODE_TRACK_MATRIX_NV
:
4865 (*ctx
->Exec
->TrackMatrixNV
)(n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
);
4868 case OPCODE_CONTINUE
:
4869 n
= (Node
*) n
[1].next
;
4871 case OPCODE_END_OF_LIST
:
4877 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
4878 _mesa_problem(ctx
, msg
);
4883 /* increment n to point to next compiled command */
4884 if (opcode
!=OPCODE_CONTINUE
) {
4885 n
+= InstSize
[opcode
];
4891 if (ctx
->Driver
.EndCallList
)
4892 ctx
->Driver
.EndCallList( ctx
);
4899 /**********************************************************************/
4901 /**********************************************************************/
4907 * Test if a display list number is valid.
4910 _mesa_IsList( GLuint list
)
4912 GET_CURRENT_CONTEXT(ctx
);
4913 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4914 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
4915 return islist(ctx
, list
);
4920 * Delete a sequence of consecutive display lists.
4923 _mesa_DeleteLists( GLuint list
, GLsizei range
)
4925 GET_CURRENT_CONTEXT(ctx
);
4927 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4928 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4931 _mesa_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
4934 for (i
=list
;i
<list
+range
;i
++) {
4935 _mesa_destroy_list( ctx
, i
);
4942 * Return a display list number, n, such that lists n through n+range-1
4946 _mesa_GenLists(GLsizei range
)
4948 GET_CURRENT_CONTEXT(ctx
);
4950 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4951 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
4954 _mesa_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
4962 * Make this an atomic operation
4964 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
4966 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
4968 /* reserve the list IDs by with empty/dummy lists */
4970 for (i
=0; i
<range
; i
++) {
4971 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
4975 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
4983 * Begin a new display list.
4986 _mesa_NewList( GLuint list
, GLenum mode
)
4988 GET_CURRENT_CONTEXT(ctx
);
4989 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
4990 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4992 if (MESA_VERBOSE
&VERBOSE_API
)
4993 _mesa_debug(ctx
, "glNewList %u %s\n", list
,
4994 _mesa_lookup_enum_by_nr(mode
));
4997 _mesa_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
5001 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
5002 _mesa_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
5006 if (ctx
->CurrentListPtr
) {
5007 /* already compiling a display list */
5008 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
5012 /* Allocate new display list */
5013 ctx
->CurrentListNum
= list
;
5014 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
5015 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
5016 ctx
->CurrentPos
= 0;
5017 ctx
->CompileFlag
= GL_TRUE
;
5018 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
5020 ctx
->Driver
.NewList( ctx
, list
, mode
);
5022 ctx
->CurrentDispatch
= ctx
->Save
;
5023 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5029 * End definition of current display list. Is the current
5030 * ASSERT_OUTSIDE_BEGIN_END strong enough to really guarentee that
5031 * we are outside begin/end calls?
5034 _mesa_EndList( void )
5036 GET_CURRENT_CONTEXT(ctx
);
5037 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
5038 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
5040 if (MESA_VERBOSE
&VERBOSE_API
)
5041 _mesa_debug(ctx
, "glEndList\n");
5043 /* Check that a list is under construction */
5044 if (!ctx
->CurrentListPtr
) {
5045 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
5049 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_END_OF_LIST
, 0 );
5051 /* Destroy old list, if any */
5052 _mesa_destroy_list(ctx
, ctx
->CurrentListNum
);
5053 /* Install the list */
5054 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
5057 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
5058 mesa_print_display_list(ctx
->CurrentListNum
);
5060 ctx
->CurrentListNum
= 0;
5061 ctx
->CurrentListPtr
= NULL
;
5062 ctx
->ExecuteFlag
= GL_TRUE
;
5063 ctx
->CompileFlag
= GL_FALSE
;
5065 ctx
->Driver
.EndList( ctx
);
5067 ctx
->CurrentDispatch
= ctx
->Exec
;
5068 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5074 _mesa_CallList( GLuint list
)
5076 GLboolean save_compile_flag
;
5077 GET_CURRENT_CONTEXT(ctx
);
5078 FLUSH_CURRENT(ctx
, 0);
5079 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
5080 /* execute the display list, and restore the CompileFlag. */
5083 if (MESA_VERBOSE
& VERBOSE_API
)
5084 _mesa_debug(ctx
, "_mesa_CallList %d\n", list
);
5086 /* mesa_print_display_list( list ); */
5088 save_compile_flag
= ctx
->CompileFlag
;
5089 if (save_compile_flag
) {
5090 ctx
->CompileFlag
= GL_FALSE
;
5093 execute_list( ctx
, list
);
5094 ctx
->CompileFlag
= save_compile_flag
;
5096 /* also restore API function pointers to point to "save" versions */
5097 if (save_compile_flag
) {
5098 ctx
->CurrentDispatch
= ctx
->Save
;
5099 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5106 * Execute glCallLists: call multiple display lists.
5109 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
5111 GET_CURRENT_CONTEXT(ctx
);
5114 GLboolean save_compile_flag
;
5116 if (MESA_VERBOSE
& VERBOSE_API
)
5117 _mesa_debug(ctx
, "_mesa_CallLists %d\n", n
);
5121 case GL_UNSIGNED_BYTE
:
5123 case GL_UNSIGNED_SHORT
:
5125 case GL_UNSIGNED_INT
:
5133 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5137 /* Save the CompileFlag status, turn it off, execute display list,
5138 * and restore the CompileFlag.
5140 save_compile_flag
= ctx
->CompileFlag
;
5141 ctx
->CompileFlag
= GL_FALSE
;
5144 list
= translate_id( i
, type
, lists
);
5145 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
5148 ctx
->CompileFlag
= save_compile_flag
;
5150 /* also restore API function pointers to point to "save" versions */
5151 if (save_compile_flag
) {
5152 ctx
->CurrentDispatch
= ctx
->Save
;
5153 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5160 * Set the offset added to list numbers in glCallLists.
5163 _mesa_ListBase( GLuint base
)
5165 GET_CURRENT_CONTEXT(ctx
);
5166 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
5167 ASSERT_OUTSIDE_BEGIN_END(ctx
);
5168 ctx
->List
.ListBase
= base
;
5172 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
5174 static void exec_Finish( void )
5176 GET_CURRENT_CONTEXT(ctx
);
5177 FLUSH_VERTICES(ctx
, 0);
5178 ctx
->Exec
->Finish();
5181 static void exec_Flush( void )
5183 GET_CURRENT_CONTEXT(ctx
);
5184 FLUSH_VERTICES(ctx
, 0);
5185 ctx
->Exec
->Flush( );
5188 static void exec_GetBooleanv( GLenum pname
, GLboolean
*params
)
5190 GET_CURRENT_CONTEXT(ctx
);
5191 FLUSH_VERTICES(ctx
, 0);
5192 ctx
->Exec
->GetBooleanv( pname
, params
);
5195 static void exec_GetClipPlane( GLenum plane
, GLdouble
*equation
)
5197 GET_CURRENT_CONTEXT(ctx
);
5198 FLUSH_VERTICES(ctx
, 0);
5199 ctx
->Exec
->GetClipPlane( plane
, equation
);
5202 static void exec_GetDoublev( GLenum pname
, GLdouble
*params
)
5204 GET_CURRENT_CONTEXT(ctx
);
5205 FLUSH_VERTICES(ctx
, 0);
5206 ctx
->Exec
->GetDoublev( pname
, params
);
5209 static GLenum
exec_GetError( void )
5211 GET_CURRENT_CONTEXT(ctx
);
5212 FLUSH_VERTICES(ctx
, 0);
5213 return ctx
->Exec
->GetError( );
5216 static void exec_GetFloatv( GLenum pname
, GLfloat
*params
)
5218 GET_CURRENT_CONTEXT(ctx
);
5219 FLUSH_VERTICES(ctx
, 0);
5220 ctx
->Exec
->GetFloatv( pname
, params
);
5223 static void exec_GetIntegerv( GLenum pname
, GLint
*params
)
5225 GET_CURRENT_CONTEXT(ctx
);
5226 FLUSH_VERTICES(ctx
, 0);
5227 ctx
->Exec
->GetIntegerv( pname
, params
);
5230 static void exec_GetLightfv( GLenum light
, GLenum pname
, GLfloat
*params
)
5232 GET_CURRENT_CONTEXT(ctx
);
5233 FLUSH_VERTICES(ctx
, 0);
5234 ctx
->Exec
->GetLightfv( light
, pname
, params
);
5237 static void exec_GetLightiv( GLenum light
, GLenum pname
, GLint
*params
)
5239 GET_CURRENT_CONTEXT(ctx
);
5240 FLUSH_VERTICES(ctx
, 0);
5241 ctx
->Exec
->GetLightiv( light
, pname
, params
);
5244 static void exec_GetMapdv( GLenum target
, GLenum query
, GLdouble
*v
)
5246 GET_CURRENT_CONTEXT(ctx
);
5247 FLUSH_VERTICES(ctx
, 0);
5248 ctx
->Exec
->GetMapdv( target
, query
, v
);
5251 static void exec_GetMapfv( GLenum target
, GLenum query
, GLfloat
*v
)
5253 GET_CURRENT_CONTEXT(ctx
);
5254 FLUSH_VERTICES(ctx
, 0);
5255 ctx
->Exec
->GetMapfv( target
, query
, v
);
5258 static void exec_GetMapiv( GLenum target
, GLenum query
, GLint
*v
)
5260 GET_CURRENT_CONTEXT(ctx
);
5261 FLUSH_VERTICES(ctx
, 0);
5262 ctx
->Exec
->GetMapiv( target
, query
, v
);
5265 static void exec_GetMaterialfv( GLenum face
, GLenum pname
, GLfloat
*params
)
5267 GET_CURRENT_CONTEXT(ctx
);
5268 FLUSH_VERTICES(ctx
, 0);
5269 ctx
->Exec
->GetMaterialfv( face
, pname
, params
);
5272 static void exec_GetMaterialiv( GLenum face
, GLenum pname
, GLint
*params
)
5274 GET_CURRENT_CONTEXT(ctx
);
5275 FLUSH_VERTICES(ctx
, 0);
5276 ctx
->Exec
->GetMaterialiv( face
, pname
, params
);
5279 static void exec_GetPixelMapfv( GLenum map
, GLfloat
*values
)
5281 GET_CURRENT_CONTEXT(ctx
);
5282 FLUSH_VERTICES(ctx
, 0);
5283 ctx
->Exec
->GetPixelMapfv( map
, values
);
5286 static void exec_GetPixelMapuiv( GLenum map
, GLuint
*values
)
5288 GET_CURRENT_CONTEXT(ctx
);
5289 FLUSH_VERTICES(ctx
, 0);
5290 ctx
->Exec
->GetPixelMapuiv( map
, values
);
5293 static void exec_GetPixelMapusv( GLenum map
, GLushort
*values
)
5295 GET_CURRENT_CONTEXT(ctx
);
5296 FLUSH_VERTICES(ctx
, 0);
5297 ctx
->Exec
->GetPixelMapusv( map
, values
);
5300 static void exec_GetPolygonStipple( GLubyte
*dest
)
5302 GET_CURRENT_CONTEXT(ctx
);
5303 FLUSH_VERTICES(ctx
, 0);
5304 ctx
->Exec
->GetPolygonStipple( dest
);
5307 static const GLubyte
*exec_GetString( GLenum name
)
5309 GET_CURRENT_CONTEXT(ctx
);
5310 FLUSH_VERTICES(ctx
, 0);
5311 return ctx
->Exec
->GetString( name
);
5314 static void exec_GetTexEnvfv( GLenum target
, GLenum pname
, GLfloat
*params
)
5316 GET_CURRENT_CONTEXT(ctx
);
5317 FLUSH_VERTICES(ctx
, 0);
5318 ctx
->Exec
->GetTexEnvfv( target
, pname
, params
);
5321 static void exec_GetTexEnviv( GLenum target
, GLenum pname
, GLint
*params
)
5323 GET_CURRENT_CONTEXT(ctx
);
5324 FLUSH_VERTICES(ctx
, 0);
5325 ctx
->Exec
->GetTexEnviv( target
, pname
, params
);
5328 static void exec_GetTexGendv( GLenum coord
, GLenum pname
, GLdouble
*params
)
5330 GET_CURRENT_CONTEXT(ctx
);
5331 FLUSH_VERTICES(ctx
, 0);
5332 ctx
->Exec
->GetTexGendv( coord
, pname
, params
);
5335 static void exec_GetTexGenfv( GLenum coord
, GLenum pname
, GLfloat
*params
)
5337 GET_CURRENT_CONTEXT(ctx
);
5338 FLUSH_VERTICES(ctx
, 0);
5339 ctx
->Exec
->GetTexGenfv( coord
, pname
, params
);
5342 static void exec_GetTexGeniv( GLenum coord
, GLenum pname
, GLint
*params
)
5344 GET_CURRENT_CONTEXT(ctx
);
5345 FLUSH_VERTICES(ctx
, 0);
5346 ctx
->Exec
->GetTexGeniv( coord
, pname
, params
);
5349 static void exec_GetTexImage( GLenum target
, GLint level
, GLenum format
,
5350 GLenum type
, GLvoid
*pixels
)
5352 GET_CURRENT_CONTEXT(ctx
);
5353 FLUSH_VERTICES(ctx
, 0);
5354 ctx
->Exec
->GetTexImage( target
, level
, format
, type
, pixels
);
5357 static void exec_GetTexLevelParameterfv( GLenum target
, GLint level
,
5358 GLenum pname
, GLfloat
*params
)
5360 GET_CURRENT_CONTEXT(ctx
);
5361 FLUSH_VERTICES(ctx
, 0);
5362 ctx
->Exec
->GetTexLevelParameterfv( target
, level
, pname
, params
);
5365 static void exec_GetTexLevelParameteriv( GLenum target
, GLint level
,
5366 GLenum pname
, GLint
*params
)
5368 GET_CURRENT_CONTEXT(ctx
);
5369 FLUSH_VERTICES(ctx
, 0);
5370 ctx
->Exec
->GetTexLevelParameteriv( target
, level
, pname
, params
);
5373 static void exec_GetTexParameterfv( GLenum target
, GLenum pname
,
5376 GET_CURRENT_CONTEXT(ctx
);
5377 FLUSH_VERTICES(ctx
, 0);
5378 ctx
->Exec
->GetTexParameterfv( target
, pname
, params
);
5381 static void exec_GetTexParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
5383 GET_CURRENT_CONTEXT(ctx
);
5384 FLUSH_VERTICES(ctx
, 0);
5385 ctx
->Exec
->GetTexParameteriv( target
, pname
, params
);
5388 static GLboolean
exec_IsEnabled( GLenum cap
)
5390 GET_CURRENT_CONTEXT(ctx
);
5391 FLUSH_VERTICES(ctx
, 0);
5392 return ctx
->Exec
->IsEnabled( cap
);
5395 static void exec_PixelStoref( GLenum pname
, GLfloat param
)
5397 GET_CURRENT_CONTEXT(ctx
);
5398 FLUSH_VERTICES(ctx
, 0);
5399 ctx
->Exec
->PixelStoref( pname
, param
);
5402 static void exec_PixelStorei( GLenum pname
, GLint param
)
5404 GET_CURRENT_CONTEXT(ctx
);
5405 FLUSH_VERTICES(ctx
, 0);
5406 ctx
->Exec
->PixelStorei( pname
, param
);
5409 static void exec_ReadPixels( GLint x
, GLint y
, GLsizei width
, GLsizei height
,
5410 GLenum format
, GLenum type
, GLvoid
*pixels
)
5412 GET_CURRENT_CONTEXT(ctx
);
5413 FLUSH_VERTICES(ctx
, 0);
5414 ctx
->Exec
->ReadPixels( x
, y
, width
, height
, format
, type
, pixels
);
5417 static GLint
exec_RenderMode( GLenum mode
)
5419 GET_CURRENT_CONTEXT(ctx
);
5420 FLUSH_VERTICES(ctx
, 0);
5421 return ctx
->Exec
->RenderMode( mode
);
5424 static void exec_FeedbackBuffer( GLsizei size
, GLenum type
, GLfloat
*buffer
)
5426 GET_CURRENT_CONTEXT(ctx
);
5427 FLUSH_VERTICES(ctx
, 0);
5428 ctx
->Exec
->FeedbackBuffer( size
, type
, buffer
);
5431 static void exec_SelectBuffer( GLsizei size
, GLuint
*buffer
)
5433 GET_CURRENT_CONTEXT(ctx
);
5434 FLUSH_VERTICES(ctx
, 0);
5435 ctx
->Exec
->SelectBuffer( size
, buffer
);
5438 static GLboolean
exec_AreTexturesResident(GLsizei n
, const GLuint
*texName
,
5439 GLboolean
*residences
)
5441 GET_CURRENT_CONTEXT(ctx
);
5442 FLUSH_VERTICES(ctx
, 0);
5443 return ctx
->Exec
->AreTexturesResident( n
, texName
, residences
);
5446 static void exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
,
5449 GET_CURRENT_CONTEXT(ctx
);
5450 FLUSH_VERTICES(ctx
, 0);
5451 ctx
->Exec
->ColorPointer( size
, type
, stride
, ptr
);
5454 static void exec_DeleteTextures( GLsizei n
, const GLuint
*texName
)
5456 GET_CURRENT_CONTEXT(ctx
);
5457 FLUSH_VERTICES(ctx
, 0);
5458 ctx
->Exec
->DeleteTextures( n
, texName
);
5461 static void exec_DisableClientState( GLenum cap
)
5463 GET_CURRENT_CONTEXT(ctx
);
5464 FLUSH_VERTICES(ctx
, 0);
5465 ctx
->Exec
->DisableClientState( cap
);
5468 static void exec_EdgeFlagPointer(GLsizei stride
, const void *vptr
)
5470 GET_CURRENT_CONTEXT(ctx
);
5471 FLUSH_VERTICES(ctx
, 0);
5472 ctx
->Exec
->EdgeFlagPointer( stride
, vptr
);
5475 static void exec_EnableClientState( GLenum cap
)
5477 GET_CURRENT_CONTEXT(ctx
);
5478 FLUSH_VERTICES(ctx
, 0);
5479 ctx
->Exec
->EnableClientState( cap
);
5482 static void exec_GenTextures( GLsizei n
, GLuint
*texName
)
5484 GET_CURRENT_CONTEXT(ctx
);
5485 FLUSH_VERTICES(ctx
, 0);
5486 ctx
->Exec
->GenTextures( n
, texName
);
5489 static void exec_GetPointerv( GLenum pname
, GLvoid
**params
)
5491 GET_CURRENT_CONTEXT(ctx
);
5492 FLUSH_VERTICES(ctx
, 0);
5493 ctx
->Exec
->GetPointerv( pname
, params
);
5496 static void exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5498 GET_CURRENT_CONTEXT(ctx
);
5499 FLUSH_VERTICES(ctx
, 0);
5500 ctx
->Exec
->IndexPointer( type
, stride
, ptr
);
5503 static void exec_InterleavedArrays(GLenum format
, GLsizei stride
,
5504 const GLvoid
*pointer
)
5506 GET_CURRENT_CONTEXT(ctx
);
5507 FLUSH_VERTICES(ctx
, 0);
5508 ctx
->Exec
->InterleavedArrays( format
, stride
, pointer
);
5511 static GLboolean
exec_IsTexture( GLuint texture
)
5513 GET_CURRENT_CONTEXT(ctx
);
5514 FLUSH_VERTICES(ctx
, 0);
5515 return ctx
->Exec
->IsTexture( texture
);
5518 static void exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5520 GET_CURRENT_CONTEXT(ctx
);
5521 FLUSH_VERTICES(ctx
, 0);
5522 ctx
->Exec
->NormalPointer( type
, stride
, ptr
);
5525 static void exec_PopClientAttrib(void)
5527 GET_CURRENT_CONTEXT(ctx
);
5528 FLUSH_VERTICES(ctx
, 0);
5529 ctx
->Exec
->PopClientAttrib();
5532 static void exec_PushClientAttrib(GLbitfield mask
)
5534 GET_CURRENT_CONTEXT(ctx
);
5535 FLUSH_VERTICES(ctx
, 0);
5536 ctx
->Exec
->PushClientAttrib( mask
);
5539 static void exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
5542 GET_CURRENT_CONTEXT(ctx
);
5543 FLUSH_VERTICES(ctx
, 0);
5544 ctx
->Exec
->TexCoordPointer( size
, type
, stride
, ptr
);
5547 static void exec_GetCompressedTexImageARB(GLenum target
, GLint level
,
5550 GET_CURRENT_CONTEXT(ctx
);
5551 FLUSH_VERTICES(ctx
, 0);
5552 ctx
->Exec
->GetCompressedTexImageARB( target
, level
, img
);
5555 static void exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
5558 GET_CURRENT_CONTEXT(ctx
);
5559 FLUSH_VERTICES(ctx
, 0);
5560 ctx
->Exec
->VertexPointer( size
, type
, stride
, ptr
);
5563 static void exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
5564 GLint x
, GLint y
, GLsizei width
)
5566 GET_CURRENT_CONTEXT(ctx
);
5567 FLUSH_VERTICES(ctx
, 0);
5568 ctx
->Exec
->CopyConvolutionFilter1D( target
, internalFormat
, x
, y
, width
);
5571 static void exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
5572 GLint x
, GLint y
, GLsizei width
,
5575 GET_CURRENT_CONTEXT(ctx
);
5576 FLUSH_VERTICES(ctx
, 0);
5577 ctx
->Exec
->CopyConvolutionFilter2D( target
, internalFormat
, x
, y
, width
,
5581 static void exec_GetColorTable( GLenum target
, GLenum format
,
5582 GLenum type
, GLvoid
*data
)
5584 GET_CURRENT_CONTEXT(ctx
);
5585 FLUSH_VERTICES(ctx
, 0);
5586 ctx
->Exec
->GetColorTable( target
, format
, type
, data
);
5589 static void exec_GetColorTableParameterfv( GLenum target
, GLenum pname
,
5592 GET_CURRENT_CONTEXT(ctx
);
5593 FLUSH_VERTICES(ctx
, 0);
5594 ctx
->Exec
->GetColorTableParameterfv( target
, pname
, params
);
5597 static void exec_GetColorTableParameteriv( GLenum target
, GLenum pname
,
5600 GET_CURRENT_CONTEXT(ctx
);
5601 FLUSH_VERTICES(ctx
, 0);
5602 ctx
->Exec
->GetColorTableParameteriv( target
, pname
, params
);
5605 static void exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
5608 GET_CURRENT_CONTEXT(ctx
);
5609 FLUSH_VERTICES(ctx
, 0);
5610 ctx
->Exec
->GetConvolutionFilter( target
, format
, type
, image
);
5613 static void exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
,
5616 GET_CURRENT_CONTEXT(ctx
);
5617 FLUSH_VERTICES(ctx
, 0);
5618 ctx
->Exec
->GetConvolutionParameterfv( target
, pname
, params
);
5621 static void exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
,
5624 GET_CURRENT_CONTEXT(ctx
);
5625 FLUSH_VERTICES(ctx
, 0);
5626 ctx
->Exec
->GetConvolutionParameteriv( target
, pname
, params
);
5629 static void exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
5630 GLenum type
, GLvoid
*values
)
5632 GET_CURRENT_CONTEXT(ctx
);
5633 FLUSH_VERTICES(ctx
, 0);
5634 ctx
->Exec
->GetHistogram( target
, reset
, format
, type
, values
);
5637 static void exec_GetHistogramParameterfv(GLenum target
, GLenum pname
,
5640 GET_CURRENT_CONTEXT(ctx
);
5641 FLUSH_VERTICES(ctx
, 0);
5642 ctx
->Exec
->GetHistogramParameterfv( target
, pname
, params
);
5645 static void exec_GetHistogramParameteriv(GLenum target
, GLenum pname
,
5648 GET_CURRENT_CONTEXT(ctx
);
5649 FLUSH_VERTICES(ctx
, 0);
5650 ctx
->Exec
->GetHistogramParameteriv( target
, pname
, params
);
5653 static void exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
5654 GLenum type
, GLvoid
*values
)
5656 GET_CURRENT_CONTEXT(ctx
);
5657 FLUSH_VERTICES(ctx
, 0);
5658 ctx
->Exec
->GetMinmax( target
, reset
, format
, type
, values
);
5661 static void exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
,
5664 GET_CURRENT_CONTEXT(ctx
);
5665 FLUSH_VERTICES(ctx
, 0);
5666 ctx
->Exec
->GetMinmaxParameterfv( target
, pname
, params
);
5669 static void exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
,
5672 GET_CURRENT_CONTEXT(ctx
);
5673 FLUSH_VERTICES(ctx
, 0);
5674 ctx
->Exec
->GetMinmaxParameteriv( target
, pname
, params
);
5677 static void exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
5678 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
5680 GET_CURRENT_CONTEXT(ctx
);
5681 FLUSH_VERTICES(ctx
, 0);
5682 ctx
->Exec
->GetSeparableFilter( target
, format
, type
, row
, column
, span
);
5685 static void exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
5686 GLsizei width
, GLsizei height
, GLenum format
,
5687 GLenum type
, const GLvoid
*row
,
5688 const GLvoid
*column
)
5690 GET_CURRENT_CONTEXT(ctx
);
5691 FLUSH_VERTICES(ctx
, 0);
5692 ctx
->Exec
->SeparableFilter2D( target
, internalFormat
, width
, height
, format
,
5696 static void exec_GetPixelTexGenParameterivSGIS(GLenum target
, GLint
*value
)
5698 GET_CURRENT_CONTEXT(ctx
);
5699 FLUSH_VERTICES(ctx
, 0);
5700 ctx
->Exec
->GetPixelTexGenParameterivSGIS( target
, value
);
5703 static void exec_GetPixelTexGenParameterfvSGIS(GLenum target
, GLfloat
*value
)
5705 GET_CURRENT_CONTEXT(ctx
);
5706 FLUSH_VERTICES(ctx
, 0);
5707 ctx
->Exec
->GetPixelTexGenParameterfvSGIS( target
, value
);
5710 static void exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5711 GLsizei count
, const GLvoid
*ptr
)
5713 GET_CURRENT_CONTEXT(ctx
);
5714 FLUSH_VERTICES(ctx
, 0);
5715 ctx
->Exec
->ColorPointerEXT( size
, type
, stride
, count
, ptr
);
5718 static void exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
,
5719 const GLboolean
*ptr
)
5721 GET_CURRENT_CONTEXT(ctx
);
5722 FLUSH_VERTICES(ctx
, 0);
5723 ctx
->Exec
->EdgeFlagPointerEXT( stride
, count
, ptr
);
5726 static void exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
5729 GET_CURRENT_CONTEXT(ctx
);
5730 FLUSH_VERTICES(ctx
, 0);
5731 ctx
->Exec
->IndexPointerEXT( type
, stride
, count
, ptr
);
5734 static void exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
5737 GET_CURRENT_CONTEXT(ctx
);
5738 FLUSH_VERTICES(ctx
, 0);
5739 ctx
->Exec
->NormalPointerEXT( type
, stride
, count
, ptr
);
5742 static void exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5743 GLsizei count
, const GLvoid
*ptr
)
5745 GET_CURRENT_CONTEXT(ctx
);
5746 FLUSH_VERTICES(ctx
, 0);
5747 ctx
->Exec
->TexCoordPointerEXT( size
, type
, stride
, count
, ptr
);
5750 static void exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5751 GLsizei count
, const GLvoid
*ptr
)
5753 GET_CURRENT_CONTEXT(ctx
);
5754 FLUSH_VERTICES(ctx
, 0);
5755 ctx
->Exec
->VertexPointerEXT( size
, type
, stride
, count
, ptr
);
5758 static void exec_LockArraysEXT(GLint first
, GLsizei count
)
5760 GET_CURRENT_CONTEXT(ctx
);
5761 FLUSH_VERTICES(ctx
, 0);
5762 ctx
->Exec
->LockArraysEXT( first
, count
);
5765 static void exec_UnlockArraysEXT( void )
5767 GET_CURRENT_CONTEXT(ctx
);
5768 FLUSH_VERTICES(ctx
, 0);
5769 ctx
->Exec
->UnlockArraysEXT( );
5772 static void exec_ResizeBuffersMESA( void )
5774 GET_CURRENT_CONTEXT(ctx
);
5775 FLUSH_VERTICES(ctx
, 0);
5776 ctx
->Exec
->ResizeBuffersMESA( );
5780 static void exec_ClientActiveTextureARB( GLenum target
)
5782 GET_CURRENT_CONTEXT(ctx
);
5783 FLUSH_VERTICES(ctx
, 0);
5784 ctx
->Exec
->ClientActiveTextureARB(target
);
5787 static void exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
5788 GLsizei stride
, const GLvoid
*ptr
)
5790 GET_CURRENT_CONTEXT(ctx
);
5791 FLUSH_VERTICES(ctx
, 0);
5792 ctx
->Exec
->SecondaryColorPointerEXT( size
, type
, stride
, ptr
);
5795 static void exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
,
5798 GET_CURRENT_CONTEXT(ctx
);
5799 FLUSH_VERTICES(ctx
, 0);
5800 ctx
->Exec
->FogCoordPointerEXT( type
, stride
, ptr
);
5803 /* GL_EXT_multi_draw_arrays */
5804 static void exec_MultiDrawArraysEXT(GLenum mode
, GLint
*first
,
5805 GLsizei
*count
, GLsizei primcount
)
5807 GET_CURRENT_CONTEXT(ctx
);
5808 FLUSH_VERTICES(ctx
, 0);
5809 ctx
->Exec
->MultiDrawArraysEXT( mode
, first
, count
, primcount
);
5812 /* GL_EXT_multi_draw_arrays */
5813 static void exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
*count
,
5814 GLenum type
, const GLvoid
**indices
,
5817 GET_CURRENT_CONTEXT(ctx
);
5818 FLUSH_VERTICES(ctx
, 0);
5819 ctx
->Exec
->MultiDrawElementsEXT(mode
, count
, type
, indices
, primcount
);
5825 * Assign all the pointers in <table> to point to Mesa's display list
5826 * building functions.
5828 * This does not include any of the tnl functions - they are
5829 * initialized from _mesa_init_api_defaults and from the active vtxfmt
5833 _mesa_init_dlist_table( struct _glapi_table
*table
, GLuint tableSize
)
5835 _mesa_init_no_op_table(table
, tableSize
);
5837 _mesa_loopback_init_api_table( table
, GL_TRUE
);
5840 table
->Accum
= save_Accum
;
5841 table
->AlphaFunc
= save_AlphaFunc
;
5842 table
->Bitmap
= save_Bitmap
;
5843 table
->BlendFunc
= save_BlendFunc
;
5844 table
->CallList
= _mesa_save_CallList
;
5845 table
->CallLists
= _mesa_save_CallLists
;
5846 table
->Clear
= save_Clear
;
5847 table
->ClearAccum
= save_ClearAccum
;
5848 table
->ClearColor
= save_ClearColor
;
5849 table
->ClearDepth
= save_ClearDepth
;
5850 table
->ClearIndex
= save_ClearIndex
;
5851 table
->ClearStencil
= save_ClearStencil
;
5852 table
->ClipPlane
= save_ClipPlane
;
5853 table
->ColorMask
= save_ColorMask
;
5854 table
->ColorMaterial
= save_ColorMaterial
;
5855 table
->CopyPixels
= save_CopyPixels
;
5856 table
->CullFace
= save_CullFace
;
5857 table
->DeleteLists
= _mesa_DeleteLists
;
5858 table
->DepthFunc
= save_DepthFunc
;
5859 table
->DepthMask
= save_DepthMask
;
5860 table
->DepthRange
= save_DepthRange
;
5861 table
->Disable
= save_Disable
;
5862 table
->DrawBuffer
= save_DrawBuffer
;
5863 table
->DrawPixels
= save_DrawPixels
;
5864 table
->Enable
= save_Enable
;
5865 table
->EndList
= _mesa_EndList
;
5866 table
->EvalMesh1
= _mesa_save_EvalMesh1
;
5867 table
->EvalMesh2
= _mesa_save_EvalMesh2
;
5868 table
->Finish
= exec_Finish
;
5869 table
->Flush
= exec_Flush
;
5870 table
->Fogf
= save_Fogf
;
5871 table
->Fogfv
= save_Fogfv
;
5872 table
->Fogi
= save_Fogi
;
5873 table
->Fogiv
= save_Fogiv
;
5874 table
->FrontFace
= save_FrontFace
;
5875 table
->Frustum
= save_Frustum
;
5876 table
->GenLists
= _mesa_GenLists
;
5877 table
->GetBooleanv
= exec_GetBooleanv
;
5878 table
->GetClipPlane
= exec_GetClipPlane
;
5879 table
->GetDoublev
= exec_GetDoublev
;
5880 table
->GetError
= exec_GetError
;
5881 table
->GetFloatv
= exec_GetFloatv
;
5882 table
->GetIntegerv
= exec_GetIntegerv
;
5883 table
->GetLightfv
= exec_GetLightfv
;
5884 table
->GetLightiv
= exec_GetLightiv
;
5885 table
->GetMapdv
= exec_GetMapdv
;
5886 table
->GetMapfv
= exec_GetMapfv
;
5887 table
->GetMapiv
= exec_GetMapiv
;
5888 table
->GetMaterialfv
= exec_GetMaterialfv
;
5889 table
->GetMaterialiv
= exec_GetMaterialiv
;
5890 table
->GetPixelMapfv
= exec_GetPixelMapfv
;
5891 table
->GetPixelMapuiv
= exec_GetPixelMapuiv
;
5892 table
->GetPixelMapusv
= exec_GetPixelMapusv
;
5893 table
->GetPolygonStipple
= exec_GetPolygonStipple
;
5894 table
->GetString
= exec_GetString
;
5895 table
->GetTexEnvfv
= exec_GetTexEnvfv
;
5896 table
->GetTexEnviv
= exec_GetTexEnviv
;
5897 table
->GetTexGendv
= exec_GetTexGendv
;
5898 table
->GetTexGenfv
= exec_GetTexGenfv
;
5899 table
->GetTexGeniv
= exec_GetTexGeniv
;
5900 table
->GetTexImage
= exec_GetTexImage
;
5901 table
->GetTexLevelParameterfv
= exec_GetTexLevelParameterfv
;
5902 table
->GetTexLevelParameteriv
= exec_GetTexLevelParameteriv
;
5903 table
->GetTexParameterfv
= exec_GetTexParameterfv
;
5904 table
->GetTexParameteriv
= exec_GetTexParameteriv
;
5905 table
->Hint
= save_Hint
;
5906 table
->IndexMask
= save_IndexMask
;
5907 table
->InitNames
= save_InitNames
;
5908 table
->IsEnabled
= exec_IsEnabled
;
5909 table
->IsList
= _mesa_IsList
;
5910 table
->LightModelf
= save_LightModelf
;
5911 table
->LightModelfv
= save_LightModelfv
;
5912 table
->LightModeli
= save_LightModeli
;
5913 table
->LightModeliv
= save_LightModeliv
;
5914 table
->Lightf
= save_Lightf
;
5915 table
->Lightfv
= save_Lightfv
;
5916 table
->Lighti
= save_Lighti
;
5917 table
->Lightiv
= save_Lightiv
;
5918 table
->LineStipple
= save_LineStipple
;
5919 table
->LineWidth
= save_LineWidth
;
5920 table
->ListBase
= save_ListBase
;
5921 table
->LoadIdentity
= save_LoadIdentity
;
5922 table
->LoadMatrixd
= save_LoadMatrixd
;
5923 table
->LoadMatrixf
= save_LoadMatrixf
;
5924 table
->LoadName
= save_LoadName
;
5925 table
->LogicOp
= save_LogicOp
;
5926 table
->Map1d
= save_Map1d
;
5927 table
->Map1f
= save_Map1f
;
5928 table
->Map2d
= save_Map2d
;
5929 table
->Map2f
= save_Map2f
;
5930 table
->MapGrid1d
= save_MapGrid1d
;
5931 table
->MapGrid1f
= save_MapGrid1f
;
5932 table
->MapGrid2d
= save_MapGrid2d
;
5933 table
->MapGrid2f
= save_MapGrid2f
;
5934 table
->MatrixMode
= save_MatrixMode
;
5935 table
->MultMatrixd
= save_MultMatrixd
;
5936 table
->MultMatrixf
= save_MultMatrixf
;
5937 table
->NewList
= save_NewList
;
5938 table
->Ortho
= save_Ortho
;
5939 table
->PassThrough
= save_PassThrough
;
5940 table
->PixelMapfv
= save_PixelMapfv
;
5941 table
->PixelMapuiv
= save_PixelMapuiv
;
5942 table
->PixelMapusv
= save_PixelMapusv
;
5943 table
->PixelStoref
= exec_PixelStoref
;
5944 table
->PixelStorei
= exec_PixelStorei
;
5945 table
->PixelTransferf
= save_PixelTransferf
;
5946 table
->PixelTransferi
= save_PixelTransferi
;
5947 table
->PixelZoom
= save_PixelZoom
;
5948 table
->PointSize
= save_PointSize
;
5949 table
->PolygonMode
= save_PolygonMode
;
5950 table
->PolygonOffset
= save_PolygonOffset
;
5951 table
->PolygonStipple
= save_PolygonStipple
;
5952 table
->PopAttrib
= save_PopAttrib
;
5953 table
->PopMatrix
= save_PopMatrix
;
5954 table
->PopName
= save_PopName
;
5955 table
->PushAttrib
= save_PushAttrib
;
5956 table
->PushMatrix
= save_PushMatrix
;
5957 table
->PushName
= save_PushName
;
5958 table
->RasterPos2d
= save_RasterPos2d
;
5959 table
->RasterPos2dv
= save_RasterPos2dv
;
5960 table
->RasterPos2f
= save_RasterPos2f
;
5961 table
->RasterPos2fv
= save_RasterPos2fv
;
5962 table
->RasterPos2i
= save_RasterPos2i
;
5963 table
->RasterPos2iv
= save_RasterPos2iv
;
5964 table
->RasterPos2s
= save_RasterPos2s
;
5965 table
->RasterPos2sv
= save_RasterPos2sv
;
5966 table
->RasterPos3d
= save_RasterPos3d
;
5967 table
->RasterPos3dv
= save_RasterPos3dv
;
5968 table
->RasterPos3f
= save_RasterPos3f
;
5969 table
->RasterPos3fv
= save_RasterPos3fv
;
5970 table
->RasterPos3i
= save_RasterPos3i
;
5971 table
->RasterPos3iv
= save_RasterPos3iv
;
5972 table
->RasterPos3s
= save_RasterPos3s
;
5973 table
->RasterPos3sv
= save_RasterPos3sv
;
5974 table
->RasterPos4d
= save_RasterPos4d
;
5975 table
->RasterPos4dv
= save_RasterPos4dv
;
5976 table
->RasterPos4f
= save_RasterPos4f
;
5977 table
->RasterPos4fv
= save_RasterPos4fv
;
5978 table
->RasterPos4i
= save_RasterPos4i
;
5979 table
->RasterPos4iv
= save_RasterPos4iv
;
5980 table
->RasterPos4s
= save_RasterPos4s
;
5981 table
->RasterPos4sv
= save_RasterPos4sv
;
5982 table
->ReadBuffer
= save_ReadBuffer
;
5983 table
->ReadPixels
= exec_ReadPixels
;
5984 table
->RenderMode
= exec_RenderMode
;
5985 table
->Rotated
= save_Rotated
;
5986 table
->Rotatef
= save_Rotatef
;
5987 table
->Scaled
= save_Scaled
;
5988 table
->Scalef
= save_Scalef
;
5989 table
->Scissor
= save_Scissor
;
5990 table
->FeedbackBuffer
= exec_FeedbackBuffer
;
5991 table
->SelectBuffer
= exec_SelectBuffer
;
5992 table
->ShadeModel
= save_ShadeModel
;
5993 table
->StencilFunc
= save_StencilFunc
;
5994 table
->StencilMask
= save_StencilMask
;
5995 table
->StencilOp
= save_StencilOp
;
5996 table
->TexEnvf
= save_TexEnvf
;
5997 table
->TexEnvfv
= save_TexEnvfv
;
5998 table
->TexEnvi
= save_TexEnvi
;
5999 table
->TexEnviv
= save_TexEnviv
;
6000 table
->TexGend
= save_TexGend
;
6001 table
->TexGendv
= save_TexGendv
;
6002 table
->TexGenf
= save_TexGenf
;
6003 table
->TexGenfv
= save_TexGenfv
;
6004 table
->TexGeni
= save_TexGeni
;
6005 table
->TexGeniv
= save_TexGeniv
;
6006 table
->TexImage1D
= save_TexImage1D
;
6007 table
->TexImage2D
= save_TexImage2D
;
6008 table
->TexParameterf
= save_TexParameterf
;
6009 table
->TexParameterfv
= save_TexParameterfv
;
6010 table
->TexParameteri
= save_TexParameteri
;
6011 table
->TexParameteriv
= save_TexParameteriv
;
6012 table
->Translated
= save_Translated
;
6013 table
->Translatef
= save_Translatef
;
6014 table
->Viewport
= save_Viewport
;
6017 table
->AreTexturesResident
= exec_AreTexturesResident
;
6018 table
->BindTexture
= save_BindTexture
;
6019 table
->ColorPointer
= exec_ColorPointer
;
6020 table
->CopyTexImage1D
= save_CopyTexImage1D
;
6021 table
->CopyTexImage2D
= save_CopyTexImage2D
;
6022 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
6023 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
6024 table
->DeleteTextures
= exec_DeleteTextures
;
6025 table
->DisableClientState
= exec_DisableClientState
;
6026 table
->EdgeFlagPointer
= exec_EdgeFlagPointer
;
6027 table
->EnableClientState
= exec_EnableClientState
;
6028 table
->GenTextures
= exec_GenTextures
;
6029 table
->GetPointerv
= exec_GetPointerv
;
6030 table
->IndexPointer
= exec_IndexPointer
;
6031 table
->InterleavedArrays
= exec_InterleavedArrays
;
6032 table
->IsTexture
= exec_IsTexture
;
6033 table
->NormalPointer
= exec_NormalPointer
;
6034 table
->PopClientAttrib
= exec_PopClientAttrib
;
6035 table
->PrioritizeTextures
= save_PrioritizeTextures
;
6036 table
->PushClientAttrib
= exec_PushClientAttrib
;
6037 table
->TexCoordPointer
= exec_TexCoordPointer
;
6038 table
->TexSubImage1D
= save_TexSubImage1D
;
6039 table
->TexSubImage2D
= save_TexSubImage2D
;
6040 table
->VertexPointer
= exec_VertexPointer
;
6043 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
6044 table
->TexImage3D
= save_TexImage3D
;
6045 table
->TexSubImage3D
= save_TexSubImage3D
;
6047 /* GL_ARB_imaging */
6048 /* Not all are supported */
6049 table
->BlendColor
= save_BlendColor
;
6050 table
->BlendEquation
= save_BlendEquation
;
6051 table
->ColorSubTable
= save_ColorSubTable
;
6052 table
->ColorTable
= save_ColorTable
;
6053 table
->ColorTableParameterfv
= save_ColorTableParameterfv
;
6054 table
->ColorTableParameteriv
= save_ColorTableParameteriv
;
6055 table
->ConvolutionFilter1D
= save_ConvolutionFilter1D
;
6056 table
->ConvolutionFilter2D
= save_ConvolutionFilter2D
;
6057 table
->ConvolutionParameterf
= save_ConvolutionParameterf
;
6058 table
->ConvolutionParameterfv
= save_ConvolutionParameterfv
;
6059 table
->ConvolutionParameteri
= save_ConvolutionParameteri
;
6060 table
->ConvolutionParameteriv
= save_ConvolutionParameteriv
;
6061 table
->CopyColorSubTable
= save_CopyColorSubTable
;
6062 table
->CopyColorTable
= save_CopyColorTable
;
6063 table
->CopyConvolutionFilter1D
= exec_CopyConvolutionFilter1D
;
6064 table
->CopyConvolutionFilter2D
= exec_CopyConvolutionFilter2D
;
6065 table
->GetColorTable
= exec_GetColorTable
;
6066 table
->GetColorTableParameterfv
= exec_GetColorTableParameterfv
;
6067 table
->GetColorTableParameteriv
= exec_GetColorTableParameteriv
;
6068 table
->GetConvolutionFilter
= exec_GetConvolutionFilter
;
6069 table
->GetConvolutionParameterfv
= exec_GetConvolutionParameterfv
;
6070 table
->GetConvolutionParameteriv
= exec_GetConvolutionParameteriv
;
6071 table
->GetHistogram
= exec_GetHistogram
;
6072 table
->GetHistogramParameterfv
= exec_GetHistogramParameterfv
;
6073 table
->GetHistogramParameteriv
= exec_GetHistogramParameteriv
;
6074 table
->GetMinmax
= exec_GetMinmax
;
6075 table
->GetMinmaxParameterfv
= exec_GetMinmaxParameterfv
;
6076 table
->GetMinmaxParameteriv
= exec_GetMinmaxParameteriv
;
6077 table
->GetSeparableFilter
= exec_GetSeparableFilter
;
6078 table
->Histogram
= save_Histogram
;
6079 table
->Minmax
= save_Minmax
;
6080 table
->ResetHistogram
= save_ResetHistogram
;
6081 table
->ResetMinmax
= save_ResetMinmax
;
6082 table
->SeparableFilter2D
= exec_SeparableFilter2D
;
6084 /* 2. GL_EXT_blend_color */
6086 table
->BlendColorEXT
= save_BlendColorEXT
;
6089 /* 3. GL_EXT_polygon_offset */
6090 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
6092 /* 6. GL_EXT_texture3d */
6094 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
6095 table
->TexImage3DEXT
= save_TexImage3DEXT
;
6096 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
6099 /* 15. GL_SGIX_pixel_texture */
6100 table
->PixelTexGenSGIX
= save_PixelTexGenSGIX
;
6102 /* 15. GL_SGIS_pixel_texture */
6103 table
->PixelTexGenParameteriSGIS
= save_PixelTexGenParameteriSGIS
;
6104 table
->PixelTexGenParameterfSGIS
= save_PixelTexGenParameterfSGIS
;
6105 table
->PixelTexGenParameterivSGIS
= save_PixelTexGenParameterivSGIS
;
6106 table
->PixelTexGenParameterfvSGIS
= save_PixelTexGenParameterfvSGIS
;
6107 table
->GetPixelTexGenParameterivSGIS
= exec_GetPixelTexGenParameterivSGIS
;
6108 table
->GetPixelTexGenParameterfvSGIS
= exec_GetPixelTexGenParameterfvSGIS
;
6110 /* 30. GL_EXT_vertex_array */
6111 table
->ColorPointerEXT
= exec_ColorPointerEXT
;
6112 table
->EdgeFlagPointerEXT
= exec_EdgeFlagPointerEXT
;
6113 table
->IndexPointerEXT
= exec_IndexPointerEXT
;
6114 table
->NormalPointerEXT
= exec_NormalPointerEXT
;
6115 table
->TexCoordPointerEXT
= exec_TexCoordPointerEXT
;
6116 table
->VertexPointerEXT
= exec_VertexPointerEXT
;
6118 /* 37. GL_EXT_blend_minmax */
6120 table
->BlendEquationEXT
= save_BlendEquationEXT
;
6123 /* 54. GL_EXT_point_parameters */
6124 table
->PointParameterfEXT
= save_PointParameterfEXT
;
6125 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
6127 /* 78. GL_EXT_paletted_texture */
6129 table
->ColorTableEXT
= save_ColorTable
;
6130 table
->ColorSubTableEXT
= save_ColorSubTable
;
6132 table
->GetColorTableEXT
= exec_GetColorTable
;
6133 table
->GetColorTableParameterfvEXT
= exec_GetColorTableParameterfv
;
6134 table
->GetColorTableParameterivEXT
= exec_GetColorTableParameteriv
;
6136 /* 97. GL_EXT_compiled_vertex_array */
6137 table
->LockArraysEXT
= exec_LockArraysEXT
;
6138 table
->UnlockArraysEXT
= exec_UnlockArraysEXT
;
6140 /* 145. GL_EXT_secondary_color */
6141 table
->SecondaryColorPointerEXT
= exec_SecondaryColorPointerEXT
;
6143 /* 148. GL_EXT_multi_draw_arrays */
6144 table
->MultiDrawArraysEXT
= exec_MultiDrawArraysEXT
;
6145 table
->MultiDrawElementsEXT
= exec_MultiDrawElementsEXT
;
6147 /* 149. GL_EXT_fog_coord */
6148 table
->FogCoordPointerEXT
= exec_FogCoordPointerEXT
;
6150 /* 173. GL_EXT_blend_func_separate */
6151 table
->BlendFuncSeparateEXT
= save_BlendFuncSeparateEXT
;
6153 /* 196. GL_MESA_resize_buffers */
6154 table
->ResizeBuffersMESA
= exec_ResizeBuffersMESA
;
6156 /* 197. GL_MESA_window_pos */
6157 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
6158 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
6159 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
6160 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
6161 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
6162 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
6163 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
6164 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
6165 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
6166 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
6167 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
6168 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
6169 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
6170 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
6171 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
6172 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
6173 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
6174 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
6175 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
6176 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
6177 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
6178 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
6179 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
6180 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
6182 #if FEATURE_NV_vertex_program
6183 /* 233. GL_NV_vertex_program */
6184 /* The following commands DO NOT go into display lists:
6185 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
6186 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
6188 table
->BindProgramNV
= save_BindProgramNV
;
6189 table
->DeleteProgramsNV
= _mesa_DeleteProgramsNV
;
6190 table
->ExecuteProgramNV
= save_ExecuteProgramNV
;
6191 table
->GenProgramsNV
= _mesa_GenProgramsNV
;
6192 table
->AreProgramsResidentNV
= _mesa_AreProgramsResidentNV
;
6193 table
->RequestResidentProgramsNV
= _mesa_RequestResidentProgramsNV
;
6194 table
->GetProgramParameterfvNV
= _mesa_GetProgramParameterfvNV
;
6195 table
->GetProgramParameterdvNV
= _mesa_GetProgramParameterdvNV
;
6196 table
->GetProgramivNV
= _mesa_GetProgramivNV
;
6197 table
->GetProgramStringNV
= _mesa_GetProgramStringNV
;
6198 table
->GetTrackMatrixivNV
= _mesa_GetTrackMatrixivNV
;
6199 table
->GetVertexAttribdvNV
= _mesa_GetVertexAttribdvNV
;
6200 table
->GetVertexAttribfvNV
= _mesa_GetVertexAttribfvNV
;
6201 table
->GetVertexAttribivNV
= _mesa_GetVertexAttribivNV
;
6202 table
->GetVertexAttribPointervNV
= _mesa_GetVertexAttribPointervNV
;
6203 table
->IsProgramNV
= _mesa_IsProgramNV
;
6204 table
->LoadProgramNV
= _mesa_LoadProgramNV
;
6205 table
->ProgramParameter4dNV
= save_ProgramParameter4dNV
;
6206 table
->ProgramParameter4dvNV
= save_ProgramParameter4dvNV
;
6207 table
->ProgramParameter4fNV
= save_ProgramParameter4fNV
;
6208 table
->ProgramParameter4fvNV
= save_ProgramParameter4fvNV
;
6209 table
->ProgramParameters4dvNV
= save_ProgramParameters4dvNV
;
6210 table
->ProgramParameters4fvNV
= save_ProgramParameters4fvNV
;
6211 table
->TrackMatrixNV
= save_TrackMatrixNV
;
6212 table
->VertexAttribPointerNV
= _mesa_VertexAttribPointerNV
;
6215 /* 262. GL_NV_point_sprite */
6216 table
->PointParameteriNV
= save_PointParameteriNV
;
6217 table
->PointParameterivNV
= save_PointParameterivNV
;
6219 /* 268. GL_EXT_stencil_two_side */
6220 table
->ActiveStencilFaceEXT
= save_ActiveStencilFaceEXT
;
6222 /* ARB 1. GL_ARB_multitexture */
6223 table
->ActiveTextureARB
= save_ActiveTextureARB
;
6224 table
->ClientActiveTextureARB
= exec_ClientActiveTextureARB
;
6226 /* ARB 3. GL_ARB_transpose_matrix */
6227 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
6228 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
6229 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
6230 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
6232 /* ARB 5. GL_ARB_multisample */
6233 table
->SampleCoverageARB
= save_SampleCoverageARB
;
6235 /* ARB 12. GL_ARB_texture_compression */
6236 table
->CompressedTexImage3DARB
= save_CompressedTexImage3DARB
;
6237 table
->CompressedTexImage2DARB
= save_CompressedTexImage2DARB
;
6238 table
->CompressedTexImage1DARB
= save_CompressedTexImage1DARB
;
6239 table
->CompressedTexSubImage3DARB
= save_CompressedTexSubImage3DARB
;
6240 table
->CompressedTexSubImage2DARB
= save_CompressedTexSubImage2DARB
;
6241 table
->CompressedTexSubImage1DARB
= save_CompressedTexSubImage1DARB
;
6242 table
->GetCompressedTexImageARB
= exec_GetCompressedTexImageARB
;
6244 /* ARB 14. GL_ARB_point_parameters */
6245 /* re-use EXT_point_parameters functions */
6247 /* ARB 25. GL_ARB_window_pos */
6248 /* re-use MESA_window_pos functions */
6256 static const char *enum_string( GLenum k
)
6258 return _mesa_lookup_enum_by_nr( k
);
6263 * Print the commands in a display list. For debugging only.
6264 * TODO: many commands aren't handled yet.
6266 static void print_list( GLcontext
*ctx
, GLuint list
)
6271 if (!glIsList(list
)) {
6272 _mesa_printf("%u is not a display list ID\n", list
);
6276 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
6278 _mesa_printf("START-LIST %u, address %p\n", list
, (void*)n
);
6280 done
= n
? GL_FALSE
: GL_TRUE
;
6282 OpCode opcode
= n
[0].opcode
;
6283 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_DRV_0
;
6285 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
6286 ctx
->listext
.opcode
[i
].print(ctx
, &n
[1]);
6287 n
+= ctx
->listext
.opcode
[i
].size
;
6292 _mesa_printf("accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
6295 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
6296 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
6298 case OPCODE_CALL_LIST
:
6299 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
6301 case OPCODE_CALL_LIST_OFFSET
:
6302 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
6303 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
6305 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
6306 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
6307 enum_string(n
[1].e
), enum_string(n
[2].e
),
6308 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6310 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
6311 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
6312 enum_string(n
[1].e
), enum_string(n
[2].e
),
6313 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
6315 case OPCODE_DISABLE
:
6316 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
6319 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
6321 case OPCODE_FRUSTUM
:
6322 _mesa_printf("Frustum %g %g %g %g %g %g\n",
6323 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6325 case OPCODE_LINE_STIPPLE
:
6326 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
6328 case OPCODE_LOAD_IDENTITY
:
6329 _mesa_printf("LoadIdentity\n");
6331 case OPCODE_LOAD_MATRIX
:
6332 _mesa_printf("LoadMatrix\n");
6333 _mesa_printf(" %8f %8f %8f %8f\n",
6334 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
6335 _mesa_printf(" %8f %8f %8f %8f\n",
6336 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
6337 _mesa_printf(" %8f %8f %8f %8f\n",
6338 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
6339 _mesa_printf(" %8f %8f %8f %8f\n",
6340 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
6342 case OPCODE_MULT_MATRIX
:
6343 _mesa_printf("MultMatrix (or Rotate)\n");
6344 _mesa_printf(" %8f %8f %8f %8f\n",
6345 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
6346 _mesa_printf(" %8f %8f %8f %8f\n",
6347 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
6348 _mesa_printf(" %8f %8f %8f %8f\n",
6349 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
6350 _mesa_printf(" %8f %8f %8f %8f\n",
6351 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
6354 _mesa_printf("Ortho %g %g %g %g %g %g\n",
6355 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6357 case OPCODE_POP_ATTRIB
:
6358 _mesa_printf("PopAttrib\n");
6360 case OPCODE_POP_MATRIX
:
6361 _mesa_printf("PopMatrix\n");
6363 case OPCODE_POP_NAME
:
6364 _mesa_printf("PopName\n");
6366 case OPCODE_PUSH_ATTRIB
:
6367 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
6369 case OPCODE_PUSH_MATRIX
:
6370 _mesa_printf("PushMatrix\n");
6372 case OPCODE_PUSH_NAME
:
6373 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
6375 case OPCODE_RASTER_POS
:
6376 _mesa_printf("RasterPos %g %g %g %g\n",
6377 n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
6380 _mesa_printf("Rotate %g %g %g %g\n",
6381 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6384 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
6386 case OPCODE_TRANSLATE
:
6387 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
6389 case OPCODE_BIND_TEXTURE
:
6390 _mesa_printf("BindTexture %s %d\n",
6391 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
6393 case OPCODE_SHADE_MODEL
:
6394 _mesa_printf("ShadeModel %s\n",
6395 _mesa_lookup_enum_by_nr(n
[1].ui
));
6398 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
6399 _mesa_lookup_enum_by_nr(n
[1].ui
),
6400 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
6403 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
6404 _mesa_lookup_enum_by_nr(n
[1].ui
),
6405 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
6406 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
6408 case OPCODE_MAPGRID1
:
6409 _mesa_printf("MapGrid1 %d %.3f %.3f\n",
6410 n
[1].i
, n
[2].f
, n
[3].f
);
6412 case OPCODE_MAPGRID2
:
6413 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
6414 n
[1].i
, n
[2].f
, n
[3].f
,
6415 n
[4].i
, n
[5].f
, n
[6].f
);
6417 case OPCODE_EVALMESH1
:
6418 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
6420 case OPCODE_EVALMESH2
:
6421 _mesa_printf("EvalMesh2 %d %d %d %d\n",
6422 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
6426 * meta opcodes/commands
6429 _mesa_printf("Error: %s %s\n",
6430 enum_string(n
[1].e
), (const char *)n
[2].data
);
6432 case OPCODE_CONTINUE
:
6433 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
6434 n
= (Node
*) n
[1].next
;
6436 case OPCODE_END_OF_LIST
:
6437 _mesa_printf("END-LIST %u\n", list
);
6441 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
6442 _mesa_printf("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
6447 _mesa_printf("command %d, %u operands\n", opcode
, InstSize
[opcode
]);
6450 /* increment n to point to next compiled command */
6451 if (opcode
!=OPCODE_CONTINUE
) {
6452 n
+= InstSize
[opcode
];
6461 * Clients may call this function to help debug display list problems.
6462 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
6463 * changed, or break in the future without notice.
6465 void mesa_print_display_list( GLuint list
)
6467 GET_CURRENT_CONTEXT(ctx
);
6468 print_list( ctx
, list
);