1 /* $Id: dlist.c,v 1.71 2001/05/14 08:57:36 keithw Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 #include "api_loopback.h"
49 #include "extensions.h"
54 #include "histogram.h"
74 #include "math/m_matrix.h"
75 #include "math/m_xform.h"
82 Functions which aren't compiled but executed immediately:
86 glEndList --- BUT: call ctx->Driver.EndList at end of list execution?
97 Functions which cause errors if called while compiling a display list:
104 * Display list instructions are stored as sequences of "nodes". Nodes
105 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
106 * are linked together with a pointer.
110 /* How many nodes to allocate at a time:
111 * - reduced now that we hold vertices etc. elsewhere.
113 #define BLOCK_SIZE 256
117 * Display list opcodes.
119 * The fact that these identifiers are assigned consecutive
120 * integer values starting at 0 is very important, see InstSize array usage)
129 OPCODE_BLEND_EQUATION
,
131 OPCODE_BLEND_FUNC_SEPARATE
,
133 OPCODE_CALL_LIST_OFFSET
,
139 OPCODE_CLEAR_STENCIL
,
142 OPCODE_COLOR_MATERIAL
,
144 OPCODE_COLOR_TABLE_PARAMETER_FV
,
145 OPCODE_COLOR_TABLE_PARAMETER_IV
,
146 OPCODE_COLOR_SUB_TABLE
,
147 OPCODE_CONVOLUTION_FILTER_1D
,
148 OPCODE_CONVOLUTION_FILTER_2D
,
149 OPCODE_CONVOLUTION_PARAMETER_I
,
150 OPCODE_CONVOLUTION_PARAMETER_IV
,
151 OPCODE_CONVOLUTION_PARAMETER_F
,
152 OPCODE_CONVOLUTION_PARAMETER_FV
,
153 OPCODE_COPY_COLOR_SUB_TABLE
,
154 OPCODE_COPY_COLOR_TABLE
,
156 OPCODE_COPY_TEX_IMAGE1D
,
157 OPCODE_COPY_TEX_IMAGE2D
,
158 OPCODE_COPY_TEX_SUB_IMAGE1D
,
159 OPCODE_COPY_TEX_SUB_IMAGE2D
,
160 OPCODE_COPY_TEX_SUB_IMAGE3D
,
183 OPCODE_LOAD_IDENTITY
,
197 OPCODE_PIXEL_TRANSFER
,
200 OPCODE_POINT_PARAMETERS
,
202 OPCODE_POLYGON_STIPPLE
,
203 OPCODE_POLYGON_OFFSET
,
207 OPCODE_PRIORITIZE_TEXTURE
,
213 OPCODE_RESET_HISTOGRAM
,
214 OPCODE_RESET_MIN_MAX
,
218 OPCODE_SELECT_TEXTURE_SGIS
,
219 OPCODE_SELECT_TEXTURE_COORD_SET
,
230 OPCODE_TEX_SUB_IMAGE1D
,
231 OPCODE_TEX_SUB_IMAGE2D
,
232 OPCODE_TEX_SUB_IMAGE3D
,
236 /* GL_ARB_multitexture */
237 OPCODE_ACTIVE_TEXTURE
,
238 OPCODE_CLIENT_ACTIVE_TEXTURE
,
239 /* GL_SGIX/SGIS_pixel_texture */
240 OPCODE_PIXEL_TEXGEN_SGIX
,
241 OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
,
242 /* GL_ARB_texture_compression */
243 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
244 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
245 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
246 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
247 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
248 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
249 /* The following three are meta instructions */
250 OPCODE_ERROR
, /* raise compiled-in error */
258 * Each instruction in the display list is stored as a sequence of
259 * contiguous nodes in memory.
260 * Each node is the union of a variety of datatypes.
274 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
279 /* Number of nodes of storage needed for each instruction. Sizes for
280 * dynamically allocated opcodes are stored in the context struct.
282 static GLuint InstSize
[ OPCODE_END_OF_LIST
+1 ];
284 void mesa_print_display_list( GLuint list
);
287 /**********************************************************************/
288 /***** Private *****/
289 /**********************************************************************/
296 * Make an empty display list. This is used by glGenLists() to
297 * reserver display list IDs.
299 static Node
*make_empty_list( void )
301 Node
*n
= (Node
*) MALLOC( sizeof(Node
) );
302 n
[0].opcode
= OPCODE_END_OF_LIST
;
309 * Destroy all nodes in a display list.
310 * Input: list - display list number
312 void _mesa_destroy_list( GLcontext
*ctx
, GLuint list
)
320 block
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
323 done
= block
? GL_FALSE
: GL_TRUE
;
326 /* check for extension opcodes first */
328 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_DRV_0
;
329 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
330 ctx
->listext
.opcode
[i
].destroy(ctx
, &n
[1]);
331 n
+= ctx
->listext
.opcode
[i
].size
;
334 switch (n
[0].opcode
) {
337 n
+= InstSize
[n
[0].opcode
];
341 n
+= InstSize
[n
[0].opcode
];
343 case OPCODE_DRAW_PIXELS
:
345 n
+= InstSize
[n
[0].opcode
];
349 n
+= InstSize
[n
[0].opcode
];
351 case OPCODE_COLOR_TABLE
:
353 n
+= InstSize
[n
[0].opcode
];
355 case OPCODE_COLOR_SUB_TABLE
:
357 n
+= InstSize
[n
[0].opcode
];
359 case OPCODE_CONVOLUTION_FILTER_1D
:
361 n
+= InstSize
[n
[0].opcode
];
363 case OPCODE_CONVOLUTION_FILTER_2D
:
365 n
+= InstSize
[n
[0].opcode
];
367 case OPCODE_POLYGON_STIPPLE
:
369 n
+= InstSize
[n
[0].opcode
];
371 case OPCODE_TEX_IMAGE1D
:
373 n
+= InstSize
[n
[0].opcode
];
375 case OPCODE_TEX_IMAGE2D
:
377 n
+= InstSize
[n
[0].opcode
];
379 case OPCODE_TEX_IMAGE3D
:
381 n
+= InstSize
[n
[0].opcode
];
383 case OPCODE_TEX_SUB_IMAGE1D
:
385 n
+= InstSize
[n
[0].opcode
];
387 case OPCODE_TEX_SUB_IMAGE2D
:
389 n
+= InstSize
[n
[0].opcode
];
391 case OPCODE_TEX_SUB_IMAGE3D
:
393 n
+= InstSize
[n
[0].opcode
];
395 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
397 n
+= InstSize
[n
[0].opcode
];
399 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
401 n
+= InstSize
[n
[0].opcode
];
403 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
405 n
+= InstSize
[n
[0].opcode
];
407 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
409 n
+= InstSize
[n
[0].opcode
];
411 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
413 n
+= InstSize
[n
[0].opcode
];
415 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
417 n
+= InstSize
[n
[0].opcode
];
419 case OPCODE_CONTINUE
:
420 n
= (Node
*) n
[1].next
;
424 case OPCODE_END_OF_LIST
:
429 /* Most frequent case */
430 n
+= InstSize
[n
[0].opcode
];
436 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
442 * Translate the nth element of list from type to GLuint.
444 static GLuint
translate_id( GLsizei n
, GLenum type
, const GLvoid
*list
)
456 bptr
= (GLbyte
*) list
;
457 return (GLuint
) *(bptr
+n
);
458 case GL_UNSIGNED_BYTE
:
459 ubptr
= (GLubyte
*) list
;
460 return (GLuint
) *(ubptr
+n
);
462 sptr
= (GLshort
*) list
;
463 return (GLuint
) *(sptr
+n
);
464 case GL_UNSIGNED_SHORT
:
465 usptr
= (GLushort
*) list
;
466 return (GLuint
) *(usptr
+n
);
468 iptr
= (GLint
*) list
;
469 return (GLuint
) *(iptr
+n
);
470 case GL_UNSIGNED_INT
:
471 uiptr
= (GLuint
*) list
;
472 return (GLuint
) *(uiptr
+n
);
474 fptr
= (GLfloat
*) list
;
475 return (GLuint
) *(fptr
+n
);
477 ubptr
= ((GLubyte
*) list
) + 2*n
;
478 return (GLuint
) *ubptr
* 256 + (GLuint
) *(ubptr
+1);
480 ubptr
= ((GLubyte
*) list
) + 3*n
;
481 return (GLuint
) *ubptr
* 65536
482 + (GLuint
) *(ubptr
+1) * 256
483 + (GLuint
) *(ubptr
+2);
485 ubptr
= ((GLubyte
*) list
) + 4*n
;
486 return (GLuint
) *ubptr
* 16777216
487 + (GLuint
) *(ubptr
+1) * 65536
488 + (GLuint
) *(ubptr
+2) * 256
489 + (GLuint
) *(ubptr
+3);
498 /**********************************************************************/
500 /**********************************************************************/
502 void _mesa_init_lists( void )
504 static int init_flag
= 0;
507 InstSize
[OPCODE_ACCUM
] = 3;
508 InstSize
[OPCODE_ALPHA_FUNC
] = 3;
509 InstSize
[OPCODE_BIND_TEXTURE
] = 3;
510 InstSize
[OPCODE_BITMAP
] = 8;
511 InstSize
[OPCODE_BLEND_COLOR
] = 5;
512 InstSize
[OPCODE_BLEND_EQUATION
] = 2;
513 InstSize
[OPCODE_BLEND_FUNC
] = 3;
514 InstSize
[OPCODE_BLEND_FUNC_SEPARATE
] = 5;
515 InstSize
[OPCODE_CALL_LIST
] = 2;
516 InstSize
[OPCODE_CALL_LIST_OFFSET
] = 2;
517 InstSize
[OPCODE_CLEAR
] = 2;
518 InstSize
[OPCODE_CLEAR_ACCUM
] = 5;
519 InstSize
[OPCODE_CLEAR_COLOR
] = 5;
520 InstSize
[OPCODE_CLEAR_DEPTH
] = 2;
521 InstSize
[OPCODE_CLEAR_INDEX
] = 2;
522 InstSize
[OPCODE_CLEAR_STENCIL
] = 2;
523 InstSize
[OPCODE_CLIP_PLANE
] = 6;
524 InstSize
[OPCODE_COLOR_MASK
] = 5;
525 InstSize
[OPCODE_COLOR_MATERIAL
] = 3;
526 InstSize
[OPCODE_COLOR_TABLE
] = 7;
527 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_FV
] = 7;
528 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_IV
] = 7;
529 InstSize
[OPCODE_COLOR_SUB_TABLE
] = 7;
530 InstSize
[OPCODE_CONVOLUTION_FILTER_1D
] = 7;
531 InstSize
[OPCODE_CONVOLUTION_FILTER_2D
] = 8;
532 InstSize
[OPCODE_CONVOLUTION_PARAMETER_I
] = 4;
533 InstSize
[OPCODE_CONVOLUTION_PARAMETER_IV
] = 7;
534 InstSize
[OPCODE_CONVOLUTION_PARAMETER_F
] = 4;
535 InstSize
[OPCODE_CONVOLUTION_PARAMETER_FV
] = 7;
536 InstSize
[OPCODE_COPY_PIXELS
] = 6;
537 InstSize
[OPCODE_COPY_COLOR_SUB_TABLE
] = 6;
538 InstSize
[OPCODE_COPY_COLOR_TABLE
] = 6;
539 InstSize
[OPCODE_COPY_TEX_IMAGE1D
] = 8;
540 InstSize
[OPCODE_COPY_TEX_IMAGE2D
] = 9;
541 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE1D
] = 7;
542 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE2D
] = 9;
543 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE3D
] = 10;
544 InstSize
[OPCODE_CULL_FACE
] = 2;
545 InstSize
[OPCODE_DEPTH_FUNC
] = 2;
546 InstSize
[OPCODE_DEPTH_MASK
] = 2;
547 InstSize
[OPCODE_DEPTH_RANGE
] = 3;
548 InstSize
[OPCODE_DISABLE
] = 2;
549 InstSize
[OPCODE_DRAW_BUFFER
] = 2;
550 InstSize
[OPCODE_DRAW_PIXELS
] = 6;
551 InstSize
[OPCODE_ENABLE
] = 2;
552 InstSize
[OPCODE_EVALMESH1
] = 4;
553 InstSize
[OPCODE_EVALMESH2
] = 6;
554 InstSize
[OPCODE_FOG
] = 6;
555 InstSize
[OPCODE_FRONT_FACE
] = 2;
556 InstSize
[OPCODE_FRUSTUM
] = 7;
557 InstSize
[OPCODE_HINT
] = 3;
558 InstSize
[OPCODE_HISTOGRAM
] = 5;
559 InstSize
[OPCODE_INDEX_MASK
] = 2;
560 InstSize
[OPCODE_INIT_NAMES
] = 1;
561 InstSize
[OPCODE_LIGHT
] = 7;
562 InstSize
[OPCODE_LIGHT_MODEL
] = 6;
563 InstSize
[OPCODE_LINE_STIPPLE
] = 3;
564 InstSize
[OPCODE_LINE_WIDTH
] = 2;
565 InstSize
[OPCODE_LIST_BASE
] = 2;
566 InstSize
[OPCODE_LOAD_IDENTITY
] = 1;
567 InstSize
[OPCODE_LOAD_MATRIX
] = 17;
568 InstSize
[OPCODE_LOAD_NAME
] = 2;
569 InstSize
[OPCODE_LOGIC_OP
] = 2;
570 InstSize
[OPCODE_MAP1
] = 7;
571 InstSize
[OPCODE_MAP2
] = 11;
572 InstSize
[OPCODE_MAPGRID1
] = 4;
573 InstSize
[OPCODE_MAPGRID2
] = 7;
574 InstSize
[OPCODE_MATRIX_MODE
] = 2;
575 InstSize
[OPCODE_MIN_MAX
] = 4;
576 InstSize
[OPCODE_MULT_MATRIX
] = 17;
577 InstSize
[OPCODE_ORTHO
] = 7;
578 InstSize
[OPCODE_PASSTHROUGH
] = 2;
579 InstSize
[OPCODE_PIXEL_MAP
] = 4;
580 InstSize
[OPCODE_PIXEL_TRANSFER
] = 3;
581 InstSize
[OPCODE_PIXEL_ZOOM
] = 3;
582 InstSize
[OPCODE_POINT_SIZE
] = 2;
583 InstSize
[OPCODE_POINT_PARAMETERS
] = 5;
584 InstSize
[OPCODE_POLYGON_MODE
] = 3;
585 InstSize
[OPCODE_POLYGON_STIPPLE
] = 2;
586 InstSize
[OPCODE_POLYGON_OFFSET
] = 3;
587 InstSize
[OPCODE_POP_ATTRIB
] = 1;
588 InstSize
[OPCODE_POP_MATRIX
] = 1;
589 InstSize
[OPCODE_POP_NAME
] = 1;
590 InstSize
[OPCODE_PRIORITIZE_TEXTURE
] = 3;
591 InstSize
[OPCODE_PUSH_ATTRIB
] = 2;
592 InstSize
[OPCODE_PUSH_MATRIX
] = 1;
593 InstSize
[OPCODE_PUSH_NAME
] = 2;
594 InstSize
[OPCODE_RASTER_POS
] = 5;
595 InstSize
[OPCODE_READ_BUFFER
] = 2;
596 InstSize
[OPCODE_RESET_HISTOGRAM
] = 2;
597 InstSize
[OPCODE_RESET_MIN_MAX
] = 2;
598 InstSize
[OPCODE_ROTATE
] = 5;
599 InstSize
[OPCODE_SCALE
] = 4;
600 InstSize
[OPCODE_SCISSOR
] = 5;
601 InstSize
[OPCODE_STENCIL_FUNC
] = 4;
602 InstSize
[OPCODE_STENCIL_MASK
] = 2;
603 InstSize
[OPCODE_STENCIL_OP
] = 4;
604 InstSize
[OPCODE_SHADE_MODEL
] = 2;
605 InstSize
[OPCODE_TEXENV
] = 7;
606 InstSize
[OPCODE_TEXGEN
] = 7;
607 InstSize
[OPCODE_TEXPARAMETER
] = 7;
608 InstSize
[OPCODE_TEX_IMAGE1D
] = 9;
609 InstSize
[OPCODE_TEX_IMAGE2D
] = 10;
610 InstSize
[OPCODE_TEX_IMAGE3D
] = 11;
611 InstSize
[OPCODE_TEX_SUB_IMAGE1D
] = 8;
612 InstSize
[OPCODE_TEX_SUB_IMAGE2D
] = 10;
613 InstSize
[OPCODE_TEX_SUB_IMAGE3D
] = 12;
614 InstSize
[OPCODE_TRANSLATE
] = 4;
615 InstSize
[OPCODE_VIEWPORT
] = 5;
616 InstSize
[OPCODE_WINDOW_POS
] = 5;
617 InstSize
[OPCODE_CONTINUE
] = 2;
618 InstSize
[OPCODE_ERROR
] = 3;
619 InstSize
[OPCODE_END_OF_LIST
] = 1;
620 /* GL_SGIX/SGIS_pixel_texture */
621 InstSize
[OPCODE_PIXEL_TEXGEN_SGIX
] = 2;
622 InstSize
[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
] = 3;
623 /* GL_ARB_texture_compression */
624 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_1D
] = 8;
625 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_2D
] = 9;
626 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_3D
] = 10;
627 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
] = 8;
628 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
] = 10;
629 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
] = 12;
630 /* GL_ARB_multitexture */
631 InstSize
[OPCODE_ACTIVE_TEXTURE
] = 2;
632 InstSize
[OPCODE_CLIENT_ACTIVE_TEXTURE
] = 2;
639 * Allocate space for a display list instruction.
640 * Input: opcode - type of instruction
641 * argcount - size in bytes of data required.
642 * Return: pointer to the usable data area (not including the internal
646 _mesa_alloc_instruction( GLcontext
*ctx
, int opcode
, GLint sz
)
649 GLuint count
= 1 + (sz
+ sizeof(Node
) - 1) / sizeof(Node
);
652 if (opcode
< (int) OPCODE_DRV_0
) {
653 assert( count
== InstSize
[opcode
] );
657 if (ctx
->CurrentPos
+ count
+ 2 > BLOCK_SIZE
) {
658 /* This block is full. Allocate a new block and chain to it */
659 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
660 n
[0].opcode
= OPCODE_CONTINUE
;
661 newblock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
663 _mesa_error( ctx
, GL_OUT_OF_MEMORY
, "Building display list" );
666 n
[1].next
= (Node
*) newblock
;
667 ctx
->CurrentBlock
= newblock
;
671 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
672 ctx
->CurrentPos
+= count
;
674 n
[0].opcode
= (OpCode
) opcode
;
676 return (void *)&n
[1];
680 /* Allow modules and drivers to get their own opcodes.
683 _mesa_alloc_opcode( GLcontext
*ctx
,
685 void (*execute
)( GLcontext
*, void * ),
686 void (*destroy
)( GLcontext
*, void * ),
687 void (*print
)( GLcontext
*, void * ) )
689 if (ctx
->listext
.nr_opcodes
< GL_MAX_EXT_OPCODES
) {
690 GLuint i
= ctx
->listext
.nr_opcodes
++;
691 ctx
->listext
.opcode
[i
].size
= 1 + (sz
+ sizeof(Node
) - 1)/sizeof(Node
);
692 ctx
->listext
.opcode
[i
].execute
= execute
;
693 ctx
->listext
.opcode
[i
].destroy
= destroy
;
694 ctx
->listext
.opcode
[i
].print
= print
;
695 return i
+ OPCODE_DRV_0
;
702 /* Mimic the old behaviour of alloc_instruction:
703 * - sz is in units of sizeof(Node)
704 * - return value a pointer to sizeof(Node) before the actual
707 #define ALLOC_INSTRUCTION(ctx, opcode, sz) \
708 ((Node *)_mesa_alloc_instruction(ctx, opcode, sz*sizeof(Node)) - 1)
713 * Display List compilation functions
715 static void save_Accum( GLenum op
, GLfloat value
)
717 GET_CURRENT_CONTEXT(ctx
);
719 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
720 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACCUM
, 2 );
725 if (ctx
->ExecuteFlag
) {
726 (*ctx
->Exec
->Accum
)( op
, value
);
731 static void save_AlphaFunc( GLenum func
, GLclampf ref
)
733 GET_CURRENT_CONTEXT(ctx
);
735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
736 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ALPHA_FUNC
, 2 );
739 n
[2].f
= (GLfloat
) ref
;
741 if (ctx
->ExecuteFlag
) {
742 (*ctx
->Exec
->AlphaFunc
)( func
, ref
);
747 static void save_BindTexture( GLenum target
, GLuint texture
)
749 GET_CURRENT_CONTEXT(ctx
);
751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
752 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_TEXTURE
, 2 );
757 if (ctx
->ExecuteFlag
) {
758 (*ctx
->Exec
->BindTexture
)( target
, texture
);
763 static void save_Bitmap( GLsizei width
, GLsizei height
,
764 GLfloat xorig
, GLfloat yorig
,
765 GLfloat xmove
, GLfloat ymove
,
766 const GLubyte
*pixels
)
768 GET_CURRENT_CONTEXT(ctx
);
769 GLvoid
*image
= _mesa_unpack_bitmap( width
, height
, pixels
, &ctx
->Unpack
);
771 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
772 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BITMAP
, 7 );
774 n
[1].i
= (GLint
) width
;
775 n
[2].i
= (GLint
) height
;
785 if (ctx
->ExecuteFlag
) {
786 (*ctx
->Exec
->Bitmap
)( width
, height
,
787 xorig
, yorig
, xmove
, ymove
, pixels
);
792 static void save_BlendEquation( GLenum mode
)
794 GET_CURRENT_CONTEXT(ctx
);
796 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
797 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_EQUATION
, 1 );
801 if (ctx
->ExecuteFlag
) {
802 (*ctx
->Exec
->BlendEquation
)( mode
);
807 static void save_BlendFunc( GLenum sfactor
, GLenum dfactor
)
809 GET_CURRENT_CONTEXT(ctx
);
811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
812 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_FUNC
, 2 );
817 if (ctx
->ExecuteFlag
) {
818 (*ctx
->Exec
->BlendFunc
)( sfactor
, dfactor
);
823 static void save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
824 GLenum sfactorA
, GLenum dfactorA
)
826 GET_CURRENT_CONTEXT(ctx
);
828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
829 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4 );
836 if (ctx
->ExecuteFlag
) {
837 (*ctx
->Exec
->BlendFuncSeparateEXT
)( sfactorRGB
, dfactorRGB
,
843 static void save_BlendColor( GLfloat red
, GLfloat green
,
844 GLfloat blue
, GLfloat alpha
)
846 GET_CURRENT_CONTEXT(ctx
);
848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
849 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_COLOR
, 4 );
856 if (ctx
->ExecuteFlag
) {
857 (*ctx
->Exec
->BlendColor
)( red
, green
, blue
, alpha
);
862 void _mesa_save_CallList( GLuint list
)
864 GET_CURRENT_CONTEXT(ctx
);
866 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
867 FLUSH_CURRENT(ctx
, 0);
869 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CALL_LIST
, 1 );
873 if (ctx
->ExecuteFlag
) {
874 (*ctx
->Exec
->CallList
)( list
);
879 void _mesa_save_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
881 GET_CURRENT_CONTEXT(ctx
);
883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
884 FLUSH_CURRENT(ctx
, 0);
887 GLuint list
= translate_id( i
, type
, lists
);
888 Node
*n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CALL_LIST_OFFSET
, 1 );
893 if (ctx
->ExecuteFlag
) {
894 (*ctx
->Exec
->CallLists
)( n
, type
, lists
);
899 static void save_Clear( GLbitfield mask
)
901 GET_CURRENT_CONTEXT(ctx
);
903 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
904 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR
, 1 );
908 if (ctx
->ExecuteFlag
) {
909 (*ctx
->Exec
->Clear
)( mask
);
914 static void save_ClearAccum( GLfloat red
, GLfloat green
,
915 GLfloat blue
, GLfloat alpha
)
917 GET_CURRENT_CONTEXT(ctx
);
919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
920 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_ACCUM
, 4 );
927 if (ctx
->ExecuteFlag
) {
928 (*ctx
->Exec
->ClearAccum
)( red
, green
, blue
, alpha
);
933 static void save_ClearColor( GLclampf red
, GLclampf green
,
934 GLclampf blue
, GLclampf alpha
)
936 GET_CURRENT_CONTEXT(ctx
);
938 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
939 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_COLOR
, 4 );
946 if (ctx
->ExecuteFlag
) {
947 (*ctx
->Exec
->ClearColor
)( red
, green
, blue
, alpha
);
952 static void save_ClearDepth( GLclampd depth
)
954 GET_CURRENT_CONTEXT(ctx
);
956 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
957 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_DEPTH
, 1 );
959 n
[1].f
= (GLfloat
) depth
;
961 if (ctx
->ExecuteFlag
) {
962 (*ctx
->Exec
->ClearDepth
)( depth
);
967 static void save_ClearIndex( GLfloat c
)
969 GET_CURRENT_CONTEXT(ctx
);
971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
972 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_INDEX
, 1 );
976 if (ctx
->ExecuteFlag
) {
977 (*ctx
->Exec
->ClearIndex
)( c
);
982 static void save_ClearStencil( GLint s
)
984 GET_CURRENT_CONTEXT(ctx
);
986 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
987 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_STENCIL
, 1 );
991 if (ctx
->ExecuteFlag
) {
992 (*ctx
->Exec
->ClearStencil
)( s
);
997 static void save_ClipPlane( GLenum plane
, const GLdouble
*equ
)
999 GET_CURRENT_CONTEXT(ctx
);
1001 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1002 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLIP_PLANE
, 5 );
1010 if (ctx
->ExecuteFlag
) {
1011 (*ctx
->Exec
->ClipPlane
)( plane
, equ
);
1017 static void save_ColorMask( GLboolean red
, GLboolean green
,
1018 GLboolean blue
, GLboolean alpha
)
1020 GET_CURRENT_CONTEXT(ctx
);
1022 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1023 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_MASK
, 4 );
1030 if (ctx
->ExecuteFlag
) {
1031 (*ctx
->Exec
->ColorMask
)( red
, green
, blue
, alpha
);
1036 static void save_ColorMaterial( GLenum face
, GLenum mode
)
1038 GET_CURRENT_CONTEXT(ctx
);
1040 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1041 FLUSH_CURRENT(ctx
, 0);
1043 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_MATERIAL
, 2 );
1048 if (ctx
->ExecuteFlag
) {
1049 (*ctx
->Exec
->ColorMaterial
)( face
, mode
);
1054 static void save_ColorTable( GLenum target
, GLenum internalFormat
,
1055 GLsizei width
, GLenum format
, GLenum type
,
1056 const GLvoid
*table
)
1058 GET_CURRENT_CONTEXT(ctx
);
1059 if (target
== GL_PROXY_TEXTURE_1D
||
1060 target
== GL_PROXY_TEXTURE_2D
||
1061 target
== GL_PROXY_TEXTURE_3D
||
1062 target
== GL_PROXY_TEXTURE_CUBE_MAP_ARB
) {
1063 /* execute immediately */
1064 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1065 format
, type
, table
);
1068 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, table
,
1071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1072 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE
, 6 );
1075 n
[2].e
= internalFormat
;
1084 if (ctx
->ExecuteFlag
) {
1085 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1086 format
, type
, table
);
1094 save_ColorTableParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1096 GET_CURRENT_CONTEXT(ctx
);
1099 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1101 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6 );
1106 if (pname
== GL_COLOR_TABLE_SGI
||
1107 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1108 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
) {
1115 if (ctx
->ExecuteFlag
) {
1116 (*ctx
->Exec
->ColorTableParameterfv
)( target
, pname
, params
);
1122 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1124 GET_CURRENT_CONTEXT(ctx
);
1127 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1129 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6 );
1134 if (pname
== GL_COLOR_TABLE_SGI
||
1135 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1136 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
) {
1143 if (ctx
->ExecuteFlag
) {
1144 (*ctx
->Exec
->ColorTableParameteriv
)( target
, pname
, params
);
1150 static void save_ColorSubTable( GLenum target
, GLsizei start
, GLsizei count
,
1151 GLenum format
, GLenum type
,
1152 const GLvoid
*table
)
1154 GET_CURRENT_CONTEXT(ctx
);
1155 GLvoid
*image
= _mesa_unpack_image(count
, 1, 1, format
, type
, table
,
1158 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1159 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_SUB_TABLE
, 6 );
1171 if (ctx
->ExecuteFlag
) {
1172 (*ctx
->Exec
->ColorSubTable
)(target
, start
, count
, format
, type
, table
);
1178 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1179 GLint x
, GLint y
, GLsizei width
)
1181 GET_CURRENT_CONTEXT(ctx
);
1184 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1185 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 6 );
1193 if (ctx
->ExecuteFlag
) {
1194 (*ctx
->Exec
->CopyColorSubTable
)(target
, start
, x
, y
, width
);
1200 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1201 GLint x
, GLint y
, GLsizei width
)
1203 GET_CURRENT_CONTEXT(ctx
);
1206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1207 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_TABLE
, 6 );
1210 n
[2].e
= internalformat
;
1215 if (ctx
->ExecuteFlag
) {
1216 (*ctx
->Exec
->CopyColorTable
)(target
, internalformat
, x
, y
, width
);
1222 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1223 GLenum format
, GLenum type
, const GLvoid
*filter
)
1225 GET_CURRENT_CONTEXT(ctx
);
1226 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, filter
,
1229 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1230 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6 );
1233 n
[2].e
= internalFormat
;
1242 if (ctx
->ExecuteFlag
) {
1243 (*ctx
->Exec
->ConvolutionFilter1D
)( target
, internalFormat
, width
,
1244 format
, type
, filter
);
1250 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1251 GLsizei width
, GLsizei height
, GLenum format
,
1252 GLenum type
, const GLvoid
*filter
)
1254 GET_CURRENT_CONTEXT(ctx
);
1255 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
, filter
,
1258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1259 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7 );
1262 n
[2].e
= internalFormat
;
1272 if (ctx
->ExecuteFlag
) {
1273 (*ctx
->Exec
->ConvolutionFilter2D
)( target
, internalFormat
, width
, height
,
1274 format
, type
, filter
);
1280 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1282 GET_CURRENT_CONTEXT(ctx
);
1284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1285 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3 );
1291 if (ctx
->ExecuteFlag
) {
1292 (*ctx
->Exec
->ConvolutionParameteri
)( target
, pname
, param
);
1298 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1300 GET_CURRENT_CONTEXT(ctx
);
1302 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1303 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6 );
1308 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1309 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1310 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1316 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1319 if (ctx
->ExecuteFlag
) {
1320 (*ctx
->Exec
->ConvolutionParameteriv
)( target
, pname
, params
);
1326 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1328 GET_CURRENT_CONTEXT(ctx
);
1330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1331 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3 );
1337 if (ctx
->ExecuteFlag
) {
1338 (*ctx
->Exec
->ConvolutionParameterf
)( target
, pname
, param
);
1344 save_ConvolutionParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1346 GET_CURRENT_CONTEXT(ctx
);
1348 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1349 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6 );
1354 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1355 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1356 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1362 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1365 if (ctx
->ExecuteFlag
) {
1366 (*ctx
->Exec
->ConvolutionParameterfv
)( target
, pname
, params
);
1372 save_CopyPixels( GLint x
, GLint y
,
1373 GLsizei width
, GLsizei height
, GLenum type
)
1375 GET_CURRENT_CONTEXT(ctx
);
1377 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1378 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_PIXELS
, 5 );
1382 n
[3].i
= (GLint
) width
;
1383 n
[4].i
= (GLint
) height
;
1386 if (ctx
->ExecuteFlag
) {
1387 (*ctx
->Exec
->CopyPixels
)( x
, y
, width
, height
, type
);
1394 save_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
1395 GLint x
, GLint y
, GLsizei width
, GLint border
)
1397 GET_CURRENT_CONTEXT(ctx
);
1399 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1400 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7 );
1404 n
[3].e
= internalformat
;
1410 if (ctx
->ExecuteFlag
) {
1411 (*ctx
->Exec
->CopyTexImage1D
)( target
, level
, internalformat
,
1412 x
, y
, width
, border
);
1418 save_CopyTexImage2D( GLenum target
, GLint level
,
1419 GLenum internalformat
,
1420 GLint x
, GLint y
, GLsizei width
,
1421 GLsizei height
, GLint border
)
1423 GET_CURRENT_CONTEXT(ctx
);
1425 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1426 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8 );
1430 n
[3].e
= internalformat
;
1437 if (ctx
->ExecuteFlag
) {
1438 (*ctx
->Exec
->CopyTexImage2D
)( target
, level
, internalformat
,
1439 x
, y
, width
, height
, border
);
1446 save_CopyTexSubImage1D( GLenum target
, GLint level
,
1447 GLint xoffset
, GLint x
, GLint y
,
1450 GET_CURRENT_CONTEXT(ctx
);
1452 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1453 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6 );
1462 if (ctx
->ExecuteFlag
) {
1463 (*ctx
->Exec
->CopyTexSubImage1D
)( target
, level
, xoffset
, x
, y
, width
);
1469 save_CopyTexSubImage2D( GLenum target
, GLint level
,
1470 GLint xoffset
, GLint yoffset
,
1472 GLsizei width
, GLint height
)
1474 GET_CURRENT_CONTEXT(ctx
);
1476 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1477 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8 );
1488 if (ctx
->ExecuteFlag
) {
1489 (*ctx
->Exec
->CopyTexSubImage2D
)( target
, level
, xoffset
, yoffset
,
1490 x
, y
, width
, height
);
1496 save_CopyTexSubImage3D( GLenum target
, GLint level
,
1497 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1499 GLsizei width
, GLint height
)
1501 GET_CURRENT_CONTEXT(ctx
);
1503 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1504 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9 );
1516 if (ctx
->ExecuteFlag
) {
1517 (*ctx
->Exec
->CopyTexSubImage3D
)( target
, level
,
1518 xoffset
, yoffset
, zoffset
,
1519 x
, y
, width
, height
);
1524 static void save_CullFace( GLenum mode
)
1526 GET_CURRENT_CONTEXT(ctx
);
1528 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1529 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CULL_FACE
, 1 );
1533 if (ctx
->ExecuteFlag
) {
1534 (*ctx
->Exec
->CullFace
)( mode
);
1539 static void save_DepthFunc( GLenum func
)
1541 GET_CURRENT_CONTEXT(ctx
);
1543 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1544 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_FUNC
, 1 );
1548 if (ctx
->ExecuteFlag
) {
1549 (*ctx
->Exec
->DepthFunc
)( func
);
1554 static void save_DepthMask( GLboolean mask
)
1556 GET_CURRENT_CONTEXT(ctx
);
1558 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1559 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_MASK
, 1 );
1563 if (ctx
->ExecuteFlag
) {
1564 (*ctx
->Exec
->DepthMask
)( mask
);
1569 static void save_DepthRange( GLclampd nearval
, GLclampd farval
)
1571 GET_CURRENT_CONTEXT(ctx
);
1573 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1574 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_RANGE
, 2 );
1576 n
[1].f
= (GLfloat
) nearval
;
1577 n
[2].f
= (GLfloat
) farval
;
1579 if (ctx
->ExecuteFlag
) {
1580 (*ctx
->Exec
->DepthRange
)( nearval
, farval
);
1585 static void save_Disable( GLenum cap
)
1587 GET_CURRENT_CONTEXT(ctx
);
1589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1590 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DISABLE
, 1 );
1594 if (ctx
->ExecuteFlag
) {
1595 (*ctx
->Exec
->Disable
)( cap
);
1600 static void save_DrawBuffer( GLenum mode
)
1602 GET_CURRENT_CONTEXT(ctx
);
1604 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1605 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_BUFFER
, 1 );
1609 if (ctx
->ExecuteFlag
) {
1610 (*ctx
->Exec
->DrawBuffer
)( mode
);
1615 static void save_DrawPixels( GLsizei width
, GLsizei height
,
1616 GLenum format
, GLenum type
,
1617 const GLvoid
*pixels
)
1619 GET_CURRENT_CONTEXT(ctx
);
1620 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
1621 pixels
, &ctx
->Unpack
);
1623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1624 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_PIXELS
, 5 );
1635 if (ctx
->ExecuteFlag
) {
1636 (*ctx
->Exec
->DrawPixels
)( width
, height
, format
, type
, pixels
);
1642 static void save_Enable( GLenum cap
)
1644 GET_CURRENT_CONTEXT(ctx
);
1646 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1647 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ENABLE
, 1 );
1651 if (ctx
->ExecuteFlag
) {
1652 (*ctx
->Exec
->Enable
)( cap
);
1658 void _mesa_save_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
1660 GET_CURRENT_CONTEXT(ctx
);
1662 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1663 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH1
, 3 );
1669 if (ctx
->ExecuteFlag
) {
1670 (*ctx
->Exec
->EvalMesh1
)( mode
, i1
, i2
);
1675 void _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1677 GET_CURRENT_CONTEXT(ctx
);
1679 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1680 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH2
, 5 );
1688 if (ctx
->ExecuteFlag
) {
1689 (*ctx
->Exec
->EvalMesh2
)( mode
, i1
, i2
, j1
, j2
);
1696 static void save_Fogfv( GLenum pname
, const GLfloat
*params
)
1698 GET_CURRENT_CONTEXT(ctx
);
1700 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1701 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FOG
, 5 );
1709 if (ctx
->ExecuteFlag
) {
1710 (*ctx
->Exec
->Fogfv
)( pname
, params
);
1715 static void save_Fogf( GLenum pname
, GLfloat param
)
1717 save_Fogfv(pname
, ¶m
);
1721 static void save_Fogiv(GLenum pname
, const GLint
*params
)
1726 case GL_FOG_DENSITY
:
1730 p
[0] = (GLfloat
) *params
;
1733 p
[0] = INT_TO_FLOAT( params
[0] );
1734 p
[1] = INT_TO_FLOAT( params
[1] );
1735 p
[2] = INT_TO_FLOAT( params
[2] );
1736 p
[3] = INT_TO_FLOAT( params
[3] );
1739 /* Error will be caught later in gl_Fogfv */
1742 save_Fogfv(pname
, p
);
1746 static void save_Fogi(GLenum pname
, GLint param
)
1748 save_Fogiv(pname
, ¶m
);
1752 static void save_FrontFace( GLenum mode
)
1754 GET_CURRENT_CONTEXT(ctx
);
1756 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1757 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRONT_FACE
, 1 );
1761 if (ctx
->ExecuteFlag
) {
1762 (*ctx
->Exec
->FrontFace
)( mode
);
1767 static void save_Frustum( GLdouble left
, GLdouble right
,
1768 GLdouble bottom
, GLdouble top
,
1769 GLdouble nearval
, GLdouble farval
)
1771 GET_CURRENT_CONTEXT(ctx
);
1773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1774 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRUSTUM
, 6 );
1783 if (ctx
->ExecuteFlag
) {
1784 (*ctx
->Exec
->Frustum
)( left
, right
, bottom
, top
, nearval
, farval
);
1789 static void save_Hint( GLenum target
, GLenum mode
)
1791 GET_CURRENT_CONTEXT(ctx
);
1793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1794 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HINT
, 2 );
1799 if (ctx
->ExecuteFlag
) {
1800 (*ctx
->Exec
->Hint
)( target
, mode
);
1806 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
, GLboolean sink
)
1808 GET_CURRENT_CONTEXT(ctx
);
1811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1812 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HISTOGRAM
, 4 );
1816 n
[3].e
= internalFormat
;
1819 if (ctx
->ExecuteFlag
) {
1820 (*ctx
->Exec
->Histogram
)( target
, width
, internalFormat
, sink
);
1825 static void save_IndexMask( GLuint mask
)
1827 GET_CURRENT_CONTEXT(ctx
);
1829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1830 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_INDEX_MASK
, 1 );
1834 if (ctx
->ExecuteFlag
) {
1835 (*ctx
->Exec
->IndexMask
)( mask
);
1840 static void save_InitNames( void )
1842 GET_CURRENT_CONTEXT(ctx
);
1843 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1844 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_INIT_NAMES
, 0 );
1845 if (ctx
->ExecuteFlag
) {
1846 (*ctx
->Exec
->InitNames
)();
1851 static void save_Lightfv( GLenum light
, GLenum pname
, const GLfloat
*params
)
1853 GET_CURRENT_CONTEXT(ctx
);
1855 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1856 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT
, 6 );
1874 case GL_SPOT_DIRECTION
:
1877 case GL_SPOT_EXPONENT
:
1880 case GL_SPOT_CUTOFF
:
1883 case GL_CONSTANT_ATTENUATION
:
1886 case GL_LINEAR_ATTENUATION
:
1889 case GL_QUADRATIC_ATTENUATION
:
1895 for (i
= 0; i
< nParams
; i
++) {
1896 n
[3+i
].f
= params
[i
];
1899 if (ctx
->ExecuteFlag
) {
1900 (*ctx
->Exec
->Lightfv
)( light
, pname
, params
);
1905 static void save_Lightf( GLenum light
, GLenum pname
, GLfloat params
)
1907 save_Lightfv(light
, pname
, ¶ms
);
1911 static void save_Lightiv( GLenum light
, GLenum pname
, const GLint
*params
)
1918 fparam
[0] = INT_TO_FLOAT( params
[0] );
1919 fparam
[1] = INT_TO_FLOAT( params
[1] );
1920 fparam
[2] = INT_TO_FLOAT( params
[2] );
1921 fparam
[3] = INT_TO_FLOAT( params
[3] );
1924 fparam
[0] = (GLfloat
) params
[0];
1925 fparam
[1] = (GLfloat
) params
[1];
1926 fparam
[2] = (GLfloat
) params
[2];
1927 fparam
[3] = (GLfloat
) params
[3];
1929 case GL_SPOT_DIRECTION
:
1930 fparam
[0] = (GLfloat
) params
[0];
1931 fparam
[1] = (GLfloat
) params
[1];
1932 fparam
[2] = (GLfloat
) params
[2];
1934 case GL_SPOT_EXPONENT
:
1935 case GL_SPOT_CUTOFF
:
1936 case GL_CONSTANT_ATTENUATION
:
1937 case GL_LINEAR_ATTENUATION
:
1938 case GL_QUADRATIC_ATTENUATION
:
1939 fparam
[0] = (GLfloat
) params
[0];
1942 /* error will be caught later in gl_Lightfv */
1945 save_Lightfv( light
, pname
, fparam
);
1949 static void save_Lighti( GLenum light
, GLenum pname
, GLint param
)
1951 save_Lightiv( light
, pname
, ¶m
);
1955 static void save_LightModelfv( GLenum pname
, const GLfloat
*params
)
1957 GET_CURRENT_CONTEXT(ctx
);
1959 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1960 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT_MODEL
, 5 );
1968 if (ctx
->ExecuteFlag
) {
1969 (*ctx
->Exec
->LightModelfv
)( pname
, params
);
1974 static void save_LightModelf( GLenum pname
, GLfloat param
)
1976 save_LightModelfv(pname
, ¶m
);
1980 static void save_LightModeliv( GLenum pname
, const GLint
*params
)
1984 case GL_LIGHT_MODEL_AMBIENT
:
1985 fparam
[0] = INT_TO_FLOAT( params
[0] );
1986 fparam
[1] = INT_TO_FLOAT( params
[1] );
1987 fparam
[2] = INT_TO_FLOAT( params
[2] );
1988 fparam
[3] = INT_TO_FLOAT( params
[3] );
1990 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
1991 case GL_LIGHT_MODEL_TWO_SIDE
:
1992 case GL_LIGHT_MODEL_COLOR_CONTROL
:
1993 fparam
[0] = (GLfloat
) params
[0];
1996 /* Error will be caught later in gl_LightModelfv */
1999 save_LightModelfv(pname
, fparam
);
2003 static void save_LightModeli( GLenum pname
, GLint param
)
2005 save_LightModeliv(pname
, ¶m
);
2009 static void save_LineStipple( GLint factor
, GLushort pattern
)
2011 GET_CURRENT_CONTEXT(ctx
);
2013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2014 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_STIPPLE
, 2 );
2019 if (ctx
->ExecuteFlag
) {
2020 (*ctx
->Exec
->LineStipple
)( factor
, pattern
);
2025 static void save_LineWidth( GLfloat width
)
2027 GET_CURRENT_CONTEXT(ctx
);
2029 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2030 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_WIDTH
, 1 );
2034 if (ctx
->ExecuteFlag
) {
2035 (*ctx
->Exec
->LineWidth
)( width
);
2040 static void save_ListBase( GLuint base
)
2042 GET_CURRENT_CONTEXT(ctx
);
2044 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2045 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIST_BASE
, 1 );
2049 if (ctx
->ExecuteFlag
) {
2050 (*ctx
->Exec
->ListBase
)( base
);
2055 static void save_LoadIdentity( void )
2057 GET_CURRENT_CONTEXT(ctx
);
2058 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2059 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_IDENTITY
, 0 );
2060 if (ctx
->ExecuteFlag
) {
2061 (*ctx
->Exec
->LoadIdentity
)();
2066 static void save_LoadMatrixf( const GLfloat
*m
)
2068 GET_CURRENT_CONTEXT(ctx
);
2070 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2071 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_MATRIX
, 16 );
2074 for (i
=0;i
<16;i
++) {
2078 if (ctx
->ExecuteFlag
) {
2079 (*ctx
->Exec
->LoadMatrixf
)( m
);
2084 static void save_LoadMatrixd( const GLdouble
*m
)
2088 for (i
= 0; i
< 16; i
++) {
2091 save_LoadMatrixf(f
);
2095 static void save_LoadName( GLuint name
)
2097 GET_CURRENT_CONTEXT(ctx
);
2099 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2100 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_NAME
, 1 );
2104 if (ctx
->ExecuteFlag
) {
2105 (*ctx
->Exec
->LoadName
)( name
);
2110 static void save_LogicOp( GLenum opcode
)
2112 GET_CURRENT_CONTEXT(ctx
);
2114 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2115 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOGIC_OP
, 1 );
2119 if (ctx
->ExecuteFlag
) {
2120 (*ctx
->Exec
->LogicOp
)( opcode
);
2125 static void save_Map1d( GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2126 GLint order
, const GLdouble
*points
)
2128 GET_CURRENT_CONTEXT(ctx
);
2130 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2131 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2133 GLfloat
*pnts
= _mesa_copy_map_points1d( target
, stride
, order
, points
);
2137 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2139 n
[6].data
= (void *) pnts
;
2141 if (ctx
->ExecuteFlag
) {
2142 (*ctx
->Exec
->Map1d
)( target
, u1
, u2
, stride
, order
, points
);
2146 static void save_Map1f( GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2147 GLint order
, const GLfloat
*points
)
2149 GET_CURRENT_CONTEXT(ctx
);
2151 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2152 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2154 GLfloat
*pnts
= _mesa_copy_map_points1f( target
, stride
, order
, points
);
2158 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2160 n
[6].data
= (void *) pnts
;
2162 if (ctx
->ExecuteFlag
) {
2163 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, stride
, order
, points
);
2168 static void save_Map2d( GLenum target
,
2169 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2170 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2171 const GLdouble
*points
)
2173 GET_CURRENT_CONTEXT(ctx
);
2175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2176 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2178 GLfloat
*pnts
= _mesa_copy_map_points2d( target
, ustride
, uorder
,
2179 vstride
, vorder
, points
);
2185 /* XXX verify these strides are correct */
2186 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2187 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2190 n
[10].data
= (void *) pnts
;
2192 if (ctx
->ExecuteFlag
) {
2193 (*ctx
->Exec
->Map2d
)( target
,
2194 u1
, u2
, ustride
, uorder
,
2195 v1
, v2
, vstride
, vorder
, points
);
2200 static void save_Map2f( GLenum target
,
2201 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2202 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2203 const GLfloat
*points
)
2205 GET_CURRENT_CONTEXT(ctx
);
2207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2208 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2210 GLfloat
*pnts
= _mesa_copy_map_points2f( target
, ustride
, uorder
,
2211 vstride
, vorder
, points
);
2217 /* XXX verify these strides are correct */
2218 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2219 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2222 n
[10].data
= (void *) pnts
;
2224 if (ctx
->ExecuteFlag
) {
2225 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
2226 v1
, v2
, vstride
, vorder
, points
);
2231 static void save_MapGrid1f( GLint un
, GLfloat u1
, GLfloat u2
)
2233 GET_CURRENT_CONTEXT(ctx
);
2235 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2236 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID1
, 3 );
2242 if (ctx
->ExecuteFlag
) {
2243 (*ctx
->Exec
->MapGrid1f
)( un
, u1
, u2
);
2248 static void save_MapGrid1d( GLint un
, GLdouble u1
, GLdouble u2
)
2250 save_MapGrid1f(un
, u1
, u2
);
2254 static void save_MapGrid2f( GLint un
, GLfloat u1
, GLfloat u2
,
2255 GLint vn
, GLfloat v1
, GLfloat v2
)
2257 GET_CURRENT_CONTEXT(ctx
);
2259 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2260 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID2
, 6 );
2269 if (ctx
->ExecuteFlag
) {
2270 (*ctx
->Exec
->MapGrid2f
)( un
, u1
, u2
, vn
, v1
, v2
);
2276 static void save_MapGrid2d( GLint un
, GLdouble u1
, GLdouble u2
,
2277 GLint vn
, GLdouble v1
, GLdouble v2
)
2279 save_MapGrid2f(un
, u1
, u2
, vn
, v1
, v2
);
2283 static void save_MatrixMode( GLenum mode
)
2285 GET_CURRENT_CONTEXT(ctx
);
2287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2288 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MATRIX_MODE
, 1 );
2292 if (ctx
->ExecuteFlag
) {
2293 (*ctx
->Exec
->MatrixMode
)( mode
);
2299 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2301 GET_CURRENT_CONTEXT(ctx
);
2304 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2305 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MIN_MAX
, 3 );
2308 n
[2].e
= internalFormat
;
2311 if (ctx
->ExecuteFlag
) {
2312 (*ctx
->Exec
->Minmax
)( target
, internalFormat
, sink
);
2317 static void save_MultMatrixf( const GLfloat
*m
)
2319 GET_CURRENT_CONTEXT(ctx
);
2321 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2322 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MULT_MATRIX
, 16 );
2325 for (i
=0;i
<16;i
++) {
2329 if (ctx
->ExecuteFlag
) {
2330 (*ctx
->Exec
->MultMatrixf
)( m
);
2335 static void save_MultMatrixd( const GLdouble
*m
)
2339 for (i
= 0; i
< 16; i
++) {
2342 save_MultMatrixf(f
);
2346 static void save_NewList( GLuint list
, GLenum mode
)
2348 GET_CURRENT_CONTEXT(ctx
);
2349 /* It's an error to call this function while building a display list */
2350 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
2357 static void save_Ortho( GLdouble left
, GLdouble right
,
2358 GLdouble bottom
, GLdouble top
,
2359 GLdouble nearval
, GLdouble farval
)
2361 GET_CURRENT_CONTEXT(ctx
);
2363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2364 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ORTHO
, 6 );
2373 if (ctx
->ExecuteFlag
) {
2374 (*ctx
->Exec
->Ortho
)( left
, right
, bottom
, top
, nearval
, farval
);
2380 save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
2382 GET_CURRENT_CONTEXT(ctx
);
2384 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2385 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_MAP
, 3 );
2389 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
2390 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
2392 if (ctx
->ExecuteFlag
) {
2393 (*ctx
->Exec
->PixelMapfv
)( map
, mapsize
, values
);
2399 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2401 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2403 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2404 for (i
=0;i
<mapsize
;i
++) {
2405 fvalues
[i
] = (GLfloat
) values
[i
];
2409 for (i
=0;i
<mapsize
;i
++) {
2410 fvalues
[i
] = UINT_TO_FLOAT( values
[i
] );
2413 save_PixelMapfv(map
, mapsize
, fvalues
);
2418 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2420 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2422 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2423 for (i
=0;i
<mapsize
;i
++) {
2424 fvalues
[i
] = (GLfloat
) values
[i
];
2428 for (i
=0;i
<mapsize
;i
++) {
2429 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2432 save_PixelMapfv(map
, mapsize
, fvalues
);
2437 save_PixelTransferf( GLenum pname
, GLfloat param
)
2439 GET_CURRENT_CONTEXT(ctx
);
2441 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2442 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2447 if (ctx
->ExecuteFlag
) {
2448 (*ctx
->Exec
->PixelTransferf
)( pname
, param
);
2454 save_PixelTransferi( GLenum pname
, GLint param
)
2456 save_PixelTransferf( pname
, (GLfloat
) param
);
2461 save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2463 GET_CURRENT_CONTEXT(ctx
);
2465 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2466 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2471 if (ctx
->ExecuteFlag
) {
2472 (*ctx
->Exec
->PixelZoom
)( xfactor
, yfactor
);
2478 save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2480 GET_CURRENT_CONTEXT(ctx
);
2482 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2483 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2490 if (ctx
->ExecuteFlag
) {
2491 (*ctx
->Exec
->PointParameterfvEXT
)( pname
, params
);
2496 static void save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2498 save_PointParameterfvEXT(pname
, ¶m
);
2502 static void save_PointSize( GLfloat size
)
2504 GET_CURRENT_CONTEXT(ctx
);
2506 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2507 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_SIZE
, 1 );
2511 if (ctx
->ExecuteFlag
) {
2512 (*ctx
->Exec
->PointSize
)( size
);
2517 static void save_PolygonMode( GLenum face
, GLenum mode
)
2519 GET_CURRENT_CONTEXT(ctx
);
2521 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2522 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_MODE
, 2 );
2527 if (ctx
->ExecuteFlag
) {
2528 (*ctx
->Exec
->PolygonMode
)( face
, mode
);
2534 * Polygon stipple must have been upacked already!
2536 static void save_PolygonStipple( const GLubyte
*pattern
)
2538 GET_CURRENT_CONTEXT(ctx
);
2540 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2541 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2544 n
[1].data
= MALLOC( 32 * 4 );
2545 data
= n
[1].data
; /* This needed for Acorn compiler */
2546 MEMCPY( data
, pattern
, 32 * 4 );
2548 if (ctx
->ExecuteFlag
) {
2549 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) pattern
);
2554 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2556 GET_CURRENT_CONTEXT(ctx
);
2558 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2559 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2564 if (ctx
->ExecuteFlag
) {
2565 (*ctx
->Exec
->PolygonOffset
)( factor
, units
);
2570 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2572 GET_CURRENT_CONTEXT(ctx
);
2573 save_PolygonOffset(factor
, ctx
->DepthMaxF
* bias
);
2577 static void save_PopAttrib( void )
2579 GET_CURRENT_CONTEXT(ctx
);
2580 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2581 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_ATTRIB
, 0 );
2582 if (ctx
->ExecuteFlag
) {
2583 (*ctx
->Exec
->PopAttrib
)();
2588 static void save_PopMatrix( void )
2590 GET_CURRENT_CONTEXT(ctx
);
2591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2592 FLUSH_CURRENT(ctx
, 0);
2593 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_MATRIX
, 0 );
2594 if (ctx
->ExecuteFlag
) {
2595 (*ctx
->Exec
->PopMatrix
)();
2600 static void save_PopName( void )
2602 GET_CURRENT_CONTEXT(ctx
);
2603 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2604 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_NAME
, 0 );
2605 if (ctx
->ExecuteFlag
) {
2606 (*ctx
->Exec
->PopName
)();
2611 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2612 const GLclampf
*priorities
)
2614 GET_CURRENT_CONTEXT(ctx
);
2616 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2618 for (i
=0;i
<num
;i
++) {
2620 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2622 n
[1].ui
= textures
[i
];
2623 n
[2].f
= priorities
[i
];
2626 if (ctx
->ExecuteFlag
) {
2627 (*ctx
->Exec
->PrioritizeTextures
)( num
, textures
, priorities
);
2632 static void save_PushAttrib( GLbitfield mask
)
2634 GET_CURRENT_CONTEXT(ctx
);
2636 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2637 FLUSH_CURRENT(ctx
, 0);
2638 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2642 if (ctx
->ExecuteFlag
) {
2643 (*ctx
->Exec
->PushAttrib
)( mask
);
2648 static void save_PushMatrix( void )
2650 GET_CURRENT_CONTEXT(ctx
);
2651 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2652 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2653 if (ctx
->ExecuteFlag
) {
2654 (*ctx
->Exec
->PushMatrix
)();
2659 static void save_PushName( GLuint name
)
2661 GET_CURRENT_CONTEXT(ctx
);
2663 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2664 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_NAME
, 1 );
2668 if (ctx
->ExecuteFlag
) {
2669 (*ctx
->Exec
->PushName
)( name
);
2674 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2676 GET_CURRENT_CONTEXT(ctx
);
2678 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2679 FLUSH_CURRENT(ctx
, 0);
2680 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RASTER_POS
, 4 );
2687 if (ctx
->ExecuteFlag
) {
2688 (*ctx
->Exec
->RasterPos4f
)( x
, y
, z
, w
);
2692 static void save_RasterPos2d(GLdouble x
, GLdouble y
)
2694 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2697 static void save_RasterPos2f(GLfloat x
, GLfloat y
)
2699 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2702 static void save_RasterPos2i(GLint x
, GLint y
)
2704 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2707 static void save_RasterPos2s(GLshort x
, GLshort y
)
2709 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2712 static void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2714 save_RasterPos4f(x
, y
, z
, 1.0F
);
2717 static void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2719 save_RasterPos4f(x
, y
, z
, 1.0F
);
2722 static void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2724 save_RasterPos4f(x
, y
, z
, 1.0F
);
2727 static void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2729 save_RasterPos4f(x
, y
, z
, 1.0F
);
2732 static void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2734 save_RasterPos4f(x
, y
, z
, w
);
2737 static void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2739 save_RasterPos4f(x
, y
, z
, w
);
2742 static void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2744 save_RasterPos4f(x
, y
, z
, w
);
2747 static void save_RasterPos2dv(const GLdouble
*v
)
2749 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2752 static void save_RasterPos2fv(const GLfloat
*v
)
2754 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2757 static void save_RasterPos2iv(const GLint
*v
)
2759 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2762 static void save_RasterPos2sv(const GLshort
*v
)
2764 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2767 static void save_RasterPos3dv(const GLdouble
*v
)
2769 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2772 static void save_RasterPos3fv(const GLfloat
*v
)
2774 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2777 static void save_RasterPos3iv(const GLint
*v
)
2779 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2782 static void save_RasterPos3sv(const GLshort
*v
)
2784 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2787 static void save_RasterPos4dv(const GLdouble
*v
)
2789 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2792 static void save_RasterPos4fv(const GLfloat
*v
)
2794 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2797 static void save_RasterPos4iv(const GLint
*v
)
2799 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2802 static void save_RasterPos4sv(const GLshort
*v
)
2804 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2808 static void save_PassThrough( GLfloat token
)
2810 GET_CURRENT_CONTEXT(ctx
);
2812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2813 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PASSTHROUGH
, 1 );
2817 if (ctx
->ExecuteFlag
) {
2818 (*ctx
->Exec
->PassThrough
)( token
);
2823 static void save_ReadBuffer( GLenum mode
)
2825 GET_CURRENT_CONTEXT(ctx
);
2827 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2828 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_READ_BUFFER
, 1 );
2832 if (ctx
->ExecuteFlag
) {
2833 (*ctx
->Exec
->ReadBuffer
)( mode
);
2839 save_ResetHistogram(GLenum target
)
2841 GET_CURRENT_CONTEXT(ctx
);
2843 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2844 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_HISTOGRAM
, 1 );
2848 if (ctx
->ExecuteFlag
) {
2849 (*ctx
->Exec
->ResetHistogram
)( target
);
2855 save_ResetMinmax(GLenum target
)
2857 GET_CURRENT_CONTEXT(ctx
);
2859 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2860 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_MIN_MAX
, 1 );
2864 if (ctx
->ExecuteFlag
) {
2865 (*ctx
->Exec
->ResetMinmax
)( target
);
2870 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2872 GET_CURRENT_CONTEXT(ctx
);
2874 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2875 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ROTATE
, 4 );
2882 if (ctx
->ExecuteFlag
) {
2883 (*ctx
->Exec
->Rotatef
)( angle
, x
, y
, z
);
2888 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2890 save_Rotatef(angle
, x
, y
, z
);
2894 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2896 GET_CURRENT_CONTEXT(ctx
);
2898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2899 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCALE
, 3 );
2905 if (ctx
->ExecuteFlag
) {
2906 (*ctx
->Exec
->Scalef
)( x
, y
, z
);
2911 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
2913 save_Scalef(x
, y
, z
);
2917 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
2919 GET_CURRENT_CONTEXT(ctx
);
2921 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2922 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCISSOR
, 4 );
2929 if (ctx
->ExecuteFlag
) {
2930 (*ctx
->Exec
->Scissor
)( x
, y
, width
, height
);
2935 static void save_ShadeModel( GLenum mode
)
2937 GET_CURRENT_CONTEXT(ctx
);
2939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2940 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SHADE_MODEL
, 1 );
2944 if (ctx
->ExecuteFlag
) {
2945 (*ctx
->Exec
->ShadeModel
)( mode
);
2950 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
2952 GET_CURRENT_CONTEXT(ctx
);
2954 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2955 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_FUNC
, 3 );
2961 if (ctx
->ExecuteFlag
) {
2962 (*ctx
->Exec
->StencilFunc
)( func
, ref
, mask
);
2967 static void save_StencilMask( GLuint mask
)
2969 GET_CURRENT_CONTEXT(ctx
);
2971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2972 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_MASK
, 1 );
2976 if (ctx
->ExecuteFlag
) {
2977 (*ctx
->Exec
->StencilMask
)( mask
);
2982 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
2984 GET_CURRENT_CONTEXT(ctx
);
2986 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2987 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_OP
, 3 );
2993 if (ctx
->ExecuteFlag
) {
2994 (*ctx
->Exec
->StencilOp
)( fail
, zfail
, zpass
);
2999 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
3001 GET_CURRENT_CONTEXT(ctx
);
3003 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3004 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXENV
, 6 );
3013 if (ctx
->ExecuteFlag
) {
3014 (*ctx
->Exec
->TexEnvfv
)( target
, pname
, params
);
3019 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
3021 save_TexEnvfv( target
, pname
, ¶m
);
3025 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
3028 p
[0] = (GLfloat
) param
;
3029 p
[1] = p
[2] = p
[3] = 0.0;
3030 save_TexEnvfv( target
, pname
, p
);
3034 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
3037 p
[0] = INT_TO_FLOAT( param
[0] );
3038 p
[1] = INT_TO_FLOAT( param
[1] );
3039 p
[2] = INT_TO_FLOAT( param
[2] );
3040 p
[3] = INT_TO_FLOAT( param
[3] );
3041 save_TexEnvfv( target
, pname
, p
);
3045 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
3047 GET_CURRENT_CONTEXT(ctx
);
3049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3050 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXGEN
, 6 );
3059 if (ctx
->ExecuteFlag
) {
3060 (*ctx
->Exec
->TexGenfv
)( coord
, pname
, params
);
3065 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3072 save_TexGenfv(coord
, pname
, p
);
3076 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3078 GLfloat p
= (GLfloat
) param
;
3079 save_TexGenfv( coord
, pname
, &p
);
3083 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3090 save_TexGenfv( coord
, pname
, p
);
3094 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
3096 save_TexGenfv(coord
, pname
, ¶m
);
3100 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
3102 save_TexGeniv( coord
, pname
, ¶m
);
3106 static void save_TexParameterfv( GLenum target
,
3107 GLenum pname
, const GLfloat
*params
)
3109 GET_CURRENT_CONTEXT(ctx
);
3111 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3112 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXPARAMETER
, 6 );
3121 if (ctx
->ExecuteFlag
) {
3122 (*ctx
->Exec
->TexParameterfv
)( target
, pname
, params
);
3127 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
3129 save_TexParameterfv(target
, pname
, ¶m
);
3133 static void save_TexParameteri( GLenum target
, GLenum pname
, const GLint param
)
3136 fparam
[0] = (GLfloat
) param
;
3137 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3138 save_TexParameterfv(target
, pname
, fparam
);
3142 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
3145 fparam
[0] = (GLfloat
) params
[0];
3146 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3147 save_TexParameterfv(target
, pname
, fparam
);
3151 static void save_TexImage1D( GLenum target
,
3152 GLint level
, GLint components
,
3153 GLsizei width
, GLint border
,
3154 GLenum format
, GLenum type
,
3155 const GLvoid
*pixels
)
3157 GET_CURRENT_CONTEXT(ctx
);
3158 if (target
== GL_PROXY_TEXTURE_1D
) {
3159 /* don't compile, execute immediately */
3160 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3161 border
, format
, type
, pixels
);
3164 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3165 pixels
, &ctx
->Unpack
);
3167 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3168 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
3172 n
[3].i
= components
;
3173 n
[4].i
= (GLint
) width
;
3182 if (ctx
->ExecuteFlag
) {
3183 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3184 border
, format
, type
, pixels
);
3190 static void save_TexImage2D( GLenum target
,
3191 GLint level
, GLint components
,
3192 GLsizei width
, GLsizei height
, GLint border
,
3193 GLenum format
, GLenum type
,
3194 const GLvoid
*pixels
)
3196 GET_CURRENT_CONTEXT(ctx
);
3197 if (target
== GL_PROXY_TEXTURE_2D
) {
3198 /* don't compile, execute immediately */
3199 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3200 height
, border
, format
, type
, pixels
);
3203 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3204 pixels
, &ctx
->Unpack
);
3206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3207 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
3211 n
[3].i
= components
;
3212 n
[4].i
= (GLint
) width
;
3213 n
[5].i
= (GLint
) height
;
3222 if (ctx
->ExecuteFlag
) {
3223 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3224 height
, border
, format
, type
, pixels
);
3230 static void save_TexImage3D( GLenum target
,
3231 GLint level
, GLenum internalFormat
,
3232 GLsizei width
, GLsizei height
, GLsizei depth
,
3234 GLenum format
, GLenum type
,
3235 const GLvoid
*pixels
)
3237 GET_CURRENT_CONTEXT(ctx
);
3238 if (target
== GL_PROXY_TEXTURE_3D
) {
3239 /* don't compile, execute immediately */
3240 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3241 height
, depth
, border
, format
, type
, pixels
);
3245 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3246 pixels
, &ctx
->Unpack
);
3247 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3248 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
3252 n
[3].i
= (GLint
) internalFormat
;
3253 n
[4].i
= (GLint
) width
;
3254 n
[5].i
= (GLint
) height
;
3255 n
[6].i
= (GLint
) depth
;
3264 if (ctx
->ExecuteFlag
) {
3265 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3266 height
, depth
, border
, format
, type
, pixels
);
3272 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
3273 GLsizei width
, GLenum format
, GLenum type
,
3274 const GLvoid
*pixels
)
3276 GET_CURRENT_CONTEXT(ctx
);
3278 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3279 pixels
, &ctx
->Unpack
);
3280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3281 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
3286 n
[4].i
= (GLint
) width
;
3294 if (ctx
->ExecuteFlag
) {
3295 (*ctx
->Exec
->TexSubImage1D
)( target
, level
, xoffset
, width
,
3296 format
, type
, pixels
);
3301 static void save_TexSubImage2D( GLenum target
, GLint level
,
3302 GLint xoffset
, GLint yoffset
,
3303 GLsizei width
, GLsizei height
,
3304 GLenum format
, GLenum type
,
3305 const GLvoid
*pixels
)
3307 GET_CURRENT_CONTEXT(ctx
);
3309 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3310 pixels
, &ctx
->Unpack
);
3311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3312 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
3318 n
[5].i
= (GLint
) width
;
3319 n
[6].i
= (GLint
) height
;
3327 if (ctx
->ExecuteFlag
) {
3328 (*ctx
->Exec
->TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
3329 width
, height
, format
, type
, pixels
);
3334 static void save_TexSubImage3D( GLenum target
, GLint level
,
3335 GLint xoffset
, GLint yoffset
,GLint zoffset
,
3336 GLsizei width
, GLsizei height
, GLsizei depth
,
3337 GLenum format
, GLenum type
,
3338 const GLvoid
*pixels
)
3340 GET_CURRENT_CONTEXT(ctx
);
3342 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3343 pixels
, &ctx
->Unpack
);
3344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3345 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
3352 n
[6].i
= (GLint
) width
;
3353 n
[7].i
= (GLint
) height
;
3354 n
[8].i
= (GLint
) depth
;
3362 if (ctx
->ExecuteFlag
) {
3363 (*ctx
->Exec
->TexSubImage3D
)( target
, level
,
3364 xoffset
, yoffset
, zoffset
,
3365 width
, height
, depth
, format
, type
, pixels
);
3370 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
3372 GET_CURRENT_CONTEXT(ctx
);
3374 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3375 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRANSLATE
, 3 );
3381 if (ctx
->ExecuteFlag
) {
3382 (*ctx
->Exec
->Translatef
)( x
, y
, z
);
3387 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3389 save_Translatef(x
, y
, z
);
3394 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3396 GET_CURRENT_CONTEXT(ctx
);
3398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3399 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_VIEWPORT
, 4 );
3403 n
[3].i
= (GLint
) width
;
3404 n
[4].i
= (GLint
) height
;
3406 if (ctx
->ExecuteFlag
) {
3407 (*ctx
->Exec
->Viewport
)( x
, y
, width
, height
);
3412 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3414 GET_CURRENT_CONTEXT(ctx
);
3416 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3417 FLUSH_CURRENT(ctx
, 0);
3418 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_WINDOW_POS
, 4 );
3425 if (ctx
->ExecuteFlag
) {
3426 (*ctx
->Exec
->WindowPos4fMESA
)( x
, y
, z
, w
);
3430 static void save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3432 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3435 static void save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3437 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3440 static void save_WindowPos2iMESA(GLint x
, GLint y
)
3442 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3445 static void save_WindowPos2sMESA(GLshort x
, GLshort y
)
3447 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3450 static void save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3452 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3455 static void save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3457 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3460 static void save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3462 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3465 static void save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3467 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3470 static void save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3472 save_WindowPos4fMESA(x
, y
, z
, w
);
3475 static void save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3477 save_WindowPos4fMESA(x
, y
, z
, w
);
3480 static void save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3482 save_WindowPos4fMESA(x
, y
, z
, w
);
3485 static void save_WindowPos2dvMESA(const GLdouble
*v
)
3487 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3490 static void save_WindowPos2fvMESA(const GLfloat
*v
)
3492 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3495 static void save_WindowPos2ivMESA(const GLint
*v
)
3497 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3500 static void save_WindowPos2svMESA(const GLshort
*v
)
3502 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3505 static void save_WindowPos3dvMESA(const GLdouble
*v
)
3507 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3510 static void save_WindowPos3fvMESA(const GLfloat
*v
)
3512 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3515 static void save_WindowPos3ivMESA(const GLint
*v
)
3517 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3520 static void save_WindowPos3svMESA(const GLshort
*v
)
3522 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3525 static void save_WindowPos4dvMESA(const GLdouble
*v
)
3527 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3530 static void save_WindowPos4fvMESA(const GLfloat
*v
)
3532 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3535 static void save_WindowPos4ivMESA(const GLint
*v
)
3537 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3540 static void save_WindowPos4svMESA(const GLshort
*v
)
3542 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3547 /* GL_ARB_multitexture */
3548 static void save_ActiveTextureARB( GLenum target
)
3550 GET_CURRENT_CONTEXT(ctx
);
3552 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3553 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3557 if (ctx
->ExecuteFlag
) {
3558 (*ctx
->Exec
->ActiveTextureARB
)( target
);
3563 /* GL_ARB_multitexture */
3564 static void save_ClientActiveTextureARB( GLenum target
)
3566 GET_CURRENT_CONTEXT(ctx
);
3568 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3569 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLIENT_ACTIVE_TEXTURE
, 1 );
3573 if (ctx
->ExecuteFlag
) {
3574 (*ctx
->Exec
->ClientActiveTextureARB
)( target
);
3580 /* GL_ARB_transpose_matrix */
3582 static void save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3585 _math_transposefd(tm
, m
);
3586 save_LoadMatrixf(tm
);
3590 static void save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3593 _math_transposef(tm
, m
);
3594 save_LoadMatrixf(tm
);
3599 save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3602 _math_transposefd(tm
, m
);
3603 save_MultMatrixf(tm
);
3608 save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3611 _math_transposef(tm
, m
);
3612 save_MultMatrixf(tm
);
3617 save_PixelTexGenSGIX(GLenum mode
)
3619 GET_CURRENT_CONTEXT(ctx
);
3621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3622 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_SGIX
, 1 );
3626 if (ctx
->ExecuteFlag
) {
3627 (*ctx
->Exec
->PixelTexGenSGIX
)( mode
);
3632 /* GL_ARB_texture_compression */
3634 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3635 GLenum internalFormat
, GLsizei width
,
3636 GLint border
, GLsizei imageSize
,
3639 GET_CURRENT_CONTEXT(ctx
);
3640 if (target
== GL_PROXY_TEXTURE_1D
) {
3641 /* don't compile, execute immediately */
3642 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3643 width
, border
, imageSize
, data
);
3648 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3649 /* make copy of image */
3650 image
= MALLOC(imageSize
);
3652 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3655 MEMCPY(image
, data
, imageSize
);
3656 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 8 );
3660 n
[3].e
= internalFormat
;
3661 n
[4].i
= (GLint
) width
;
3669 if (ctx
->ExecuteFlag
) {
3670 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3671 width
, border
, imageSize
, data
);
3678 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
3679 GLenum internalFormat
, GLsizei width
,
3680 GLsizei height
, GLint border
, GLsizei imageSize
,
3683 GET_CURRENT_CONTEXT(ctx
);
3684 if (target
== GL_PROXY_TEXTURE_2D
) {
3685 /* don't compile, execute immediately */
3686 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3687 width
, height
, border
, imageSize
, data
);
3692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3693 /* make copy of image */
3694 image
= MALLOC(imageSize
);
3696 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
3699 MEMCPY(image
, data
, imageSize
);
3700 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 9 );
3704 n
[3].e
= internalFormat
;
3705 n
[4].i
= (GLint
) width
;
3706 n
[5].i
= (GLint
) height
;
3714 if (ctx
->ExecuteFlag
) {
3715 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3716 width
, height
, border
, imageSize
, data
);
3723 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
3724 GLenum internalFormat
, GLsizei width
,
3725 GLsizei height
, GLsizei depth
, GLint border
,
3726 GLsizei imageSize
, const GLvoid
*data
)
3728 GET_CURRENT_CONTEXT(ctx
);
3729 if (target
== GL_PROXY_TEXTURE_3D
) {
3730 /* don't compile, execute immediately */
3731 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3732 width
, height
, depth
, border
, imageSize
, data
);
3737 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3738 /* make copy of image */
3739 image
= MALLOC(imageSize
);
3741 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
3744 MEMCPY(image
, data
, imageSize
);
3745 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 10 );
3749 n
[3].e
= internalFormat
;
3750 n
[4].i
= (GLint
) width
;
3751 n
[5].i
= (GLint
) height
;
3752 n
[6].i
= (GLint
) depth
;
3760 if (ctx
->ExecuteFlag
) {
3761 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3762 width
, height
, depth
, border
, imageSize
, data
);
3769 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
3770 GLsizei width
, GLenum format
,
3771 GLsizei imageSize
, const GLvoid
*data
)
3776 GET_CURRENT_CONTEXT(ctx
);
3777 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3779 /* make copy of image */
3780 image
= MALLOC(imageSize
);
3782 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
3785 MEMCPY(image
, data
, imageSize
);
3786 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 8 );
3791 n
[4].i
= (GLint
) width
;
3799 if (ctx
->ExecuteFlag
) {
3800 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(target
, level
, xoffset
,
3801 width
, format
, imageSize
, data
);
3807 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
3808 GLint yoffset
, GLsizei width
, GLsizei height
,
3809 GLenum format
, GLsizei imageSize
,
3815 GET_CURRENT_CONTEXT(ctx
);
3816 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3818 /* make copy of image */
3819 image
= MALLOC(imageSize
);
3821 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
3824 MEMCPY(image
, data
, imageSize
);
3825 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 10 );
3831 n
[5].i
= (GLint
) width
;
3832 n
[6].i
= (GLint
) height
;
3840 if (ctx
->ExecuteFlag
) {
3841 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(target
, level
, xoffset
, yoffset
,
3842 width
, height
, format
, imageSize
, data
);
3848 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
3849 GLint yoffset
, GLint zoffset
, GLsizei width
,
3850 GLsizei height
, GLsizei depth
, GLenum format
,
3851 GLsizei imageSize
, const GLvoid
*data
)
3856 GET_CURRENT_CONTEXT(ctx
);
3857 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3859 /* make copy of image */
3860 image
= MALLOC(imageSize
);
3862 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
3865 MEMCPY(image
, data
, imageSize
);
3866 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 12 );
3873 n
[6].i
= (GLint
) width
;
3874 n
[7].i
= (GLint
) height
;
3875 n
[8].i
= (GLint
) depth
;
3877 n
[10].i
= imageSize
;
3883 if (ctx
->ExecuteFlag
) {
3884 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(target
, level
, xoffset
, yoffset
,
3885 zoffset
, width
, height
, depth
, format
, imageSize
, data
);
3890 /* GL_SGIS_pixel_texture */
3893 save_PixelTexGenParameteriSGIS(GLenum target
, GLint value
)
3895 GET_CURRENT_CONTEXT(ctx
);
3897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3898 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
, 2 );
3903 if (ctx
->ExecuteFlag
) {
3904 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( target
, value
);
3910 save_PixelTexGenParameterfSGIS(GLenum target
, GLfloat value
)
3912 save_PixelTexGenParameteriSGIS(target
, (GLint
) value
);
3917 save_PixelTexGenParameterivSGIS(GLenum target
, const GLint
*value
)
3919 save_PixelTexGenParameteriSGIS(target
, *value
);
3924 save_PixelTexGenParameterfvSGIS(GLenum target
, const GLfloat
*value
)
3926 save_PixelTexGenParameteriSGIS(target
, (GLint
) *value
);
3930 /* KW: Compile commands
3932 * Will appear in the list before the vertex buffer containing the
3933 * command that provoked the error. I don't see this as a problem.
3936 _mesa_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
3939 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ERROR
, 2 );
3942 n
[2].data
= (void *) s
;
3944 /* execute already done */
3949 islist(GLcontext
*ctx
, GLuint list
)
3951 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
3961 /**********************************************************************/
3962 /* Display list execution */
3963 /**********************************************************************/
3967 * Execute a display list. Note that the ListBase offset must have already
3968 * been added before calling this function. I.e. the list argument is
3969 * the absolute list number, not relative to ListBase.
3970 * Input: list - display list number
3973 execute_list( GLcontext
*ctx
, GLuint list
)
3978 if (!islist(ctx
,list
))
3981 if (ctx
->Driver
.BeginCallList
)
3982 ctx
->Driver
.BeginCallList( ctx
, list
);
3984 /* fprintf(stderr, "execute list %d\n", list); */
3985 /* mesa_print_display_list( list ); */
3989 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
3993 OpCode opcode
= n
[0].opcode
;
3994 int i
= (int)n
[0].opcode
- (int)OPCODE_DRV_0
;
3996 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
3997 ctx
->listext
.opcode
[i
].execute(ctx
, &n
[1]);
3998 n
+= ctx
->listext
.opcode
[i
].size
;
4003 _mesa_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
4006 (*ctx
->Exec
->Accum
)( n
[1].e
, n
[2].f
);
4008 case OPCODE_ALPHA_FUNC
:
4009 (*ctx
->Exec
->AlphaFunc
)( n
[1].e
, n
[2].f
);
4011 case OPCODE_BIND_TEXTURE
:
4012 (*ctx
->Exec
->BindTexture
)( n
[1].e
, n
[2].ui
);
4016 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4017 ctx
->Unpack
= _mesa_native_packing
;
4018 (*ctx
->Exec
->Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
4019 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (const GLubyte
*) n
[7].data
);
4020 ctx
->Unpack
= save
; /* restore */
4023 case OPCODE_BLEND_COLOR
:
4024 (*ctx
->Exec
->BlendColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4026 case OPCODE_BLEND_EQUATION
:
4027 (*ctx
->Exec
->BlendEquation
)( n
[1].e
);
4029 case OPCODE_BLEND_FUNC
:
4030 (*ctx
->Exec
->BlendFunc
)( n
[1].e
, n
[2].e
);
4032 case OPCODE_BLEND_FUNC_SEPARATE
:
4033 (*ctx
->Exec
->BlendFuncSeparateEXT
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
4035 case OPCODE_CALL_LIST
:
4036 /* Generated by glCallList(), don't add ListBase */
4037 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4038 execute_list( ctx
, n
[1].ui
);
4041 case OPCODE_CALL_LIST_OFFSET
:
4042 /* Generated by glCallLists() so we must add ListBase */
4043 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4044 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
4048 (*ctx
->Exec
->Clear
)( n
[1].bf
);
4050 case OPCODE_CLEAR_COLOR
:
4051 (*ctx
->Exec
->ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4053 case OPCODE_CLEAR_ACCUM
:
4054 (*ctx
->Exec
->ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4056 case OPCODE_CLEAR_DEPTH
:
4057 (*ctx
->Exec
->ClearDepth
)( (GLclampd
) n
[1].f
);
4059 case OPCODE_CLEAR_INDEX
:
4060 (*ctx
->Exec
->ClearIndex
)( n
[1].ui
);
4062 case OPCODE_CLEAR_STENCIL
:
4063 (*ctx
->Exec
->ClearStencil
)( n
[1].i
);
4065 case OPCODE_CLIP_PLANE
:
4072 (*ctx
->Exec
->ClipPlane
)( n
[1].e
, eq
);
4075 case OPCODE_COLOR_MASK
:
4076 (*ctx
->Exec
->ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
4078 case OPCODE_COLOR_MATERIAL
:
4079 (*ctx
->Exec
->ColorMaterial
)( n
[1].e
, n
[2].e
);
4081 case OPCODE_COLOR_TABLE
:
4083 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4084 ctx
->Unpack
= _mesa_native_packing
;
4085 (*ctx
->Exec
->ColorTable
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
4086 n
[5].e
, n
[6].data
);
4087 ctx
->Unpack
= save
; /* restore */
4090 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
4097 (*ctx
->Exec
->ColorTableParameterfv
)( n
[1].e
, n
[2].e
, params
);
4100 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
4107 (*ctx
->Exec
->ColorTableParameteriv
)( n
[1].e
, n
[2].e
, params
);
4110 case OPCODE_COLOR_SUB_TABLE
:
4112 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4113 ctx
->Unpack
= _mesa_native_packing
;
4114 (*ctx
->Exec
->ColorSubTable
)( n
[1].e
, n
[2].i
, n
[3].i
,
4115 n
[4].e
, n
[5].e
, n
[6].data
);
4116 ctx
->Unpack
= save
; /* restore */
4119 case OPCODE_CONVOLUTION_FILTER_1D
:
4121 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4122 ctx
->Unpack
= _mesa_native_packing
;
4123 (*ctx
->Exec
->ConvolutionFilter1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4124 n
[4].e
, n
[5].e
, n
[6].data
);
4125 ctx
->Unpack
= save
; /* restore */
4128 case OPCODE_CONVOLUTION_FILTER_2D
:
4130 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4131 ctx
->Unpack
= _mesa_native_packing
;
4132 (*ctx
->Exec
->ConvolutionFilter2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4133 n
[4].i
, n
[5].e
, n
[6].e
, n
[7].data
);
4134 ctx
->Unpack
= save
; /* restore */
4137 case OPCODE_CONVOLUTION_PARAMETER_I
:
4138 (*ctx
->Exec
->ConvolutionParameteri
)( n
[1].e
, n
[2].e
, n
[3].i
);
4140 case OPCODE_CONVOLUTION_PARAMETER_IV
:
4147 (*ctx
->Exec
->ConvolutionParameteriv
)( n
[1].e
, n
[2].e
, params
);
4150 case OPCODE_CONVOLUTION_PARAMETER_F
:
4151 (*ctx
->Exec
->ConvolutionParameterf
)( n
[1].e
, n
[2].e
, n
[3].f
);
4153 case OPCODE_CONVOLUTION_PARAMETER_FV
:
4160 (*ctx
->Exec
->ConvolutionParameterfv
)( n
[1].e
, n
[2].e
, params
);
4163 case OPCODE_COPY_COLOR_SUB_TABLE
:
4164 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4165 n
[3].i
, n
[4].i
, n
[5].i
);
4167 case OPCODE_COPY_COLOR_TABLE
:
4168 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4169 n
[3].i
, n
[4].i
, n
[5].i
);
4171 case OPCODE_COPY_PIXELS
:
4172 (*ctx
->Exec
->CopyPixels
)( n
[1].i
, n
[2].i
,
4173 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
4175 case OPCODE_COPY_TEX_IMAGE1D
:
4176 (*ctx
->Exec
->CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4177 n
[5].i
, n
[6].i
, n
[7].i
);
4179 case OPCODE_COPY_TEX_IMAGE2D
:
4180 (*ctx
->Exec
->CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4181 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4183 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
4184 (*ctx
->Exec
->CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4185 n
[4].i
, n
[5].i
, n
[6].i
);
4187 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
4188 (*ctx
->Exec
->CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4189 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4191 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
4192 (*ctx
->Exec
->CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4193 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
4195 case OPCODE_CULL_FACE
:
4196 (*ctx
->Exec
->CullFace
)( n
[1].e
);
4198 case OPCODE_DEPTH_FUNC
:
4199 (*ctx
->Exec
->DepthFunc
)( n
[1].e
);
4201 case OPCODE_DEPTH_MASK
:
4202 (*ctx
->Exec
->DepthMask
)( n
[1].b
);
4204 case OPCODE_DEPTH_RANGE
:
4205 (*ctx
->Exec
->DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
4207 case OPCODE_DISABLE
:
4208 (*ctx
->Exec
->Disable
)( n
[1].e
);
4210 case OPCODE_DRAW_BUFFER
:
4211 (*ctx
->Exec
->DrawBuffer
)( n
[1].e
);
4213 case OPCODE_DRAW_PIXELS
:
4215 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4216 ctx
->Unpack
= _mesa_native_packing
;
4217 (*ctx
->Exec
->DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
4219 ctx
->Unpack
= save
; /* restore */
4223 (*ctx
->Exec
->Enable
)( n
[1].e
);
4225 case OPCODE_EVALMESH1
:
4226 (*ctx
->Exec
->EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
4228 case OPCODE_EVALMESH2
:
4229 (*ctx
->Exec
->EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
4238 (*ctx
->Exec
->Fogfv
)( n
[1].e
, p
);
4241 case OPCODE_FRONT_FACE
:
4242 (*ctx
->Exec
->FrontFace
)( n
[1].e
);
4244 case OPCODE_FRUSTUM
:
4245 (*ctx
->Exec
->Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4248 (*ctx
->Exec
->Hint
)( n
[1].e
, n
[2].e
);
4250 case OPCODE_HISTOGRAM
:
4251 (*ctx
->Exec
->Histogram
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
);
4253 case OPCODE_INDEX_MASK
:
4254 (*ctx
->Exec
->IndexMask
)( n
[1].ui
);
4256 case OPCODE_INIT_NAMES
:
4257 (*ctx
->Exec
->InitNames
)();
4266 (*ctx
->Exec
->Lightfv
)( n
[1].e
, n
[2].e
, p
);
4269 case OPCODE_LIGHT_MODEL
:
4276 (*ctx
->Exec
->LightModelfv
)( n
[1].e
, p
);
4279 case OPCODE_LINE_STIPPLE
:
4280 (*ctx
->Exec
->LineStipple
)( n
[1].i
, n
[2].us
);
4282 case OPCODE_LINE_WIDTH
:
4283 (*ctx
->Exec
->LineWidth
)( n
[1].f
);
4285 case OPCODE_LIST_BASE
:
4286 (*ctx
->Exec
->ListBase
)( n
[1].ui
);
4288 case OPCODE_LOAD_IDENTITY
:
4289 (*ctx
->Exec
->LoadIdentity
)();
4291 case OPCODE_LOAD_MATRIX
:
4292 if (sizeof(Node
)==sizeof(GLfloat
)) {
4293 (*ctx
->Exec
->LoadMatrixf
)( &n
[1].f
);
4298 for (i
=0;i
<16;i
++) {
4301 (*ctx
->Exec
->LoadMatrixf
)( m
);
4304 case OPCODE_LOAD_NAME
:
4305 (*ctx
->Exec
->LoadName
)( n
[1].ui
);
4307 case OPCODE_LOGIC_OP
:
4308 (*ctx
->Exec
->LogicOp
)( n
[1].e
);
4312 GLenum target
= n
[1].e
;
4313 GLint ustride
= _mesa_evaluator_components(target
);
4314 GLint uorder
= n
[5].i
;
4315 GLfloat u1
= n
[2].f
;
4316 GLfloat u2
= n
[3].f
;
4317 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, ustride
, uorder
,
4318 (GLfloat
*) n
[6].data
);
4323 GLenum target
= n
[1].e
;
4324 GLfloat u1
= n
[2].f
;
4325 GLfloat u2
= n
[3].f
;
4326 GLfloat v1
= n
[4].f
;
4327 GLfloat v2
= n
[5].f
;
4328 GLint ustride
= n
[6].i
;
4329 GLint vstride
= n
[7].i
;
4330 GLint uorder
= n
[8].i
;
4331 GLint vorder
= n
[9].i
;
4332 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
4333 v1
, v2
, vstride
, vorder
,
4334 (GLfloat
*) n
[10].data
);
4337 case OPCODE_MAPGRID1
:
4338 (*ctx
->Exec
->MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
4340 case OPCODE_MAPGRID2
:
4341 (*ctx
->Exec
->MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
4343 case OPCODE_MATRIX_MODE
:
4344 (*ctx
->Exec
->MatrixMode
)( n
[1].e
);
4346 case OPCODE_MIN_MAX
:
4347 (*ctx
->Exec
->Minmax
)(n
[1].e
, n
[2].e
, n
[3].b
);
4349 case OPCODE_MULT_MATRIX
:
4350 if (sizeof(Node
)==sizeof(GLfloat
)) {
4351 (*ctx
->Exec
->MultMatrixf
)( &n
[1].f
);
4356 for (i
=0;i
<16;i
++) {
4359 (*ctx
->Exec
->MultMatrixf
)( m
);
4363 (*ctx
->Exec
->Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4365 case OPCODE_PASSTHROUGH
:
4366 (*ctx
->Exec
->PassThrough
)( n
[1].f
);
4368 case OPCODE_PIXEL_MAP
:
4369 (*ctx
->Exec
->PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
4371 case OPCODE_PIXEL_TRANSFER
:
4372 (*ctx
->Exec
->PixelTransferf
)( n
[1].e
, n
[2].f
);
4374 case OPCODE_PIXEL_ZOOM
:
4375 (*ctx
->Exec
->PixelZoom
)( n
[1].f
, n
[2].f
);
4377 case OPCODE_POINT_SIZE
:
4378 (*ctx
->Exec
->PointSize
)( n
[1].f
);
4380 case OPCODE_POINT_PARAMETERS
:
4386 (*ctx
->Exec
->PointParameterfvEXT
)( n
[1].e
, params
);
4389 case OPCODE_POLYGON_MODE
:
4390 (*ctx
->Exec
->PolygonMode
)( n
[1].e
, n
[2].e
);
4392 case OPCODE_POLYGON_STIPPLE
:
4393 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) n
[1].data
);
4395 case OPCODE_POLYGON_OFFSET
:
4396 (*ctx
->Exec
->PolygonOffset
)( n
[1].f
, n
[2].f
);
4398 case OPCODE_POP_ATTRIB
:
4399 (*ctx
->Exec
->PopAttrib
)();
4401 case OPCODE_POP_MATRIX
:
4402 (*ctx
->Exec
->PopMatrix
)();
4404 case OPCODE_POP_NAME
:
4405 (*ctx
->Exec
->PopName
)();
4407 case OPCODE_PRIORITIZE_TEXTURE
:
4408 (*ctx
->Exec
->PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
4410 case OPCODE_PUSH_ATTRIB
:
4411 (*ctx
->Exec
->PushAttrib
)( n
[1].bf
);
4413 case OPCODE_PUSH_MATRIX
:
4414 (*ctx
->Exec
->PushMatrix
)();
4416 case OPCODE_PUSH_NAME
:
4417 (*ctx
->Exec
->PushName
)( n
[1].ui
);
4419 case OPCODE_RASTER_POS
:
4420 (*ctx
->Exec
->RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4422 case OPCODE_READ_BUFFER
:
4423 (*ctx
->Exec
->ReadBuffer
)( n
[1].e
);
4425 case OPCODE_RESET_HISTOGRAM
:
4426 (*ctx
->Exec
->ResetHistogram
)( n
[1].e
);
4428 case OPCODE_RESET_MIN_MAX
:
4429 (*ctx
->Exec
->ResetMinmax
)( n
[1].e
);
4432 (*ctx
->Exec
->Rotatef
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4435 (*ctx
->Exec
->Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4437 case OPCODE_SCISSOR
:
4438 (*ctx
->Exec
->Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
4440 case OPCODE_SHADE_MODEL
:
4441 (*ctx
->Exec
->ShadeModel
)( n
[1].e
);
4443 case OPCODE_STENCIL_FUNC
:
4444 (*ctx
->Exec
->StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
4446 case OPCODE_STENCIL_MASK
:
4447 (*ctx
->Exec
->StencilMask
)( n
[1].ui
);
4449 case OPCODE_STENCIL_OP
:
4450 (*ctx
->Exec
->StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
4459 (*ctx
->Exec
->TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
4469 (*ctx
->Exec
->TexGenfv
)( n
[1].e
, n
[2].e
, params
);
4472 case OPCODE_TEXPARAMETER
:
4479 (*ctx
->Exec
->TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
4482 case OPCODE_TEX_IMAGE1D
:
4484 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4485 ctx
->Unpack
= _mesa_native_packing
;
4486 (*ctx
->Exec
->TexImage1D
)(
4487 n
[1].e
, /* target */
4489 n
[3].i
, /* components */
4491 n
[5].e
, /* border */
4492 n
[6].e
, /* format */
4495 ctx
->Unpack
= save
; /* restore */
4498 case OPCODE_TEX_IMAGE2D
:
4500 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4501 ctx
->Unpack
= _mesa_native_packing
;
4502 (*ctx
->Exec
->TexImage2D
)(
4503 n
[1].e
, /* target */
4505 n
[3].i
, /* components */
4507 n
[5].i
, /* height */
4508 n
[6].e
, /* border */
4509 n
[7].e
, /* format */
4512 ctx
->Unpack
= save
; /* restore */
4515 case OPCODE_TEX_IMAGE3D
:
4517 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4518 ctx
->Unpack
= _mesa_native_packing
;
4519 (*ctx
->Exec
->TexImage3D
)(
4520 n
[1].e
, /* target */
4522 n
[3].i
, /* components */
4524 n
[5].i
, /* height */
4526 n
[7].e
, /* border */
4527 n
[8].e
, /* format */
4530 ctx
->Unpack
= save
; /* restore */
4533 case OPCODE_TEX_SUB_IMAGE1D
:
4535 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4536 ctx
->Unpack
= _mesa_native_packing
;
4537 (*ctx
->Exec
->TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4539 n
[6].e
, n
[7].data
);
4540 ctx
->Unpack
= save
; /* restore */
4543 case OPCODE_TEX_SUB_IMAGE2D
:
4545 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4546 ctx
->Unpack
= _mesa_native_packing
;
4547 (*ctx
->Exec
->TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4549 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
4550 ctx
->Unpack
= save
; /* restore */
4553 case OPCODE_TEX_SUB_IMAGE3D
:
4555 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4556 ctx
->Unpack
= _mesa_native_packing
;
4557 (*ctx
->Exec
->TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4558 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
4559 n
[8].i
, n
[9].e
, n
[10].e
,
4561 ctx
->Unpack
= save
; /* restore */
4564 case OPCODE_TRANSLATE
:
4565 (*ctx
->Exec
->Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4567 case OPCODE_VIEWPORT
:
4568 (*ctx
->Exec
->Viewport
)(n
[1].i
, n
[2].i
,
4569 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
4571 case OPCODE_WINDOW_POS
:
4572 (*ctx
->Exec
->WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4574 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
4575 (*ctx
->Exec
->ActiveTextureARB
)( n
[1].e
);
4577 case OPCODE_CLIENT_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
4578 (*ctx
->Exec
->ClientActiveTextureARB
)( n
[1].e
);
4580 case OPCODE_PIXEL_TEXGEN_SGIX
: /* GL_SGIX_pixel_texture */
4581 (*ctx
->Exec
->PixelTexGenSGIX
)( n
[1].e
);
4583 case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
: /* GL_SGIS_pixel_texture */
4584 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( n
[1].e
, n
[2].i
);
4586 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
4587 (*ctx
->Exec
->CompressedTexImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4588 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].data
);
4590 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
4591 (*ctx
->Exec
->CompressedTexImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4592 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].data
);
4594 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
4595 (*ctx
->Exec
->CompressedTexImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
4596 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].data
);
4598 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
4599 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4600 n
[4].i
, n
[5].e
, n
[6].i
, n
[7].data
);
4602 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
4603 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4604 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
, n
[9].data
);
4606 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
4607 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
4608 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
4609 n
[9].e
, n
[10].i
, n
[11].data
);
4611 case OPCODE_CONTINUE
:
4612 n
= (Node
*) n
[1].next
;
4614 case OPCODE_END_OF_LIST
:
4620 sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
4621 _mesa_problem( ctx
, msg
);
4626 /* increment n to point to next compiled command */
4627 if (opcode
!=OPCODE_CONTINUE
) {
4628 n
+= InstSize
[opcode
];
4634 if (ctx
->Driver
.EndCallList
)
4635 ctx
->Driver
.EndCallList( ctx
);
4642 /**********************************************************************/
4644 /**********************************************************************/
4650 * Test if a display list number is valid.
4653 _mesa_IsList( GLuint list
)
4655 GET_CURRENT_CONTEXT(ctx
);
4656 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4657 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
4658 return islist(ctx
, list
);
4663 * Delete a sequence of consecutive display lists.
4666 _mesa_DeleteLists( GLuint list
, GLsizei range
)
4668 GET_CURRENT_CONTEXT(ctx
);
4670 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4671 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4674 _mesa_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
4677 for (i
=list
;i
<list
+range
;i
++) {
4678 _mesa_destroy_list( ctx
, i
);
4685 * Return a display list number, n, such that lists n through n+range-1
4689 _mesa_GenLists(GLsizei range
)
4691 GET_CURRENT_CONTEXT(ctx
);
4693 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4694 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
4697 _mesa_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
4705 * Make this an atomic operation
4707 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
4709 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
4711 /* reserve the list IDs by with empty/dummy lists */
4713 for (i
=0; i
<range
; i
++) {
4714 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
4718 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
4726 * Begin a new display list.
4729 _mesa_NewList( GLuint list
, GLenum mode
)
4731 GET_CURRENT_CONTEXT(ctx
);
4732 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
4733 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4735 if (MESA_VERBOSE
&VERBOSE_API
)
4736 fprintf(stderr
, "glNewList %u %s\n", list
, _mesa_lookup_enum_by_nr(mode
));
4739 _mesa_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
4743 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
4744 _mesa_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
4748 if (ctx
->CurrentListPtr
) {
4749 /* already compiling a display list */
4750 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
4754 /* Allocate new display list */
4755 ctx
->CurrentListNum
= list
;
4756 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
4757 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
4758 ctx
->CurrentPos
= 0;
4759 ctx
->CompileFlag
= GL_TRUE
;
4760 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
4762 ctx
->Driver
.NewList( ctx
, list
, mode
);
4764 ctx
->CurrentDispatch
= ctx
->Save
;
4765 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4771 * End definition of current display list. Is the current
4772 * ASSERT_OUTSIDE_BEGIN_END strong enough to really guarentee that
4773 * we are outside begin/end calls?
4776 _mesa_EndList( void )
4778 GET_CURRENT_CONTEXT(ctx
);
4779 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
4780 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4781 if (MESA_VERBOSE
&VERBOSE_API
)
4782 fprintf(stderr
, "glEndList\n");
4784 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
); /* ??? */
4786 /* Check that a list is under construction */
4787 if (!ctx
->CurrentListPtr
) {
4788 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
4792 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_END_OF_LIST
, 0 );
4794 /* Destroy old list, if any */
4795 _mesa_destroy_list(ctx
, ctx
->CurrentListNum
);
4796 /* Install the list */
4797 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
4800 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
4801 mesa_print_display_list(ctx
->CurrentListNum
);
4803 ctx
->CurrentListNum
= 0;
4804 ctx
->CurrentListPtr
= NULL
;
4805 ctx
->ExecuteFlag
= GL_TRUE
;
4806 ctx
->CompileFlag
= GL_FALSE
;
4808 ctx
->Driver
.EndList( ctx
);
4810 ctx
->CurrentDispatch
= ctx
->Exec
;
4811 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4818 _mesa_CallList( GLuint list
)
4820 GLboolean save_compile_flag
;
4821 GET_CURRENT_CONTEXT(ctx
);
4822 FLUSH_CURRENT(ctx
, 0);
4823 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
4824 /* execute the display list, and restore the CompileFlag. */
4826 /* mesa_print_display_list( list ); */
4828 save_compile_flag
= ctx
->CompileFlag
;
4829 if (save_compile_flag
) {
4830 ctx
->CompileFlag
= GL_FALSE
;
4833 execute_list( ctx
, list
);
4834 ctx
->CompileFlag
= save_compile_flag
;
4836 /* also restore API function pointers to point to "save" versions */
4837 if (save_compile_flag
) {
4838 ctx
->CurrentDispatch
= ctx
->Save
;
4839 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4846 * Execute glCallLists: call multiple display lists.
4849 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
4851 GET_CURRENT_CONTEXT(ctx
);
4854 GLboolean save_compile_flag
;
4856 /* Save the CompileFlag status, turn it off, execute display list,
4857 * and restore the CompileFlag.
4859 save_compile_flag
= ctx
->CompileFlag
;
4860 ctx
->CompileFlag
= GL_FALSE
;
4863 list
= translate_id( i
, type
, lists
);
4864 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
4867 ctx
->CompileFlag
= save_compile_flag
;
4869 /* also restore API function pointers to point to "save" versions */
4870 if (save_compile_flag
) {
4871 ctx
->CurrentDispatch
= ctx
->Save
;
4872 _glapi_set_dispatch( ctx
->CurrentDispatch
);
4879 * Set the offset added to list numbers in glCallLists.
4882 _mesa_ListBase( GLuint base
)
4884 GET_CURRENT_CONTEXT(ctx
);
4885 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
4886 ASSERT_OUTSIDE_BEGIN_END(ctx
);
4887 ctx
->List
.ListBase
= base
;
4891 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
4893 static void exec_Finish( void )
4895 GET_CURRENT_CONTEXT(ctx
);
4896 FLUSH_VERTICES(ctx
, 0);
4897 ctx
->Exec
->Finish();
4900 static void exec_Flush( void )
4902 GET_CURRENT_CONTEXT(ctx
);
4903 FLUSH_VERTICES(ctx
, 0);
4904 ctx
->Exec
->Flush( );
4907 static void exec_GetBooleanv( GLenum pname
, GLboolean
*params
)
4909 GET_CURRENT_CONTEXT(ctx
);
4910 FLUSH_VERTICES(ctx
, 0);
4911 ctx
->Exec
->GetBooleanv( pname
, params
);
4914 static void exec_GetClipPlane( GLenum plane
, GLdouble
*equation
)
4916 GET_CURRENT_CONTEXT(ctx
);
4917 FLUSH_VERTICES(ctx
, 0);
4918 ctx
->Exec
->GetClipPlane( plane
, equation
);
4921 static void exec_GetDoublev( GLenum pname
, GLdouble
*params
)
4923 GET_CURRENT_CONTEXT(ctx
);
4924 FLUSH_VERTICES(ctx
, 0);
4925 ctx
->Exec
->GetDoublev( pname
, params
);
4928 static GLenum
exec_GetError( void )
4930 GET_CURRENT_CONTEXT(ctx
);
4931 FLUSH_VERTICES(ctx
, 0);
4932 return ctx
->Exec
->GetError( );
4935 static void exec_GetFloatv( GLenum pname
, GLfloat
*params
)
4937 GET_CURRENT_CONTEXT(ctx
);
4938 FLUSH_VERTICES(ctx
, 0);
4939 ctx
->Exec
->GetFloatv( pname
, params
);
4942 static void exec_GetIntegerv( GLenum pname
, GLint
*params
)
4944 GET_CURRENT_CONTEXT(ctx
);
4945 FLUSH_VERTICES(ctx
, 0);
4946 ctx
->Exec
->GetIntegerv( pname
, params
);
4949 static void exec_GetLightfv( GLenum light
, GLenum pname
, GLfloat
*params
)
4951 GET_CURRENT_CONTEXT(ctx
);
4952 FLUSH_VERTICES(ctx
, 0);
4953 ctx
->Exec
->GetLightfv( light
, pname
, params
);
4956 static void exec_GetLightiv( GLenum light
, GLenum pname
, GLint
*params
)
4958 GET_CURRENT_CONTEXT(ctx
);
4959 FLUSH_VERTICES(ctx
, 0);
4960 ctx
->Exec
->GetLightiv( light
, pname
, params
);
4963 static void exec_GetMapdv( GLenum target
, GLenum query
, GLdouble
*v
)
4965 GET_CURRENT_CONTEXT(ctx
);
4966 FLUSH_VERTICES(ctx
, 0);
4967 ctx
->Exec
->GetMapdv( target
, query
, v
);
4970 static void exec_GetMapfv( GLenum target
, GLenum query
, GLfloat
*v
)
4972 GET_CURRENT_CONTEXT(ctx
);
4973 FLUSH_VERTICES(ctx
, 0);
4974 ctx
->Exec
->GetMapfv( target
, query
, v
);
4977 static void exec_GetMapiv( GLenum target
, GLenum query
, GLint
*v
)
4979 GET_CURRENT_CONTEXT(ctx
);
4980 FLUSH_VERTICES(ctx
, 0);
4981 ctx
->Exec
->GetMapiv( target
, query
, v
);
4984 static void exec_GetMaterialfv( GLenum face
, GLenum pname
, GLfloat
*params
)
4986 GET_CURRENT_CONTEXT(ctx
);
4987 FLUSH_VERTICES(ctx
, 0);
4988 ctx
->Exec
->GetMaterialfv( face
, pname
, params
);
4991 static void exec_GetMaterialiv( GLenum face
, GLenum pname
, GLint
*params
)
4993 GET_CURRENT_CONTEXT(ctx
);
4994 FLUSH_VERTICES(ctx
, 0);
4995 ctx
->Exec
->GetMaterialiv( face
, pname
, params
);
4998 static void exec_GetPixelMapfv( GLenum map
, GLfloat
*values
)
5000 GET_CURRENT_CONTEXT(ctx
);
5001 FLUSH_VERTICES(ctx
, 0);
5002 ctx
->Exec
->GetPixelMapfv( map
, values
);
5005 static void exec_GetPixelMapuiv( GLenum map
, GLuint
*values
)
5007 GET_CURRENT_CONTEXT(ctx
);
5008 FLUSH_VERTICES(ctx
, 0);
5009 ctx
->Exec
->GetPixelMapuiv( map
, values
);
5012 static void exec_GetPixelMapusv( GLenum map
, GLushort
*values
)
5014 GET_CURRENT_CONTEXT(ctx
);
5015 FLUSH_VERTICES(ctx
, 0);
5016 ctx
->Exec
->GetPixelMapusv( map
, values
);
5019 static void exec_GetPolygonStipple( GLubyte
*dest
)
5021 GET_CURRENT_CONTEXT(ctx
);
5022 FLUSH_VERTICES(ctx
, 0);
5023 ctx
->Exec
->GetPolygonStipple( dest
);
5026 static const GLubyte
*exec_GetString( GLenum name
)
5028 GET_CURRENT_CONTEXT(ctx
);
5029 FLUSH_VERTICES(ctx
, 0);
5030 return ctx
->Exec
->GetString( name
);
5033 static void exec_GetTexEnvfv( GLenum target
, GLenum pname
, GLfloat
*params
)
5035 GET_CURRENT_CONTEXT(ctx
);
5036 FLUSH_VERTICES(ctx
, 0);
5037 ctx
->Exec
->GetTexEnvfv( target
, pname
, params
);
5040 static void exec_GetTexEnviv( GLenum target
, GLenum pname
, GLint
*params
)
5042 GET_CURRENT_CONTEXT(ctx
);
5043 FLUSH_VERTICES(ctx
, 0);
5044 ctx
->Exec
->GetTexEnviv( target
, pname
, params
);
5047 static void exec_GetTexGendv( GLenum coord
, GLenum pname
, GLdouble
*params
)
5049 GET_CURRENT_CONTEXT(ctx
);
5050 FLUSH_VERTICES(ctx
, 0);
5051 ctx
->Exec
->GetTexGendv( coord
, pname
, params
);
5054 static void exec_GetTexGenfv( GLenum coord
, GLenum pname
, GLfloat
*params
)
5056 GET_CURRENT_CONTEXT(ctx
);
5057 FLUSH_VERTICES(ctx
, 0);
5058 ctx
->Exec
->GetTexGenfv( coord
, pname
, params
);
5061 static void exec_GetTexGeniv( GLenum coord
, GLenum pname
, GLint
*params
)
5063 GET_CURRENT_CONTEXT(ctx
);
5064 FLUSH_VERTICES(ctx
, 0);
5065 ctx
->Exec
->GetTexGeniv( coord
, pname
, params
);
5068 static void exec_GetTexImage( GLenum target
, GLint level
, GLenum format
,
5069 GLenum type
, GLvoid
*pixels
)
5071 GET_CURRENT_CONTEXT(ctx
);
5072 FLUSH_VERTICES(ctx
, 0);
5073 ctx
->Exec
->GetTexImage( target
, level
, format
, type
, pixels
);
5076 static void exec_GetTexLevelParameterfv( GLenum target
, GLint level
,
5077 GLenum pname
, GLfloat
*params
)
5079 GET_CURRENT_CONTEXT(ctx
);
5080 FLUSH_VERTICES(ctx
, 0);
5081 ctx
->Exec
->GetTexLevelParameterfv( target
, level
, pname
, params
);
5084 static void exec_GetTexLevelParameteriv( GLenum target
, GLint level
,
5085 GLenum pname
, GLint
*params
)
5087 GET_CURRENT_CONTEXT(ctx
);
5088 FLUSH_VERTICES(ctx
, 0);
5089 ctx
->Exec
->GetTexLevelParameteriv( target
, level
, pname
, params
);
5092 static void exec_GetTexParameterfv( GLenum target
, GLenum pname
,
5095 GET_CURRENT_CONTEXT(ctx
);
5096 FLUSH_VERTICES(ctx
, 0);
5097 ctx
->Exec
->GetTexParameterfv( target
, pname
, params
);
5100 static void exec_GetTexParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
5102 GET_CURRENT_CONTEXT(ctx
);
5103 FLUSH_VERTICES(ctx
, 0);
5104 ctx
->Exec
->GetTexParameteriv( target
, pname
, params
);
5107 static GLboolean
exec_IsEnabled( GLenum cap
)
5109 GET_CURRENT_CONTEXT(ctx
);
5110 FLUSH_VERTICES(ctx
, 0);
5111 return ctx
->Exec
->IsEnabled( cap
);
5114 static void exec_PixelStoref( GLenum pname
, GLfloat param
)
5116 GET_CURRENT_CONTEXT(ctx
);
5117 FLUSH_VERTICES(ctx
, 0);
5118 ctx
->Exec
->PixelStoref( pname
, param
);
5121 static void exec_PixelStorei( GLenum pname
, GLint param
)
5123 GET_CURRENT_CONTEXT(ctx
);
5124 FLUSH_VERTICES(ctx
, 0);
5125 ctx
->Exec
->PixelStorei( pname
, param
);
5128 static void exec_ReadPixels( GLint x
, GLint y
, GLsizei width
, GLsizei height
,
5129 GLenum format
, GLenum type
, GLvoid
*pixels
)
5131 GET_CURRENT_CONTEXT(ctx
);
5132 FLUSH_VERTICES(ctx
, 0);
5133 ctx
->Exec
->ReadPixels( x
, y
, width
, height
, format
, type
, pixels
);
5136 static GLint
exec_RenderMode( GLenum mode
)
5138 GET_CURRENT_CONTEXT(ctx
);
5139 FLUSH_VERTICES(ctx
, 0);
5140 return ctx
->Exec
->RenderMode( mode
);
5143 static void exec_FeedbackBuffer( GLsizei size
, GLenum type
, GLfloat
*buffer
)
5145 GET_CURRENT_CONTEXT(ctx
);
5146 FLUSH_VERTICES(ctx
, 0);
5147 ctx
->Exec
->FeedbackBuffer( size
, type
, buffer
);
5150 static void exec_SelectBuffer( GLsizei size
, GLuint
*buffer
)
5152 GET_CURRENT_CONTEXT(ctx
);
5153 FLUSH_VERTICES(ctx
, 0);
5154 ctx
->Exec
->SelectBuffer( size
, buffer
);
5157 static GLboolean
exec_AreTexturesResident(GLsizei n
, const GLuint
*texName
,
5158 GLboolean
*residences
)
5160 GET_CURRENT_CONTEXT(ctx
);
5161 FLUSH_VERTICES(ctx
, 0);
5162 return ctx
->Exec
->AreTexturesResident( n
, texName
, residences
);
5165 static void exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
,
5168 GET_CURRENT_CONTEXT(ctx
);
5169 FLUSH_VERTICES(ctx
, 0);
5170 ctx
->Exec
->ColorPointer( size
, type
, stride
, ptr
);
5173 static void exec_DeleteTextures( GLsizei n
, const GLuint
*texName
)
5175 GET_CURRENT_CONTEXT(ctx
);
5176 FLUSH_VERTICES(ctx
, 0);
5177 ctx
->Exec
->DeleteTextures( n
, texName
);
5180 static void exec_DisableClientState( GLenum cap
)
5182 GET_CURRENT_CONTEXT(ctx
);
5183 FLUSH_VERTICES(ctx
, 0);
5184 ctx
->Exec
->DisableClientState( cap
);
5187 static void exec_EdgeFlagPointer(GLsizei stride
, const void *vptr
)
5189 GET_CURRENT_CONTEXT(ctx
);
5190 FLUSH_VERTICES(ctx
, 0);
5191 ctx
->Exec
->EdgeFlagPointer( stride
, vptr
);
5194 static void exec_EnableClientState( GLenum cap
)
5196 GET_CURRENT_CONTEXT(ctx
);
5197 FLUSH_VERTICES(ctx
, 0);
5198 ctx
->Exec
->EnableClientState( cap
);
5201 static void exec_GenTextures( GLsizei n
, GLuint
*texName
)
5203 GET_CURRENT_CONTEXT(ctx
);
5204 FLUSH_VERTICES(ctx
, 0);
5205 ctx
->Exec
->GenTextures( n
, texName
);
5208 static void exec_GetPointerv( GLenum pname
, GLvoid
**params
)
5210 GET_CURRENT_CONTEXT(ctx
);
5211 FLUSH_VERTICES(ctx
, 0);
5212 ctx
->Exec
->GetPointerv( pname
, params
);
5215 static void exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5217 GET_CURRENT_CONTEXT(ctx
);
5218 FLUSH_VERTICES(ctx
, 0);
5219 ctx
->Exec
->IndexPointer( type
, stride
, ptr
);
5222 static void exec_InterleavedArrays(GLenum format
, GLsizei stride
,
5223 const GLvoid
*pointer
)
5225 GET_CURRENT_CONTEXT(ctx
);
5226 FLUSH_VERTICES(ctx
, 0);
5227 ctx
->Exec
->InterleavedArrays( format
, stride
, pointer
);
5230 static GLboolean
exec_IsTexture( GLuint texture
)
5232 GET_CURRENT_CONTEXT(ctx
);
5233 FLUSH_VERTICES(ctx
, 0);
5234 return ctx
->Exec
->IsTexture( texture
);
5237 static void exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5239 GET_CURRENT_CONTEXT(ctx
);
5240 FLUSH_VERTICES(ctx
, 0);
5241 ctx
->Exec
->NormalPointer( type
, stride
, ptr
);
5244 static void exec_PopClientAttrib(void)
5246 GET_CURRENT_CONTEXT(ctx
);
5247 FLUSH_VERTICES(ctx
, 0);
5248 ctx
->Exec
->PopClientAttrib();
5251 static void exec_PushClientAttrib(GLbitfield mask
)
5253 GET_CURRENT_CONTEXT(ctx
);
5254 FLUSH_VERTICES(ctx
, 0);
5255 ctx
->Exec
->PushClientAttrib( mask
);
5258 static void exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
5261 GET_CURRENT_CONTEXT(ctx
);
5262 FLUSH_VERTICES(ctx
, 0);
5263 ctx
->Exec
->TexCoordPointer( size
, type
, stride
, ptr
);
5266 static void exec_GetCompressedTexImageARB(GLenum target
, GLint level
,
5269 GET_CURRENT_CONTEXT(ctx
);
5270 FLUSH_VERTICES(ctx
, 0);
5271 ctx
->Exec
->GetCompressedTexImageARB( target
, level
, img
);
5274 static void exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
5277 GET_CURRENT_CONTEXT(ctx
);
5278 FLUSH_VERTICES(ctx
, 0);
5279 ctx
->Exec
->VertexPointer( size
, type
, stride
, ptr
);
5282 static void exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
5283 GLint x
, GLint y
, GLsizei width
)
5285 GET_CURRENT_CONTEXT(ctx
);
5286 FLUSH_VERTICES(ctx
, 0);
5287 ctx
->Exec
->CopyConvolutionFilter1D( target
, internalFormat
, x
, y
, width
);
5290 static void exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
5291 GLint x
, GLint y
, GLsizei width
,
5294 GET_CURRENT_CONTEXT(ctx
);
5295 FLUSH_VERTICES(ctx
, 0);
5296 ctx
->Exec
->CopyConvolutionFilter2D( target
, internalFormat
, x
, y
, width
,
5300 static void exec_GetColorTable( GLenum target
, GLenum format
,
5301 GLenum type
, GLvoid
*data
)
5303 GET_CURRENT_CONTEXT(ctx
);
5304 FLUSH_VERTICES(ctx
, 0);
5305 ctx
->Exec
->GetColorTable( target
, format
, type
, data
);
5308 static void exec_GetColorTableParameterfv( GLenum target
, GLenum pname
,
5311 GET_CURRENT_CONTEXT(ctx
);
5312 FLUSH_VERTICES(ctx
, 0);
5313 ctx
->Exec
->GetColorTableParameterfv( target
, pname
, params
);
5316 static void exec_GetColorTableParameteriv( GLenum target
, GLenum pname
,
5319 GET_CURRENT_CONTEXT(ctx
);
5320 FLUSH_VERTICES(ctx
, 0);
5321 ctx
->Exec
->GetColorTableParameteriv( target
, pname
, params
);
5324 static void exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
5327 GET_CURRENT_CONTEXT(ctx
);
5328 FLUSH_VERTICES(ctx
, 0);
5329 ctx
->Exec
->GetConvolutionFilter( target
, format
, type
, image
);
5332 static void exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
,
5335 GET_CURRENT_CONTEXT(ctx
);
5336 FLUSH_VERTICES(ctx
, 0);
5337 ctx
->Exec
->GetConvolutionParameterfv( target
, pname
, params
);
5340 static void exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
,
5343 GET_CURRENT_CONTEXT(ctx
);
5344 FLUSH_VERTICES(ctx
, 0);
5345 ctx
->Exec
->GetConvolutionParameteriv( target
, pname
, params
);
5348 static void exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
5349 GLenum type
, GLvoid
*values
)
5351 GET_CURRENT_CONTEXT(ctx
);
5352 FLUSH_VERTICES(ctx
, 0);
5353 ctx
->Exec
->GetHistogram( target
, reset
, format
, type
, values
);
5356 static void exec_GetHistogramParameterfv(GLenum target
, GLenum pname
,
5359 GET_CURRENT_CONTEXT(ctx
);
5360 FLUSH_VERTICES(ctx
, 0);
5361 ctx
->Exec
->GetHistogramParameterfv( target
, pname
, params
);
5364 static void exec_GetHistogramParameteriv(GLenum target
, GLenum pname
,
5367 GET_CURRENT_CONTEXT(ctx
);
5368 FLUSH_VERTICES(ctx
, 0);
5369 ctx
->Exec
->GetHistogramParameteriv( target
, pname
, params
);
5372 static void exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
5373 GLenum type
, GLvoid
*values
)
5375 GET_CURRENT_CONTEXT(ctx
);
5376 FLUSH_VERTICES(ctx
, 0);
5377 ctx
->Exec
->GetMinmax( target
, reset
, format
, type
, values
);
5380 static void exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
,
5383 GET_CURRENT_CONTEXT(ctx
);
5384 FLUSH_VERTICES(ctx
, 0);
5385 ctx
->Exec
->GetMinmaxParameterfv( target
, pname
, params
);
5388 static void exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
,
5391 GET_CURRENT_CONTEXT(ctx
);
5392 FLUSH_VERTICES(ctx
, 0);
5393 ctx
->Exec
->GetMinmaxParameteriv( target
, pname
, params
);
5396 static void exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
5397 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
5399 GET_CURRENT_CONTEXT(ctx
);
5400 FLUSH_VERTICES(ctx
, 0);
5401 ctx
->Exec
->GetSeparableFilter( target
, format
, type
, row
, column
, span
);
5404 static void exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
5405 GLsizei width
, GLsizei height
, GLenum format
,
5406 GLenum type
, const GLvoid
*row
,
5407 const GLvoid
*column
)
5409 GET_CURRENT_CONTEXT(ctx
);
5410 FLUSH_VERTICES(ctx
, 0);
5411 ctx
->Exec
->SeparableFilter2D( target
, internalFormat
, width
, height
, format
,
5415 static void exec_GetPixelTexGenParameterivSGIS(GLenum target
, GLint
*value
)
5417 GET_CURRENT_CONTEXT(ctx
);
5418 FLUSH_VERTICES(ctx
, 0);
5419 ctx
->Exec
->GetPixelTexGenParameterivSGIS( target
, value
);
5422 static void exec_GetPixelTexGenParameterfvSGIS(GLenum target
, GLfloat
*value
)
5424 GET_CURRENT_CONTEXT(ctx
);
5425 FLUSH_VERTICES(ctx
, 0);
5426 ctx
->Exec
->GetPixelTexGenParameterfvSGIS( target
, value
);
5429 static void exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5430 GLsizei count
, const GLvoid
*ptr
)
5432 GET_CURRENT_CONTEXT(ctx
);
5433 FLUSH_VERTICES(ctx
, 0);
5434 ctx
->Exec
->ColorPointerEXT( size
, type
, stride
, count
, ptr
);
5437 static void exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
,
5438 const GLboolean
*ptr
)
5440 GET_CURRENT_CONTEXT(ctx
);
5441 FLUSH_VERTICES(ctx
, 0);
5442 ctx
->Exec
->EdgeFlagPointerEXT( stride
, count
, ptr
);
5445 static void exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
5448 GET_CURRENT_CONTEXT(ctx
);
5449 FLUSH_VERTICES(ctx
, 0);
5450 ctx
->Exec
->IndexPointerEXT( type
, stride
, count
, ptr
);
5453 static void exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
5456 GET_CURRENT_CONTEXT(ctx
);
5457 FLUSH_VERTICES(ctx
, 0);
5458 ctx
->Exec
->NormalPointerEXT( type
, stride
, count
, ptr
);
5461 static void exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5462 GLsizei count
, const GLvoid
*ptr
)
5464 GET_CURRENT_CONTEXT(ctx
);
5465 FLUSH_VERTICES(ctx
, 0);
5466 ctx
->Exec
->TexCoordPointerEXT( size
, type
, stride
, count
, ptr
);
5469 static void exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5470 GLsizei count
, const GLvoid
*ptr
)
5472 GET_CURRENT_CONTEXT(ctx
);
5473 FLUSH_VERTICES(ctx
, 0);
5474 ctx
->Exec
->VertexPointerEXT( size
, type
, stride
, count
, ptr
);
5477 static void exec_LockArraysEXT(GLint first
, GLsizei count
)
5479 GET_CURRENT_CONTEXT(ctx
);
5480 FLUSH_VERTICES(ctx
, 0);
5481 ctx
->Exec
->LockArraysEXT( first
, count
);
5484 static void exec_UnlockArraysEXT( void )
5486 GET_CURRENT_CONTEXT(ctx
);
5487 FLUSH_VERTICES(ctx
, 0);
5488 ctx
->Exec
->UnlockArraysEXT( );
5491 static void exec_ResizeBuffersMESA( void )
5493 GET_CURRENT_CONTEXT(ctx
);
5494 FLUSH_VERTICES(ctx
, 0);
5495 ctx
->Exec
->ResizeBuffersMESA( );
5498 static void exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
5499 GLsizei stride
, const GLvoid
*ptr
)
5501 GET_CURRENT_CONTEXT(ctx
);
5502 FLUSH_VERTICES(ctx
, 0);
5503 ctx
->Exec
->SecondaryColorPointerEXT( size
, type
, stride
, ptr
);
5506 static void exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
,
5509 GET_CURRENT_CONTEXT(ctx
);
5510 FLUSH_VERTICES(ctx
, 0);
5511 ctx
->Exec
->FogCoordPointerEXT( type
, stride
, ptr
);
5516 * Assign all the pointers in <table> to point to Mesa's display list
5517 * building functions.
5519 * This does not include any of the tnl functions - they are
5520 * initialized from _mesa_init_api_defaults and from the active vtxfmt
5524 _mesa_init_dlist_table( struct _glapi_table
*table
, GLuint tableSize
)
5526 _mesa_init_no_op_table(table
, tableSize
);
5528 _mesa_loopback_init_api_table( table
, GL_TRUE
);
5531 table
->Accum
= save_Accum
;
5532 table
->AlphaFunc
= save_AlphaFunc
;
5533 table
->Bitmap
= save_Bitmap
;
5534 table
->BlendFunc
= save_BlendFunc
;
5535 table
->CallList
= _mesa_save_CallList
;
5536 table
->CallLists
= _mesa_save_CallLists
;
5537 table
->Clear
= save_Clear
;
5538 table
->ClearAccum
= save_ClearAccum
;
5539 table
->ClearColor
= save_ClearColor
;
5540 table
->ClearDepth
= save_ClearDepth
;
5541 table
->ClearIndex
= save_ClearIndex
;
5542 table
->ClearStencil
= save_ClearStencil
;
5543 table
->ClipPlane
= save_ClipPlane
;
5544 table
->ColorMask
= save_ColorMask
;
5545 table
->ColorMaterial
= save_ColorMaterial
;
5546 table
->CopyPixels
= save_CopyPixels
;
5547 table
->CullFace
= save_CullFace
;
5548 table
->DeleteLists
= _mesa_DeleteLists
;
5549 table
->DepthFunc
= save_DepthFunc
;
5550 table
->DepthMask
= save_DepthMask
;
5551 table
->DepthRange
= save_DepthRange
;
5552 table
->Disable
= save_Disable
;
5553 table
->DrawBuffer
= save_DrawBuffer
;
5554 table
->DrawPixels
= save_DrawPixels
;
5555 table
->Enable
= save_Enable
;
5556 table
->EndList
= _mesa_EndList
;
5557 table
->EvalMesh1
= _mesa_save_EvalMesh1
;
5558 table
->EvalMesh2
= _mesa_save_EvalMesh2
;
5559 table
->Finish
= exec_Finish
;
5560 table
->Flush
= exec_Flush
;
5561 table
->Fogf
= save_Fogf
;
5562 table
->Fogfv
= save_Fogfv
;
5563 table
->Fogi
= save_Fogi
;
5564 table
->Fogiv
= save_Fogiv
;
5565 table
->FrontFace
= save_FrontFace
;
5566 table
->Frustum
= save_Frustum
;
5567 table
->GenLists
= _mesa_GenLists
;
5568 table
->GetBooleanv
= exec_GetBooleanv
;
5569 table
->GetClipPlane
= exec_GetClipPlane
;
5570 table
->GetDoublev
= exec_GetDoublev
;
5571 table
->GetError
= exec_GetError
;
5572 table
->GetFloatv
= exec_GetFloatv
;
5573 table
->GetIntegerv
= exec_GetIntegerv
;
5574 table
->GetLightfv
= exec_GetLightfv
;
5575 table
->GetLightiv
= exec_GetLightiv
;
5576 table
->GetMapdv
= exec_GetMapdv
;
5577 table
->GetMapfv
= exec_GetMapfv
;
5578 table
->GetMapiv
= exec_GetMapiv
;
5579 table
->GetMaterialfv
= exec_GetMaterialfv
;
5580 table
->GetMaterialiv
= exec_GetMaterialiv
;
5581 table
->GetPixelMapfv
= exec_GetPixelMapfv
;
5582 table
->GetPixelMapuiv
= exec_GetPixelMapuiv
;
5583 table
->GetPixelMapusv
= exec_GetPixelMapusv
;
5584 table
->GetPolygonStipple
= exec_GetPolygonStipple
;
5585 table
->GetString
= exec_GetString
;
5586 table
->GetTexEnvfv
= exec_GetTexEnvfv
;
5587 table
->GetTexEnviv
= exec_GetTexEnviv
;
5588 table
->GetTexGendv
= exec_GetTexGendv
;
5589 table
->GetTexGenfv
= exec_GetTexGenfv
;
5590 table
->GetTexGeniv
= exec_GetTexGeniv
;
5591 table
->GetTexImage
= exec_GetTexImage
;
5592 table
->GetTexLevelParameterfv
= exec_GetTexLevelParameterfv
;
5593 table
->GetTexLevelParameteriv
= exec_GetTexLevelParameteriv
;
5594 table
->GetTexParameterfv
= exec_GetTexParameterfv
;
5595 table
->GetTexParameteriv
= exec_GetTexParameteriv
;
5596 table
->Hint
= save_Hint
;
5597 table
->IndexMask
= save_IndexMask
;
5598 table
->InitNames
= save_InitNames
;
5599 table
->IsEnabled
= exec_IsEnabled
;
5600 table
->IsList
= _mesa_IsList
;
5601 table
->LightModelf
= save_LightModelf
;
5602 table
->LightModelfv
= save_LightModelfv
;
5603 table
->LightModeli
= save_LightModeli
;
5604 table
->LightModeliv
= save_LightModeliv
;
5605 table
->Lightf
= save_Lightf
;
5606 table
->Lightfv
= save_Lightfv
;
5607 table
->Lighti
= save_Lighti
;
5608 table
->Lightiv
= save_Lightiv
;
5609 table
->LineStipple
= save_LineStipple
;
5610 table
->LineWidth
= save_LineWidth
;
5611 table
->ListBase
= save_ListBase
;
5612 table
->LoadIdentity
= save_LoadIdentity
;
5613 table
->LoadMatrixd
= save_LoadMatrixd
;
5614 table
->LoadMatrixf
= save_LoadMatrixf
;
5615 table
->LoadName
= save_LoadName
;
5616 table
->LogicOp
= save_LogicOp
;
5617 table
->Map1d
= save_Map1d
;
5618 table
->Map1f
= save_Map1f
;
5619 table
->Map2d
= save_Map2d
;
5620 table
->Map2f
= save_Map2f
;
5621 table
->MapGrid1d
= save_MapGrid1d
;
5622 table
->MapGrid1f
= save_MapGrid1f
;
5623 table
->MapGrid2d
= save_MapGrid2d
;
5624 table
->MapGrid2f
= save_MapGrid2f
;
5625 table
->MatrixMode
= save_MatrixMode
;
5626 table
->MultMatrixd
= save_MultMatrixd
;
5627 table
->MultMatrixf
= save_MultMatrixf
;
5628 table
->NewList
= save_NewList
;
5629 table
->Ortho
= save_Ortho
;
5630 table
->PassThrough
= save_PassThrough
;
5631 table
->PixelMapfv
= save_PixelMapfv
;
5632 table
->PixelMapuiv
= save_PixelMapuiv
;
5633 table
->PixelMapusv
= save_PixelMapusv
;
5634 table
->PixelStoref
= exec_PixelStoref
;
5635 table
->PixelStorei
= exec_PixelStorei
;
5636 table
->PixelTransferf
= save_PixelTransferf
;
5637 table
->PixelTransferi
= save_PixelTransferi
;
5638 table
->PixelZoom
= save_PixelZoom
;
5639 table
->PointSize
= save_PointSize
;
5640 table
->PolygonMode
= save_PolygonMode
;
5641 table
->PolygonOffset
= save_PolygonOffset
;
5642 table
->PolygonStipple
= save_PolygonStipple
;
5643 table
->PopAttrib
= save_PopAttrib
;
5644 table
->PopMatrix
= save_PopMatrix
;
5645 table
->PopName
= save_PopName
;
5646 table
->PushAttrib
= save_PushAttrib
;
5647 table
->PushMatrix
= save_PushMatrix
;
5648 table
->PushName
= save_PushName
;
5649 table
->RasterPos2d
= save_RasterPos2d
;
5650 table
->RasterPos2dv
= save_RasterPos2dv
;
5651 table
->RasterPos2f
= save_RasterPos2f
;
5652 table
->RasterPos2fv
= save_RasterPos2fv
;
5653 table
->RasterPos2i
= save_RasterPos2i
;
5654 table
->RasterPos2iv
= save_RasterPos2iv
;
5655 table
->RasterPos2s
= save_RasterPos2s
;
5656 table
->RasterPos2sv
= save_RasterPos2sv
;
5657 table
->RasterPos3d
= save_RasterPos3d
;
5658 table
->RasterPos3dv
= save_RasterPos3dv
;
5659 table
->RasterPos3f
= save_RasterPos3f
;
5660 table
->RasterPos3fv
= save_RasterPos3fv
;
5661 table
->RasterPos3i
= save_RasterPos3i
;
5662 table
->RasterPos3iv
= save_RasterPos3iv
;
5663 table
->RasterPos3s
= save_RasterPos3s
;
5664 table
->RasterPos3sv
= save_RasterPos3sv
;
5665 table
->RasterPos4d
= save_RasterPos4d
;
5666 table
->RasterPos4dv
= save_RasterPos4dv
;
5667 table
->RasterPos4f
= save_RasterPos4f
;
5668 table
->RasterPos4fv
= save_RasterPos4fv
;
5669 table
->RasterPos4i
= save_RasterPos4i
;
5670 table
->RasterPos4iv
= save_RasterPos4iv
;
5671 table
->RasterPos4s
= save_RasterPos4s
;
5672 table
->RasterPos4sv
= save_RasterPos4sv
;
5673 table
->ReadBuffer
= save_ReadBuffer
;
5674 table
->ReadPixels
= exec_ReadPixels
;
5675 table
->RenderMode
= exec_RenderMode
;
5676 table
->Rotated
= save_Rotated
;
5677 table
->Rotatef
= save_Rotatef
;
5678 table
->Scaled
= save_Scaled
;
5679 table
->Scalef
= save_Scalef
;
5680 table
->Scissor
= save_Scissor
;
5681 table
->FeedbackBuffer
= exec_FeedbackBuffer
;
5682 table
->SelectBuffer
= exec_SelectBuffer
;
5683 table
->ShadeModel
= save_ShadeModel
;
5684 table
->StencilFunc
= save_StencilFunc
;
5685 table
->StencilMask
= save_StencilMask
;
5686 table
->StencilOp
= save_StencilOp
;
5687 table
->TexEnvf
= save_TexEnvf
;
5688 table
->TexEnvfv
= save_TexEnvfv
;
5689 table
->TexEnvi
= save_TexEnvi
;
5690 table
->TexEnviv
= save_TexEnviv
;
5691 table
->TexGend
= save_TexGend
;
5692 table
->TexGendv
= save_TexGendv
;
5693 table
->TexGenf
= save_TexGenf
;
5694 table
->TexGenfv
= save_TexGenfv
;
5695 table
->TexGeni
= save_TexGeni
;
5696 table
->TexGeniv
= save_TexGeniv
;
5697 table
->TexImage1D
= save_TexImage1D
;
5698 table
->TexImage2D
= save_TexImage2D
;
5699 table
->TexParameterf
= save_TexParameterf
;
5700 table
->TexParameterfv
= save_TexParameterfv
;
5701 table
->TexParameteri
= save_TexParameteri
;
5702 table
->TexParameteriv
= save_TexParameteriv
;
5703 table
->Translated
= save_Translated
;
5704 table
->Translatef
= save_Translatef
;
5705 table
->Viewport
= save_Viewport
;
5708 table
->AreTexturesResident
= exec_AreTexturesResident
;
5709 table
->BindTexture
= save_BindTexture
;
5710 table
->ColorPointer
= exec_ColorPointer
;
5711 table
->CopyTexImage1D
= save_CopyTexImage1D
;
5712 table
->CopyTexImage2D
= save_CopyTexImage2D
;
5713 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
5714 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
5715 table
->DeleteTextures
= exec_DeleteTextures
;
5716 table
->DisableClientState
= exec_DisableClientState
;
5717 table
->EdgeFlagPointer
= exec_EdgeFlagPointer
;
5718 table
->EnableClientState
= exec_EnableClientState
;
5719 table
->GenTextures
= exec_GenTextures
;
5720 table
->GetPointerv
= exec_GetPointerv
;
5721 table
->IndexPointer
= exec_IndexPointer
;
5722 table
->InterleavedArrays
= exec_InterleavedArrays
;
5723 table
->IsTexture
= exec_IsTexture
;
5724 table
->NormalPointer
= exec_NormalPointer
;
5725 table
->PopClientAttrib
= exec_PopClientAttrib
;
5726 table
->PrioritizeTextures
= save_PrioritizeTextures
;
5727 table
->PushClientAttrib
= exec_PushClientAttrib
;
5728 table
->TexCoordPointer
= exec_TexCoordPointer
;
5729 table
->TexSubImage1D
= save_TexSubImage1D
;
5730 table
->TexSubImage2D
= save_TexSubImage2D
;
5731 table
->VertexPointer
= exec_VertexPointer
;
5734 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
5735 table
->TexImage3D
= save_TexImage3D
;
5736 table
->TexSubImage3D
= save_TexSubImage3D
;
5738 /* GL_ARB_imaging */
5739 /* Not all are supported */
5740 table
->BlendColor
= save_BlendColor
;
5741 table
->BlendEquation
= save_BlendEquation
;
5742 table
->ColorSubTable
= save_ColorSubTable
;
5743 table
->ColorTable
= save_ColorTable
;
5744 table
->ColorTableParameterfv
= save_ColorTableParameterfv
;
5745 table
->ColorTableParameteriv
= save_ColorTableParameteriv
;
5746 table
->ConvolutionFilter1D
= save_ConvolutionFilter1D
;
5747 table
->ConvolutionFilter2D
= save_ConvolutionFilter2D
;
5748 table
->ConvolutionParameterf
= save_ConvolutionParameterf
;
5749 table
->ConvolutionParameterfv
= save_ConvolutionParameterfv
;
5750 table
->ConvolutionParameteri
= save_ConvolutionParameteri
;
5751 table
->ConvolutionParameteriv
= save_ConvolutionParameteriv
;
5752 table
->CopyColorSubTable
= save_CopyColorSubTable
;
5753 table
->CopyColorTable
= save_CopyColorTable
;
5754 table
->CopyConvolutionFilter1D
= exec_CopyConvolutionFilter1D
;
5755 table
->CopyConvolutionFilter2D
= exec_CopyConvolutionFilter2D
;
5756 table
->GetColorTable
= exec_GetColorTable
;
5757 table
->GetColorTableParameterfv
= exec_GetColorTableParameterfv
;
5758 table
->GetColorTableParameteriv
= exec_GetColorTableParameteriv
;
5759 table
->GetConvolutionFilter
= exec_GetConvolutionFilter
;
5760 table
->GetConvolutionParameterfv
= exec_GetConvolutionParameterfv
;
5761 table
->GetConvolutionParameteriv
= exec_GetConvolutionParameteriv
;
5762 table
->GetHistogram
= exec_GetHistogram
;
5763 table
->GetHistogramParameterfv
= exec_GetHistogramParameterfv
;
5764 table
->GetHistogramParameteriv
= exec_GetHistogramParameteriv
;
5765 table
->GetMinmax
= exec_GetMinmax
;
5766 table
->GetMinmaxParameterfv
= exec_GetMinmaxParameterfv
;
5767 table
->GetMinmaxParameteriv
= exec_GetMinmaxParameteriv
;
5768 table
->GetSeparableFilter
= exec_GetSeparableFilter
;
5769 table
->Histogram
= save_Histogram
;
5770 table
->Minmax
= save_Minmax
;
5771 table
->ResetHistogram
= save_ResetHistogram
;
5772 table
->ResetMinmax
= save_ResetMinmax
;
5773 table
->SeparableFilter2D
= exec_SeparableFilter2D
;
5775 /* 2. GL_EXT_blend_color */
5777 table
->BlendColorEXT
= save_BlendColorEXT
;
5780 /* 3. GL_EXT_polygon_offset */
5781 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
5783 /* 6. GL_EXT_texture3d */
5785 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
5786 table
->TexImage3DEXT
= save_TexImage3DEXT
;
5787 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
5790 /* 15. GL_SGIX_pixel_texture */
5791 table
->PixelTexGenSGIX
= save_PixelTexGenSGIX
;
5793 /* 15. GL_SGIS_pixel_texture */
5794 table
->PixelTexGenParameteriSGIS
= save_PixelTexGenParameteriSGIS
;
5795 table
->PixelTexGenParameterfSGIS
= save_PixelTexGenParameterfSGIS
;
5796 table
->PixelTexGenParameterivSGIS
= save_PixelTexGenParameterivSGIS
;
5797 table
->PixelTexGenParameterfvSGIS
= save_PixelTexGenParameterfvSGIS
;
5798 table
->GetPixelTexGenParameterivSGIS
= exec_GetPixelTexGenParameterivSGIS
;
5799 table
->GetPixelTexGenParameterfvSGIS
= exec_GetPixelTexGenParameterfvSGIS
;
5801 /* 30. GL_EXT_vertex_array */
5802 table
->ColorPointerEXT
= exec_ColorPointerEXT
;
5803 table
->EdgeFlagPointerEXT
= exec_EdgeFlagPointerEXT
;
5804 table
->IndexPointerEXT
= exec_IndexPointerEXT
;
5805 table
->NormalPointerEXT
= exec_NormalPointerEXT
;
5806 table
->TexCoordPointerEXT
= exec_TexCoordPointerEXT
;
5807 table
->VertexPointerEXT
= exec_VertexPointerEXT
;
5809 /* 37. GL_EXT_blend_minmax */
5811 table
->BlendEquationEXT
= save_BlendEquationEXT
;
5814 /* 54. GL_EXT_point_parameters */
5815 table
->PointParameterfEXT
= save_PointParameterfEXT
;
5816 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
5818 /* 78. GL_EXT_paletted_texture */
5820 table
->ColorTableEXT
= save_ColorTable
;
5821 table
->ColorSubTableEXT
= save_ColorSubTable
;
5823 table
->GetColorTableEXT
= exec_GetColorTable
;
5824 table
->GetColorTableParameterfvEXT
= exec_GetColorTableParameterfv
;
5825 table
->GetColorTableParameterivEXT
= exec_GetColorTableParameteriv
;
5827 /* 97. GL_EXT_compiled_vertex_array */
5828 table
->LockArraysEXT
= exec_LockArraysEXT
;
5829 table
->UnlockArraysEXT
= exec_UnlockArraysEXT
;
5831 /* GL_ARB_multitexture */
5832 table
->ActiveTextureARB
= save_ActiveTextureARB
;
5833 table
->ClientActiveTextureARB
= save_ClientActiveTextureARB
;
5835 /* GL_EXT_blend_func_separate */
5836 table
->BlendFuncSeparateEXT
= save_BlendFuncSeparateEXT
;
5838 /* GL_MESA_window_pos */
5839 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
5840 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
5841 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
5842 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
5843 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
5844 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
5845 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
5846 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
5847 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
5848 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
5849 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
5850 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
5851 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
5852 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
5853 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
5854 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
5855 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
5856 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
5857 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
5858 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
5859 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
5860 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
5861 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
5862 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
5864 /* GL_MESA_resize_buffers */
5865 table
->ResizeBuffersMESA
= exec_ResizeBuffersMESA
;
5867 /* GL_ARB_transpose_matrix */
5868 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
5869 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
5870 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
5871 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
5873 /* ARB 12. GL_ARB_texture_compression */
5874 table
->CompressedTexImage3DARB
= save_CompressedTexImage3DARB
;
5875 table
->CompressedTexImage2DARB
= save_CompressedTexImage2DARB
;
5876 table
->CompressedTexImage1DARB
= save_CompressedTexImage1DARB
;
5877 table
->CompressedTexSubImage3DARB
= save_CompressedTexSubImage3DARB
;
5878 table
->CompressedTexSubImage2DARB
= save_CompressedTexSubImage2DARB
;
5879 table
->CompressedTexSubImage1DARB
= save_CompressedTexSubImage1DARB
;
5880 table
->GetCompressedTexImageARB
= exec_GetCompressedTexImageARB
;
5882 /* GL_EXT_secondary_color */
5883 table
->SecondaryColorPointerEXT
= exec_SecondaryColorPointerEXT
;
5885 /* GL_EXT_fog_coord */
5886 table
->FogCoordPointerEXT
= exec_FogCoordPointerEXT
;
5894 static const char *enum_string( GLenum k
)
5896 return _mesa_lookup_enum_by_nr( k
);
5901 * Print the commands in a display list. For debugging only.
5902 * TODO: many commands aren't handled yet.
5904 static void print_list( GLcontext
*ctx
, FILE *f
, GLuint list
)
5909 if (!glIsList(list
)) {
5910 fprintf(f
,"%u is not a display list ID\n",list
);
5914 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
5916 fprintf( f
, "START-LIST %u, address %p\n", list
, (void*)n
);
5918 done
= n
? GL_FALSE
: GL_TRUE
;
5920 OpCode opcode
= n
[0].opcode
;
5921 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_DRV_0
;
5923 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
5924 ctx
->listext
.opcode
[i
].print(ctx
, &n
[1]);
5925 n
+= ctx
->listext
.opcode
[i
].size
;
5930 fprintf(f
,"accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
5933 fprintf(f
,"Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
5934 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
5936 case OPCODE_CALL_LIST
:
5937 fprintf(f
,"CallList %d\n", (int) n
[1].ui
);
5939 case OPCODE_CALL_LIST_OFFSET
:
5940 fprintf(f
,"CallList %d + offset %u = %u\n", (int) n
[1].ui
,
5941 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
5943 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
5944 fprintf(f
,"ColorTableParameterfv %s %s %f %f %f %f\n",
5945 enum_string(n
[1].e
), enum_string(n
[2].e
),
5946 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5948 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
5949 fprintf(f
,"ColorTableParameteriv %s %s %d %d %d %d\n",
5950 enum_string(n
[1].e
), enum_string(n
[2].e
),
5951 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
5953 case OPCODE_DISABLE
:
5954 fprintf(f
,"Disable %s\n", enum_string(n
[1].e
));
5957 fprintf(f
,"Enable %s\n", enum_string(n
[1].e
));
5959 case OPCODE_FRUSTUM
:
5960 fprintf(f
,"Frustum %g %g %g %g %g %g\n",
5961 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5963 case OPCODE_LINE_STIPPLE
:
5964 fprintf(f
,"LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
5966 case OPCODE_LOAD_IDENTITY
:
5967 fprintf(f
,"LoadIdentity\n");
5969 case OPCODE_LOAD_MATRIX
:
5970 fprintf(f
,"LoadMatrix\n");
5971 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
5972 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
5973 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
5974 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
5976 case OPCODE_MULT_MATRIX
:
5977 fprintf(f
,"MultMatrix (or Rotate)\n");
5978 fprintf(f
," %8f %8f %8f %8f\n", n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
5979 fprintf(f
," %8f %8f %8f %8f\n", n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
5980 fprintf(f
," %8f %8f %8f %8f\n", n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
5981 fprintf(f
," %8f %8f %8f %8f\n", n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
5984 fprintf(f
,"Ortho %g %g %g %g %g %g\n",
5985 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
5987 case OPCODE_POP_ATTRIB
:
5988 fprintf(f
,"PopAttrib\n");
5990 case OPCODE_POP_MATRIX
:
5991 fprintf(f
,"PopMatrix\n");
5993 case OPCODE_POP_NAME
:
5994 fprintf(f
,"PopName\n");
5996 case OPCODE_PUSH_ATTRIB
:
5997 fprintf(f
,"PushAttrib %x\n", n
[1].bf
);
5999 case OPCODE_PUSH_MATRIX
:
6000 fprintf(f
,"PushMatrix\n");
6002 case OPCODE_PUSH_NAME
:
6003 fprintf(f
,"PushName %d\n", (int) n
[1].ui
);
6005 case OPCODE_RASTER_POS
:
6006 fprintf(f
,"RasterPos %g %g %g %g\n", n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
6009 fprintf(f
,"Rotate %g %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6012 fprintf(f
,"Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
6014 case OPCODE_TRANSLATE
:
6015 fprintf(f
,"Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
6017 case OPCODE_BIND_TEXTURE
:
6018 fprintf(f
,"BindTexture %s %d\n", _mesa_lookup_enum_by_nr(n
[1].ui
),
6021 case OPCODE_SHADE_MODEL
:
6022 fprintf(f
,"ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
6025 fprintf(f
,"Map1 %s %.3f %.3f %d %d\n",
6026 _mesa_lookup_enum_by_nr(n
[1].ui
),
6027 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
6030 fprintf(f
,"Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
6031 _mesa_lookup_enum_by_nr(n
[1].ui
),
6032 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
6033 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
6035 case OPCODE_MAPGRID1
:
6036 fprintf(f
,"MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
6038 case OPCODE_MAPGRID2
:
6039 fprintf(f
,"MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
6040 n
[1].i
, n
[2].f
, n
[3].f
,
6041 n
[4].i
, n
[5].f
, n
[6].f
);
6043 case OPCODE_EVALMESH1
:
6044 fprintf(f
,"EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
6046 case OPCODE_EVALMESH2
:
6047 fprintf(f
,"EvalMesh2 %d %d %d %d\n",
6048 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
6052 * meta opcodes/commands
6055 fprintf(f
,"Error: %s %s\n", enum_string(n
[1].e
), (const char *)n
[2].data
);
6057 case OPCODE_CONTINUE
:
6058 fprintf(f
,"DISPLAY-LIST-CONTINUE\n");
6059 n
= (Node
*) n
[1].next
;
6061 case OPCODE_END_OF_LIST
:
6062 fprintf(f
,"END-LIST %u\n", list
);
6066 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
6067 fprintf(f
,"ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
6072 fprintf(f
,"command %d, %u operands\n",opcode
,InstSize
[opcode
]);
6075 /* increment n to point to next compiled command */
6076 if (opcode
!=OPCODE_CONTINUE
) {
6077 n
+= InstSize
[opcode
];
6086 * Clients may call this function to help debug display list problems.
6087 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
6088 * changed, or break in the future without notice.
6090 void mesa_print_display_list( GLuint list
)
6092 GET_CURRENT_CONTEXT(ctx
);
6093 print_list( ctx
, stderr
, list
);