3 * Display lists management functions.
7 * Mesa 3-D graphics library
10 * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
19 * The above copyright notice and this permission notice shall be included
20 * in all copies or substantial portions of the Software.
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 #include "api_loopback.h"
35 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
36 #include "arbprogram.h"
52 #include "extensions.h"
57 #include "histogram.h"
73 #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
74 #include "nvprogram.h"
78 #include "math/m_matrix.h"
79 #include "math/m_xform.h"
84 * Functions which aren't compiled but executed immediately:
88 * - glEndList --- BUT: call ctx->Driver.EndList at end of list execution?
99 * Functions which cause errors if called while compiling a display list:
106 * Display list instructions are stored as sequences of "nodes". Nodes
107 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
108 * are linked together with a pointer.
113 * How many nodes to allocate at a time.
115 * \note Reduced now that we hold vertices etc. elsewhere.
117 #define BLOCK_SIZE 256
121 * Display list opcodes.
123 * The fact that these identifiers are assigned consecutive
124 * integer values starting at 0 is very important, see InstSize array usage)
132 OPCODE_BLEND_EQUATION
,
134 OPCODE_BLEND_FUNC_SEPARATE
,
136 OPCODE_CALL_LIST_OFFSET
,
142 OPCODE_CLEAR_STENCIL
,
145 OPCODE_COLOR_MATERIAL
,
147 OPCODE_COLOR_TABLE_PARAMETER_FV
,
148 OPCODE_COLOR_TABLE_PARAMETER_IV
,
149 OPCODE_COLOR_SUB_TABLE
,
150 OPCODE_CONVOLUTION_FILTER_1D
,
151 OPCODE_CONVOLUTION_FILTER_2D
,
152 OPCODE_CONVOLUTION_PARAMETER_I
,
153 OPCODE_CONVOLUTION_PARAMETER_IV
,
154 OPCODE_CONVOLUTION_PARAMETER_F
,
155 OPCODE_CONVOLUTION_PARAMETER_FV
,
156 OPCODE_COPY_COLOR_SUB_TABLE
,
157 OPCODE_COPY_COLOR_TABLE
,
159 OPCODE_COPY_TEX_IMAGE1D
,
160 OPCODE_COPY_TEX_IMAGE2D
,
161 OPCODE_COPY_TEX_SUB_IMAGE1D
,
162 OPCODE_COPY_TEX_SUB_IMAGE2D
,
163 OPCODE_COPY_TEX_SUB_IMAGE3D
,
186 OPCODE_LOAD_IDENTITY
,
200 OPCODE_PIXEL_TRANSFER
,
203 OPCODE_POINT_PARAMETERS
,
205 OPCODE_POLYGON_STIPPLE
,
206 OPCODE_POLYGON_OFFSET
,
210 OPCODE_PRIORITIZE_TEXTURE
,
216 OPCODE_RESET_HISTOGRAM
,
217 OPCODE_RESET_MIN_MAX
,
221 OPCODE_SELECT_TEXTURE_SGIS
,
222 OPCODE_SELECT_TEXTURE_COORD_SET
,
233 OPCODE_TEX_SUB_IMAGE1D
,
234 OPCODE_TEX_SUB_IMAGE2D
,
235 OPCODE_TEX_SUB_IMAGE3D
,
239 /* GL_ARB_multitexture */
240 OPCODE_ACTIVE_TEXTURE
,
241 /* GL_SGIX/SGIS_pixel_texture */
242 OPCODE_PIXEL_TEXGEN_SGIX
,
243 OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
,
244 /* GL_ARB_texture_compression */
245 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
246 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
247 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
248 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
249 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
250 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
251 /* GL_ARB_multisample */
252 OPCODE_SAMPLE_COVERAGE
,
253 /* GL_ARB_window_pos */
254 OPCODE_WINDOW_POS_ARB
,
255 /* GL_NV_vertex_program */
256 OPCODE_BIND_PROGRAM_NV
,
257 OPCODE_EXECUTE_PROGRAM_NV
,
258 OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
,
259 OPCODE_LOAD_PROGRAM_NV
,
260 OPCODE_PROGRAM_PARAMETER4F_NV
,
261 OPCODE_TRACK_MATRIX_NV
,
262 /* GL_NV_fragment_program */
263 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
264 OPCODE_PROGRAM_NAMED_PARAMETER_NV
,
265 /* GL_EXT_stencil_two_side */
266 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
267 /* GL_EXT_depth_bounds_test */
268 OPCODE_DEPTH_BOUNDS_EXT
,
269 /* The following three are meta instructions */
270 OPCODE_ERROR
, /* raise compiled-in error */
280 * Each instruction in the display list is stored as a sequence of
281 * contiguous nodes in memory.
282 * Each node is the union of a variety of data types.
296 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
301 * Number of nodes of storage needed for each instruction.
302 * Sizes for dynamically allocated opcodes are stored in the context struct.
304 static GLuint InstSize
[ OPCODE_END_OF_LIST
+1 ];
306 void mesa_print_display_list( GLuint list
);
309 /**********************************************************************/
310 /***** Private *****/
311 /**********************************************************************/
314 * Make an empty display list. This is used by glGenLists() to
315 * reserver display list IDs.
317 static Node
*make_empty_list( void )
319 Node
*n
= (Node
*) MALLOC( sizeof(Node
) );
320 n
[0].opcode
= OPCODE_END_OF_LIST
;
327 * Destroy all nodes in a display list.
328 * \param list - display list number
330 void _mesa_destroy_list( GLcontext
*ctx
, GLuint list
)
338 block
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
341 done
= block
? GL_FALSE
: GL_TRUE
;
344 /* check for extension opcodes first */
346 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_DRV_0
;
347 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
348 ctx
->listext
.opcode
[i
].destroy(ctx
, &n
[1]);
349 n
+= ctx
->listext
.opcode
[i
].size
;
352 switch (n
[0].opcode
) {
353 /* for some commands, we need to free malloc'd memory */
356 n
+= InstSize
[n
[0].opcode
];
360 n
+= InstSize
[n
[0].opcode
];
362 case OPCODE_DRAW_PIXELS
:
364 n
+= InstSize
[n
[0].opcode
];
368 n
+= InstSize
[n
[0].opcode
];
370 case OPCODE_COLOR_TABLE
:
372 n
+= InstSize
[n
[0].opcode
];
374 case OPCODE_COLOR_SUB_TABLE
:
376 n
+= InstSize
[n
[0].opcode
];
378 case OPCODE_CONVOLUTION_FILTER_1D
:
380 n
+= InstSize
[n
[0].opcode
];
382 case OPCODE_CONVOLUTION_FILTER_2D
:
384 n
+= InstSize
[n
[0].opcode
];
386 case OPCODE_POLYGON_STIPPLE
:
388 n
+= InstSize
[n
[0].opcode
];
390 case OPCODE_TEX_IMAGE1D
:
392 n
+= InstSize
[n
[0].opcode
];
394 case OPCODE_TEX_IMAGE2D
:
396 n
+= InstSize
[n
[0].opcode
];
398 case OPCODE_TEX_IMAGE3D
:
400 n
+= InstSize
[n
[0].opcode
];
402 case OPCODE_TEX_SUB_IMAGE1D
:
404 n
+= InstSize
[n
[0].opcode
];
406 case OPCODE_TEX_SUB_IMAGE2D
:
408 n
+= InstSize
[n
[0].opcode
];
410 case OPCODE_TEX_SUB_IMAGE3D
:
412 n
+= InstSize
[n
[0].opcode
];
414 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
416 n
+= InstSize
[n
[0].opcode
];
418 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
420 n
+= InstSize
[n
[0].opcode
];
422 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
424 n
+= InstSize
[n
[0].opcode
];
426 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
428 n
+= InstSize
[n
[0].opcode
];
430 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
432 n
+= InstSize
[n
[0].opcode
];
434 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
436 n
+= InstSize
[n
[0].opcode
];
438 #if FEATURE_NV_vertex_program
439 case OPCODE_LOAD_PROGRAM_NV
:
441 n
+= InstSize
[n
[0].opcode
];
443 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
445 n
+= InstSize
[n
[0].opcode
];
448 #if FEATURE_NV_fragment_program
449 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
451 n
+= InstSize
[n
[0].opcode
];
454 case OPCODE_CONTINUE
:
455 n
= (Node
*) n
[1].next
;
459 case OPCODE_END_OF_LIST
:
464 /* Most frequent case */
465 n
+= InstSize
[n
[0].opcode
];
471 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
477 * Translate the nth element of list from type to GLuint.
479 static GLuint
translate_id( GLsizei n
, GLenum type
, const GLvoid
*list
)
491 bptr
= (GLbyte
*) list
;
492 return (GLuint
) *(bptr
+n
);
493 case GL_UNSIGNED_BYTE
:
494 ubptr
= (GLubyte
*) list
;
495 return (GLuint
) *(ubptr
+n
);
497 sptr
= (GLshort
*) list
;
498 return (GLuint
) *(sptr
+n
);
499 case GL_UNSIGNED_SHORT
:
500 usptr
= (GLushort
*) list
;
501 return (GLuint
) *(usptr
+n
);
503 iptr
= (GLint
*) list
;
504 return (GLuint
) *(iptr
+n
);
505 case GL_UNSIGNED_INT
:
506 uiptr
= (GLuint
*) list
;
507 return (GLuint
) *(uiptr
+n
);
509 fptr
= (GLfloat
*) list
;
510 return (GLuint
) *(fptr
+n
);
512 ubptr
= ((GLubyte
*) list
) + 2*n
;
513 return (GLuint
) *ubptr
* 256 + (GLuint
) *(ubptr
+1);
515 ubptr
= ((GLubyte
*) list
) + 3*n
;
516 return (GLuint
) *ubptr
* 65536
517 + (GLuint
) *(ubptr
+1) * 256
518 + (GLuint
) *(ubptr
+2);
520 ubptr
= ((GLubyte
*) list
) + 4*n
;
521 return (GLuint
) *ubptr
* 16777216
522 + (GLuint
) *(ubptr
+1) * 65536
523 + (GLuint
) *(ubptr
+2) * 256
524 + (GLuint
) *(ubptr
+3);
533 /**********************************************************************/
535 /**********************************************************************/
537 void _mesa_init_lists( void )
539 static int init_flag
= 0;
542 InstSize
[OPCODE_ACCUM
] = 3;
543 InstSize
[OPCODE_ALPHA_FUNC
] = 3;
544 InstSize
[OPCODE_BIND_TEXTURE
] = 3;
545 InstSize
[OPCODE_BITMAP
] = 8;
546 InstSize
[OPCODE_BLEND_COLOR
] = 5;
547 InstSize
[OPCODE_BLEND_EQUATION
] = 2;
548 InstSize
[OPCODE_BLEND_FUNC
] = 3;
549 InstSize
[OPCODE_BLEND_FUNC_SEPARATE
] = 5;
550 InstSize
[OPCODE_CALL_LIST
] = 2;
551 InstSize
[OPCODE_CALL_LIST_OFFSET
] = 3;
552 InstSize
[OPCODE_CLEAR
] = 2;
553 InstSize
[OPCODE_CLEAR_ACCUM
] = 5;
554 InstSize
[OPCODE_CLEAR_COLOR
] = 5;
555 InstSize
[OPCODE_CLEAR_DEPTH
] = 2;
556 InstSize
[OPCODE_CLEAR_INDEX
] = 2;
557 InstSize
[OPCODE_CLEAR_STENCIL
] = 2;
558 InstSize
[OPCODE_CLIP_PLANE
] = 6;
559 InstSize
[OPCODE_COLOR_MASK
] = 5;
560 InstSize
[OPCODE_COLOR_MATERIAL
] = 3;
561 InstSize
[OPCODE_COLOR_TABLE
] = 7;
562 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_FV
] = 7;
563 InstSize
[OPCODE_COLOR_TABLE_PARAMETER_IV
] = 7;
564 InstSize
[OPCODE_COLOR_SUB_TABLE
] = 7;
565 InstSize
[OPCODE_CONVOLUTION_FILTER_1D
] = 7;
566 InstSize
[OPCODE_CONVOLUTION_FILTER_2D
] = 8;
567 InstSize
[OPCODE_CONVOLUTION_PARAMETER_I
] = 4;
568 InstSize
[OPCODE_CONVOLUTION_PARAMETER_IV
] = 7;
569 InstSize
[OPCODE_CONVOLUTION_PARAMETER_F
] = 4;
570 InstSize
[OPCODE_CONVOLUTION_PARAMETER_FV
] = 7;
571 InstSize
[OPCODE_COPY_PIXELS
] = 6;
572 InstSize
[OPCODE_COPY_COLOR_SUB_TABLE
] = 6;
573 InstSize
[OPCODE_COPY_COLOR_TABLE
] = 6;
574 InstSize
[OPCODE_COPY_TEX_IMAGE1D
] = 8;
575 InstSize
[OPCODE_COPY_TEX_IMAGE2D
] = 9;
576 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE1D
] = 7;
577 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE2D
] = 9;
578 InstSize
[OPCODE_COPY_TEX_SUB_IMAGE3D
] = 10;
579 InstSize
[OPCODE_CULL_FACE
] = 2;
580 InstSize
[OPCODE_DEPTH_FUNC
] = 2;
581 InstSize
[OPCODE_DEPTH_MASK
] = 2;
582 InstSize
[OPCODE_DEPTH_RANGE
] = 3;
583 InstSize
[OPCODE_DISABLE
] = 2;
584 InstSize
[OPCODE_DRAW_BUFFER
] = 2;
585 InstSize
[OPCODE_DRAW_PIXELS
] = 6;
586 InstSize
[OPCODE_ENABLE
] = 2;
587 InstSize
[OPCODE_EVALMESH1
] = 4;
588 InstSize
[OPCODE_EVALMESH2
] = 6;
589 InstSize
[OPCODE_FOG
] = 6;
590 InstSize
[OPCODE_FRONT_FACE
] = 2;
591 InstSize
[OPCODE_FRUSTUM
] = 7;
592 InstSize
[OPCODE_HINT
] = 3;
593 InstSize
[OPCODE_HISTOGRAM
] = 5;
594 InstSize
[OPCODE_INDEX_MASK
] = 2;
595 InstSize
[OPCODE_INIT_NAMES
] = 1;
596 InstSize
[OPCODE_LIGHT
] = 7;
597 InstSize
[OPCODE_LIGHT_MODEL
] = 6;
598 InstSize
[OPCODE_LINE_STIPPLE
] = 3;
599 InstSize
[OPCODE_LINE_WIDTH
] = 2;
600 InstSize
[OPCODE_LIST_BASE
] = 2;
601 InstSize
[OPCODE_LOAD_IDENTITY
] = 1;
602 InstSize
[OPCODE_LOAD_MATRIX
] = 17;
603 InstSize
[OPCODE_LOAD_NAME
] = 2;
604 InstSize
[OPCODE_LOGIC_OP
] = 2;
605 InstSize
[OPCODE_MAP1
] = 7;
606 InstSize
[OPCODE_MAP2
] = 11;
607 InstSize
[OPCODE_MAPGRID1
] = 4;
608 InstSize
[OPCODE_MAPGRID2
] = 7;
609 InstSize
[OPCODE_MATRIX_MODE
] = 2;
610 InstSize
[OPCODE_MIN_MAX
] = 4;
611 InstSize
[OPCODE_MULT_MATRIX
] = 17;
612 InstSize
[OPCODE_ORTHO
] = 7;
613 InstSize
[OPCODE_PASSTHROUGH
] = 2;
614 InstSize
[OPCODE_PIXEL_MAP
] = 4;
615 InstSize
[OPCODE_PIXEL_TRANSFER
] = 3;
616 InstSize
[OPCODE_PIXEL_ZOOM
] = 3;
617 InstSize
[OPCODE_POINT_SIZE
] = 2;
618 InstSize
[OPCODE_POINT_PARAMETERS
] = 5;
619 InstSize
[OPCODE_POLYGON_MODE
] = 3;
620 InstSize
[OPCODE_POLYGON_STIPPLE
] = 2;
621 InstSize
[OPCODE_POLYGON_OFFSET
] = 3;
622 InstSize
[OPCODE_POP_ATTRIB
] = 1;
623 InstSize
[OPCODE_POP_MATRIX
] = 1;
624 InstSize
[OPCODE_POP_NAME
] = 1;
625 InstSize
[OPCODE_PRIORITIZE_TEXTURE
] = 3;
626 InstSize
[OPCODE_PUSH_ATTRIB
] = 2;
627 InstSize
[OPCODE_PUSH_MATRIX
] = 1;
628 InstSize
[OPCODE_PUSH_NAME
] = 2;
629 InstSize
[OPCODE_RASTER_POS
] = 5;
630 InstSize
[OPCODE_READ_BUFFER
] = 2;
631 InstSize
[OPCODE_RESET_HISTOGRAM
] = 2;
632 InstSize
[OPCODE_RESET_MIN_MAX
] = 2;
633 InstSize
[OPCODE_ROTATE
] = 5;
634 InstSize
[OPCODE_SCALE
] = 4;
635 InstSize
[OPCODE_SCISSOR
] = 5;
636 InstSize
[OPCODE_STENCIL_FUNC
] = 4;
637 InstSize
[OPCODE_STENCIL_MASK
] = 2;
638 InstSize
[OPCODE_STENCIL_OP
] = 4;
639 InstSize
[OPCODE_SHADE_MODEL
] = 2;
640 InstSize
[OPCODE_TEXENV
] = 7;
641 InstSize
[OPCODE_TEXGEN
] = 7;
642 InstSize
[OPCODE_TEXPARAMETER
] = 7;
643 InstSize
[OPCODE_TEX_IMAGE1D
] = 9;
644 InstSize
[OPCODE_TEX_IMAGE2D
] = 10;
645 InstSize
[OPCODE_TEX_IMAGE3D
] = 11;
646 InstSize
[OPCODE_TEX_SUB_IMAGE1D
] = 8;
647 InstSize
[OPCODE_TEX_SUB_IMAGE2D
] = 10;
648 InstSize
[OPCODE_TEX_SUB_IMAGE3D
] = 12;
649 InstSize
[OPCODE_TRANSLATE
] = 4;
650 InstSize
[OPCODE_VIEWPORT
] = 5;
651 InstSize
[OPCODE_WINDOW_POS
] = 5;
652 InstSize
[OPCODE_CONTINUE
] = 2;
653 InstSize
[OPCODE_ERROR
] = 3;
654 InstSize
[OPCODE_END_OF_LIST
] = 1;
655 /* GL_SGIX/SGIS_pixel_texture */
656 InstSize
[OPCODE_PIXEL_TEXGEN_SGIX
] = 2;
657 InstSize
[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
] = 3;
658 /* GL_ARB_texture_compression */
659 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_1D
] = 8;
660 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_2D
] = 9;
661 InstSize
[OPCODE_COMPRESSED_TEX_IMAGE_3D
] = 10;
662 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
] = 8;
663 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
] = 10;
664 InstSize
[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
] = 12;
665 /* GL_ARB_multisample */
666 InstSize
[OPCODE_SAMPLE_COVERAGE
] = 3;
667 /* GL_ARB_multitexture */
668 InstSize
[OPCODE_ACTIVE_TEXTURE
] = 2;
669 /* GL_ARB_window_pos */
670 InstSize
[OPCODE_WINDOW_POS_ARB
] = 4;
671 /* GL_NV_vertex_program */
672 InstSize
[OPCODE_BIND_PROGRAM_NV
] = 3;
673 InstSize
[OPCODE_EXECUTE_PROGRAM_NV
] = 7;
674 InstSize
[OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
] = 2;
675 InstSize
[OPCODE_LOAD_PROGRAM_NV
] = 5;
676 InstSize
[OPCODE_PROGRAM_PARAMETER4F_NV
] = 7;
677 InstSize
[OPCODE_TRACK_MATRIX_NV
] = 5;
678 /* GL_NV_fragment_program */
679 InstSize
[OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
] = 7;
680 InstSize
[OPCODE_PROGRAM_NAMED_PARAMETER_NV
] = 8;
681 /* GL_EXT_stencil_two_side */
682 InstSize
[OPCODE_ACTIVE_STENCIL_FACE_EXT
] = 2;
683 /* GL_EXT_depth_bounds_test */
684 InstSize
[OPCODE_DEPTH_BOUNDS_EXT
] = 3;
691 * Allocate space for a display list instruction.
692 * \param opcode - type of instruction
693 * argcount - size in bytes of data required.
694 * \return pointer to the usable data area (not including the internal
698 _mesa_alloc_instruction( GLcontext
*ctx
, int opcode
, GLint sz
)
701 GLuint count
= 1 + (sz
+ sizeof(Node
) - 1) / sizeof(Node
);
704 if (opcode
< (int) OPCODE_DRV_0
) {
705 assert( count
== InstSize
[opcode
] );
709 if (ctx
->CurrentPos
+ count
+ 2 > BLOCK_SIZE
) {
710 /* This block is full. Allocate a new block and chain to it */
711 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
712 n
[0].opcode
= OPCODE_CONTINUE
;
713 newblock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
715 _mesa_error( ctx
, GL_OUT_OF_MEMORY
, "Building display list" );
718 n
[1].next
= (Node
*) newblock
;
719 ctx
->CurrentBlock
= newblock
;
723 n
= ctx
->CurrentBlock
+ ctx
->CurrentPos
;
724 ctx
->CurrentPos
+= count
;
726 n
[0].opcode
= (OpCode
) opcode
;
728 return (void *)&n
[1];
732 /* Allow modules and drivers to get their own opcodes.
735 _mesa_alloc_opcode( GLcontext
*ctx
,
737 void (*execute
)( GLcontext
*, void * ),
738 void (*destroy
)( GLcontext
*, void * ),
739 void (*print
)( GLcontext
*, void * ) )
741 if (ctx
->listext
.nr_opcodes
< GL_MAX_EXT_OPCODES
) {
742 GLuint i
= ctx
->listext
.nr_opcodes
++;
743 ctx
->listext
.opcode
[i
].size
= 1 + (sz
+ sizeof(Node
) - 1)/sizeof(Node
);
744 ctx
->listext
.opcode
[i
].execute
= execute
;
745 ctx
->listext
.opcode
[i
].destroy
= destroy
;
746 ctx
->listext
.opcode
[i
].print
= print
;
747 return i
+ OPCODE_DRV_0
;
754 /* Mimic the old behaviour of alloc_instruction:
755 * - sz is in units of sizeof(Node)
756 * - return value a pointer to sizeof(Node) before the actual
759 #define ALLOC_INSTRUCTION(ctx, opcode, sz) \
760 ((Node *)_mesa_alloc_instruction(ctx, opcode, sz*sizeof(Node)) - 1)
765 * Display List compilation functions
767 static void save_Accum( GLenum op
, GLfloat value
)
769 GET_CURRENT_CONTEXT(ctx
);
771 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
772 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACCUM
, 2 );
777 if (ctx
->ExecuteFlag
) {
778 (*ctx
->Exec
->Accum
)( op
, value
);
783 static void save_AlphaFunc( GLenum func
, GLclampf ref
)
785 GET_CURRENT_CONTEXT(ctx
);
787 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
788 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ALPHA_FUNC
, 2 );
791 n
[2].f
= (GLfloat
) ref
;
793 if (ctx
->ExecuteFlag
) {
794 (*ctx
->Exec
->AlphaFunc
)( func
, ref
);
799 static void save_BindTexture( GLenum target
, GLuint texture
)
801 GET_CURRENT_CONTEXT(ctx
);
803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
804 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_TEXTURE
, 2 );
809 if (ctx
->ExecuteFlag
) {
810 (*ctx
->Exec
->BindTexture
)( target
, texture
);
815 static void save_Bitmap( GLsizei width
, GLsizei height
,
816 GLfloat xorig
, GLfloat yorig
,
817 GLfloat xmove
, GLfloat ymove
,
818 const GLubyte
*pixels
)
820 GET_CURRENT_CONTEXT(ctx
);
821 GLvoid
*image
= _mesa_unpack_bitmap( width
, height
, pixels
, &ctx
->Unpack
);
823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
824 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BITMAP
, 7 );
826 n
[1].i
= (GLint
) width
;
827 n
[2].i
= (GLint
) height
;
837 if (ctx
->ExecuteFlag
) {
838 (*ctx
->Exec
->Bitmap
)( width
, height
,
839 xorig
, yorig
, xmove
, ymove
, pixels
);
844 static void save_BlendEquation( GLenum mode
)
846 GET_CURRENT_CONTEXT(ctx
);
848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
849 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_EQUATION
, 1 );
853 if (ctx
->ExecuteFlag
) {
854 (*ctx
->Exec
->BlendEquation
)( mode
);
859 static void save_BlendFunc( GLenum sfactor
, GLenum dfactor
)
861 GET_CURRENT_CONTEXT(ctx
);
863 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
864 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_FUNC
, 2 );
869 if (ctx
->ExecuteFlag
) {
870 (*ctx
->Exec
->BlendFunc
)( sfactor
, dfactor
);
875 static void save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
876 GLenum sfactorA
, GLenum dfactorA
)
878 GET_CURRENT_CONTEXT(ctx
);
880 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
881 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4 );
888 if (ctx
->ExecuteFlag
) {
889 (*ctx
->Exec
->BlendFuncSeparateEXT
)( sfactorRGB
, dfactorRGB
,
895 static void save_BlendColor( GLfloat red
, GLfloat green
,
896 GLfloat blue
, GLfloat alpha
)
898 GET_CURRENT_CONTEXT(ctx
);
900 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
901 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BLEND_COLOR
, 4 );
908 if (ctx
->ExecuteFlag
) {
909 (*ctx
->Exec
->BlendColor
)( red
, green
, blue
, alpha
);
914 void _mesa_save_CallList( GLuint list
)
916 GET_CURRENT_CONTEXT(ctx
);
918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
919 FLUSH_CURRENT(ctx
, 0);
921 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CALL_LIST
, 1 );
925 if (ctx
->ExecuteFlag
) {
926 (*ctx
->Exec
->CallList
)( list
);
931 void _mesa_save_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
933 GET_CURRENT_CONTEXT(ctx
);
935 GLboolean typeErrorFlag
;
937 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
938 FLUSH_CURRENT(ctx
, 0);
942 case GL_UNSIGNED_BYTE
:
944 case GL_UNSIGNED_SHORT
:
946 case GL_UNSIGNED_INT
:
951 typeErrorFlag
= GL_FALSE
;
954 typeErrorFlag
= GL_TRUE
;
958 GLuint list
= translate_id( i
, type
, lists
);
959 Node
*n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CALL_LIST_OFFSET
, 2 );
962 n
[2].b
= typeErrorFlag
;
965 if (ctx
->ExecuteFlag
) {
966 (*ctx
->Exec
->CallLists
)( n
, type
, lists
);
971 static void save_Clear( GLbitfield mask
)
973 GET_CURRENT_CONTEXT(ctx
);
975 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
976 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR
, 1 );
980 if (ctx
->ExecuteFlag
) {
981 (*ctx
->Exec
->Clear
)( mask
);
986 static void save_ClearAccum( GLfloat red
, GLfloat green
,
987 GLfloat blue
, GLfloat alpha
)
989 GET_CURRENT_CONTEXT(ctx
);
991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
992 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_ACCUM
, 4 );
999 if (ctx
->ExecuteFlag
) {
1000 (*ctx
->Exec
->ClearAccum
)( red
, green
, blue
, alpha
);
1005 static void save_ClearColor( GLclampf red
, GLclampf green
,
1006 GLclampf blue
, GLclampf alpha
)
1008 GET_CURRENT_CONTEXT(ctx
);
1010 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1011 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_COLOR
, 4 );
1018 if (ctx
->ExecuteFlag
) {
1019 (*ctx
->Exec
->ClearColor
)( red
, green
, blue
, alpha
);
1024 static void save_ClearDepth( GLclampd depth
)
1026 GET_CURRENT_CONTEXT(ctx
);
1028 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1029 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_DEPTH
, 1 );
1031 n
[1].f
= (GLfloat
) depth
;
1033 if (ctx
->ExecuteFlag
) {
1034 (*ctx
->Exec
->ClearDepth
)( depth
);
1039 static void save_ClearIndex( GLfloat c
)
1041 GET_CURRENT_CONTEXT(ctx
);
1043 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1044 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_INDEX
, 1 );
1048 if (ctx
->ExecuteFlag
) {
1049 (*ctx
->Exec
->ClearIndex
)( c
);
1054 static void save_ClearStencil( GLint s
)
1056 GET_CURRENT_CONTEXT(ctx
);
1058 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1059 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLEAR_STENCIL
, 1 );
1063 if (ctx
->ExecuteFlag
) {
1064 (*ctx
->Exec
->ClearStencil
)( s
);
1069 static void save_ClipPlane( GLenum plane
, const GLdouble
*equ
)
1071 GET_CURRENT_CONTEXT(ctx
);
1073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1074 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CLIP_PLANE
, 5 );
1077 n
[2].f
= (GLfloat
) equ
[0];
1078 n
[3].f
= (GLfloat
) equ
[1];
1079 n
[4].f
= (GLfloat
) equ
[2];
1080 n
[5].f
= (GLfloat
) equ
[3];
1082 if (ctx
->ExecuteFlag
) {
1083 (*ctx
->Exec
->ClipPlane
)( plane
, equ
);
1089 static void save_ColorMask( GLboolean red
, GLboolean green
,
1090 GLboolean blue
, GLboolean alpha
)
1092 GET_CURRENT_CONTEXT(ctx
);
1094 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1095 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_MASK
, 4 );
1102 if (ctx
->ExecuteFlag
) {
1103 (*ctx
->Exec
->ColorMask
)( red
, green
, blue
, alpha
);
1108 static void save_ColorMaterial( GLenum face
, GLenum mode
)
1110 GET_CURRENT_CONTEXT(ctx
);
1112 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1113 FLUSH_CURRENT(ctx
, 0);
1115 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_MATERIAL
, 2 );
1120 if (ctx
->ExecuteFlag
) {
1121 (*ctx
->Exec
->ColorMaterial
)( face
, mode
);
1126 static void save_ColorTable( GLenum target
, GLenum internalFormat
,
1127 GLsizei width
, GLenum format
, GLenum type
,
1128 const GLvoid
*table
)
1130 GET_CURRENT_CONTEXT(ctx
);
1131 if (target
== GL_PROXY_TEXTURE_1D
||
1132 target
== GL_PROXY_TEXTURE_2D
||
1133 target
== GL_PROXY_TEXTURE_3D
||
1134 target
== GL_PROXY_TEXTURE_CUBE_MAP_ARB
) {
1135 /* execute immediately */
1136 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1137 format
, type
, table
);
1140 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, table
,
1143 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1144 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE
, 6 );
1147 n
[2].e
= internalFormat
;
1156 if (ctx
->ExecuteFlag
) {
1157 (*ctx
->Exec
->ColorTable
)( target
, internalFormat
, width
,
1158 format
, type
, table
);
1166 save_ColorTableParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1168 GET_CURRENT_CONTEXT(ctx
);
1171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1173 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6 );
1178 if (pname
== GL_COLOR_TABLE_SGI
||
1179 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1180 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1181 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1188 if (ctx
->ExecuteFlag
) {
1189 (*ctx
->Exec
->ColorTableParameterfv
)( target
, pname
, params
);
1195 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1197 GET_CURRENT_CONTEXT(ctx
);
1200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1202 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6 );
1207 if (pname
== GL_COLOR_TABLE_SGI
||
1208 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1209 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
||
1210 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1217 if (ctx
->ExecuteFlag
) {
1218 (*ctx
->Exec
->ColorTableParameteriv
)( target
, pname
, params
);
1224 static void save_ColorSubTable( GLenum target
, GLsizei start
, GLsizei count
,
1225 GLenum format
, GLenum type
,
1226 const GLvoid
*table
)
1228 GET_CURRENT_CONTEXT(ctx
);
1229 GLvoid
*image
= _mesa_unpack_image(count
, 1, 1, format
, type
, table
,
1232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1233 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COLOR_SUB_TABLE
, 6 );
1245 if (ctx
->ExecuteFlag
) {
1246 (*ctx
->Exec
->ColorSubTable
)(target
, start
, count
, format
, type
, table
);
1252 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1253 GLint x
, GLint y
, GLsizei width
)
1255 GET_CURRENT_CONTEXT(ctx
);
1258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1259 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5 );
1267 if (ctx
->ExecuteFlag
) {
1268 (*ctx
->Exec
->CopyColorSubTable
)(target
, start
, x
, y
, width
);
1274 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1275 GLint x
, GLint y
, GLsizei width
)
1277 GET_CURRENT_CONTEXT(ctx
);
1280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1281 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_COLOR_TABLE
, 5 );
1284 n
[2].e
= internalformat
;
1289 if (ctx
->ExecuteFlag
) {
1290 (*ctx
->Exec
->CopyColorTable
)(target
, internalformat
, x
, y
, width
);
1296 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1297 GLenum format
, GLenum type
, const GLvoid
*filter
)
1299 GET_CURRENT_CONTEXT(ctx
);
1300 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
, filter
,
1303 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1304 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6 );
1307 n
[2].e
= internalFormat
;
1316 if (ctx
->ExecuteFlag
) {
1317 (*ctx
->Exec
->ConvolutionFilter1D
)( target
, internalFormat
, width
,
1318 format
, type
, filter
);
1324 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1325 GLsizei width
, GLsizei height
, GLenum format
,
1326 GLenum type
, const GLvoid
*filter
)
1328 GET_CURRENT_CONTEXT(ctx
);
1329 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
, filter
,
1332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1333 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7 );
1336 n
[2].e
= internalFormat
;
1346 if (ctx
->ExecuteFlag
) {
1347 (*ctx
->Exec
->ConvolutionFilter2D
)( target
, internalFormat
, width
, height
,
1348 format
, type
, filter
);
1354 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1356 GET_CURRENT_CONTEXT(ctx
);
1358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1359 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3 );
1365 if (ctx
->ExecuteFlag
) {
1366 (*ctx
->Exec
->ConvolutionParameteri
)( target
, pname
, param
);
1372 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1374 GET_CURRENT_CONTEXT(ctx
);
1376 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1377 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6 );
1382 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1383 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1384 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1390 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1393 if (ctx
->ExecuteFlag
) {
1394 (*ctx
->Exec
->ConvolutionParameteriv
)( target
, pname
, params
);
1400 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1402 GET_CURRENT_CONTEXT(ctx
);
1404 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1405 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3 );
1411 if (ctx
->ExecuteFlag
) {
1412 (*ctx
->Exec
->ConvolutionParameterf
)( target
, pname
, param
);
1418 save_ConvolutionParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1420 GET_CURRENT_CONTEXT(ctx
);
1422 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1423 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6 );
1428 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1429 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1430 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1436 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
1439 if (ctx
->ExecuteFlag
) {
1440 (*ctx
->Exec
->ConvolutionParameterfv
)( target
, pname
, params
);
1446 save_CopyPixels( GLint x
, GLint y
,
1447 GLsizei width
, GLsizei height
, GLenum type
)
1449 GET_CURRENT_CONTEXT(ctx
);
1451 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1452 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_PIXELS
, 5 );
1456 n
[3].i
= (GLint
) width
;
1457 n
[4].i
= (GLint
) height
;
1460 if (ctx
->ExecuteFlag
) {
1461 (*ctx
->Exec
->CopyPixels
)( x
, y
, width
, height
, type
);
1468 save_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
1469 GLint x
, GLint y
, GLsizei width
, GLint border
)
1471 GET_CURRENT_CONTEXT(ctx
);
1473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1474 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7 );
1478 n
[3].e
= internalformat
;
1484 if (ctx
->ExecuteFlag
) {
1485 (*ctx
->Exec
->CopyTexImage1D
)( target
, level
, internalformat
,
1486 x
, y
, width
, border
);
1492 save_CopyTexImage2D( GLenum target
, GLint level
,
1493 GLenum internalformat
,
1494 GLint x
, GLint y
, GLsizei width
,
1495 GLsizei height
, GLint border
)
1497 GET_CURRENT_CONTEXT(ctx
);
1499 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1500 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8 );
1504 n
[3].e
= internalformat
;
1511 if (ctx
->ExecuteFlag
) {
1512 (*ctx
->Exec
->CopyTexImage2D
)( target
, level
, internalformat
,
1513 x
, y
, width
, height
, border
);
1520 save_CopyTexSubImage1D( GLenum target
, GLint level
,
1521 GLint xoffset
, GLint x
, GLint y
,
1524 GET_CURRENT_CONTEXT(ctx
);
1526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1527 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6 );
1536 if (ctx
->ExecuteFlag
) {
1537 (*ctx
->Exec
->CopyTexSubImage1D
)( target
, level
, xoffset
, x
, y
, width
);
1543 save_CopyTexSubImage2D( GLenum target
, GLint level
,
1544 GLint xoffset
, GLint yoffset
,
1546 GLsizei width
, GLint height
)
1548 GET_CURRENT_CONTEXT(ctx
);
1550 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1551 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8 );
1562 if (ctx
->ExecuteFlag
) {
1563 (*ctx
->Exec
->CopyTexSubImage2D
)( target
, level
, xoffset
, yoffset
,
1564 x
, y
, width
, height
);
1570 save_CopyTexSubImage3D( GLenum target
, GLint level
,
1571 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1573 GLsizei width
, GLint height
)
1575 GET_CURRENT_CONTEXT(ctx
);
1577 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1578 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9 );
1590 if (ctx
->ExecuteFlag
) {
1591 (*ctx
->Exec
->CopyTexSubImage3D
)( target
, level
,
1592 xoffset
, yoffset
, zoffset
,
1593 x
, y
, width
, height
);
1598 static void save_CullFace( GLenum mode
)
1600 GET_CURRENT_CONTEXT(ctx
);
1602 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1603 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_CULL_FACE
, 1 );
1607 if (ctx
->ExecuteFlag
) {
1608 (*ctx
->Exec
->CullFace
)( mode
);
1613 static void save_DepthFunc( GLenum func
)
1615 GET_CURRENT_CONTEXT(ctx
);
1617 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1618 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_FUNC
, 1 );
1622 if (ctx
->ExecuteFlag
) {
1623 (*ctx
->Exec
->DepthFunc
)( func
);
1628 static void save_DepthMask( GLboolean mask
)
1630 GET_CURRENT_CONTEXT(ctx
);
1632 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1633 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_MASK
, 1 );
1637 if (ctx
->ExecuteFlag
) {
1638 (*ctx
->Exec
->DepthMask
)( mask
);
1643 static void save_DepthRange( GLclampd nearval
, GLclampd farval
)
1645 GET_CURRENT_CONTEXT(ctx
);
1647 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1648 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DEPTH_RANGE
, 2 );
1650 n
[1].f
= (GLfloat
) nearval
;
1651 n
[2].f
= (GLfloat
) farval
;
1653 if (ctx
->ExecuteFlag
) {
1654 (*ctx
->Exec
->DepthRange
)( nearval
, farval
);
1659 static void save_Disable( GLenum cap
)
1661 GET_CURRENT_CONTEXT(ctx
);
1663 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1664 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DISABLE
, 1 );
1668 if (ctx
->ExecuteFlag
) {
1669 (*ctx
->Exec
->Disable
)( cap
);
1674 static void save_DrawBuffer( GLenum mode
)
1676 GET_CURRENT_CONTEXT(ctx
);
1678 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1679 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_BUFFER
, 1 );
1683 if (ctx
->ExecuteFlag
) {
1684 (*ctx
->Exec
->DrawBuffer
)( mode
);
1689 static void save_DrawPixels( GLsizei width
, GLsizei height
,
1690 GLenum format
, GLenum type
,
1691 const GLvoid
*pixels
)
1693 GET_CURRENT_CONTEXT(ctx
);
1694 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
1695 pixels
, &ctx
->Unpack
);
1697 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1698 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_DRAW_PIXELS
, 5 );
1709 if (ctx
->ExecuteFlag
) {
1710 (*ctx
->Exec
->DrawPixels
)( width
, height
, format
, type
, pixels
);
1716 static void save_Enable( GLenum cap
)
1718 GET_CURRENT_CONTEXT(ctx
);
1720 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1721 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ENABLE
, 1 );
1725 if (ctx
->ExecuteFlag
) {
1726 (*ctx
->Exec
->Enable
)( cap
);
1732 void _mesa_save_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
1734 GET_CURRENT_CONTEXT(ctx
);
1736 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1737 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH1
, 3 );
1743 if (ctx
->ExecuteFlag
) {
1744 (*ctx
->Exec
->EvalMesh1
)( mode
, i1
, i2
);
1749 void _mesa_save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
1751 GET_CURRENT_CONTEXT(ctx
);
1753 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1754 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EVALMESH2
, 5 );
1762 if (ctx
->ExecuteFlag
) {
1763 (*ctx
->Exec
->EvalMesh2
)( mode
, i1
, i2
, j1
, j2
);
1770 static void save_Fogfv( GLenum pname
, const GLfloat
*params
)
1772 GET_CURRENT_CONTEXT(ctx
);
1774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1775 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FOG
, 5 );
1783 if (ctx
->ExecuteFlag
) {
1784 (*ctx
->Exec
->Fogfv
)( pname
, params
);
1789 static void save_Fogf( GLenum pname
, GLfloat param
)
1791 save_Fogfv(pname
, ¶m
);
1795 static void save_Fogiv(GLenum pname
, const GLint
*params
)
1800 case GL_FOG_DENSITY
:
1804 p
[0] = (GLfloat
) *params
;
1807 p
[0] = INT_TO_FLOAT( params
[0] );
1808 p
[1] = INT_TO_FLOAT( params
[1] );
1809 p
[2] = INT_TO_FLOAT( params
[2] );
1810 p
[3] = INT_TO_FLOAT( params
[3] );
1813 /* Error will be caught later in gl_Fogfv */
1816 save_Fogfv(pname
, p
);
1820 static void save_Fogi(GLenum pname
, GLint param
)
1822 save_Fogiv(pname
, ¶m
);
1826 static void save_FrontFace( GLenum mode
)
1828 GET_CURRENT_CONTEXT(ctx
);
1830 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1831 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRONT_FACE
, 1 );
1835 if (ctx
->ExecuteFlag
) {
1836 (*ctx
->Exec
->FrontFace
)( mode
);
1841 static void save_Frustum( GLdouble left
, GLdouble right
,
1842 GLdouble bottom
, GLdouble top
,
1843 GLdouble nearval
, GLdouble farval
)
1845 GET_CURRENT_CONTEXT(ctx
);
1847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1848 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_FRUSTUM
, 6 );
1850 n
[1].f
= (GLfloat
) left
;
1851 n
[2].f
= (GLfloat
) right
;
1852 n
[3].f
= (GLfloat
) bottom
;
1853 n
[4].f
= (GLfloat
) top
;
1854 n
[5].f
= (GLfloat
) nearval
;
1855 n
[6].f
= (GLfloat
) farval
;
1857 if (ctx
->ExecuteFlag
) {
1858 (*ctx
->Exec
->Frustum
)( left
, right
, bottom
, top
, nearval
, farval
);
1863 static void save_Hint( GLenum target
, GLenum mode
)
1865 GET_CURRENT_CONTEXT(ctx
);
1867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1868 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HINT
, 2 );
1873 if (ctx
->ExecuteFlag
) {
1874 (*ctx
->Exec
->Hint
)( target
, mode
);
1880 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
, GLboolean sink
)
1882 GET_CURRENT_CONTEXT(ctx
);
1885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1886 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_HISTOGRAM
, 4 );
1890 n
[3].e
= internalFormat
;
1893 if (ctx
->ExecuteFlag
) {
1894 (*ctx
->Exec
->Histogram
)( target
, width
, internalFormat
, sink
);
1899 static void save_IndexMask( GLuint mask
)
1901 GET_CURRENT_CONTEXT(ctx
);
1903 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1904 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_INDEX_MASK
, 1 );
1908 if (ctx
->ExecuteFlag
) {
1909 (*ctx
->Exec
->IndexMask
)( mask
);
1914 static void save_InitNames( void )
1916 GET_CURRENT_CONTEXT(ctx
);
1917 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1918 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_INIT_NAMES
, 0 );
1919 if (ctx
->ExecuteFlag
) {
1920 (*ctx
->Exec
->InitNames
)();
1925 static void save_Lightfv( GLenum light
, GLenum pname
, const GLfloat
*params
)
1927 GET_CURRENT_CONTEXT(ctx
);
1929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1930 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT
, 6 );
1948 case GL_SPOT_DIRECTION
:
1951 case GL_SPOT_EXPONENT
:
1954 case GL_SPOT_CUTOFF
:
1957 case GL_CONSTANT_ATTENUATION
:
1960 case GL_LINEAR_ATTENUATION
:
1963 case GL_QUADRATIC_ATTENUATION
:
1969 for (i
= 0; i
< nParams
; i
++) {
1970 n
[3+i
].f
= params
[i
];
1973 if (ctx
->ExecuteFlag
) {
1974 (*ctx
->Exec
->Lightfv
)( light
, pname
, params
);
1979 static void save_Lightf( GLenum light
, GLenum pname
, GLfloat params
)
1981 save_Lightfv(light
, pname
, ¶ms
);
1985 static void save_Lightiv( GLenum light
, GLenum pname
, const GLint
*params
)
1992 fparam
[0] = INT_TO_FLOAT( params
[0] );
1993 fparam
[1] = INT_TO_FLOAT( params
[1] );
1994 fparam
[2] = INT_TO_FLOAT( params
[2] );
1995 fparam
[3] = INT_TO_FLOAT( params
[3] );
1998 fparam
[0] = (GLfloat
) params
[0];
1999 fparam
[1] = (GLfloat
) params
[1];
2000 fparam
[2] = (GLfloat
) params
[2];
2001 fparam
[3] = (GLfloat
) params
[3];
2003 case GL_SPOT_DIRECTION
:
2004 fparam
[0] = (GLfloat
) params
[0];
2005 fparam
[1] = (GLfloat
) params
[1];
2006 fparam
[2] = (GLfloat
) params
[2];
2008 case GL_SPOT_EXPONENT
:
2009 case GL_SPOT_CUTOFF
:
2010 case GL_CONSTANT_ATTENUATION
:
2011 case GL_LINEAR_ATTENUATION
:
2012 case GL_QUADRATIC_ATTENUATION
:
2013 fparam
[0] = (GLfloat
) params
[0];
2016 /* error will be caught later in gl_Lightfv */
2019 save_Lightfv( light
, pname
, fparam
);
2023 static void save_Lighti( GLenum light
, GLenum pname
, GLint param
)
2025 save_Lightiv( light
, pname
, ¶m
);
2029 static void save_LightModelfv( GLenum pname
, const GLfloat
*params
)
2031 GET_CURRENT_CONTEXT(ctx
);
2033 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2034 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIGHT_MODEL
, 5 );
2042 if (ctx
->ExecuteFlag
) {
2043 (*ctx
->Exec
->LightModelfv
)( pname
, params
);
2048 static void save_LightModelf( GLenum pname
, GLfloat param
)
2050 save_LightModelfv(pname
, ¶m
);
2054 static void save_LightModeliv( GLenum pname
, const GLint
*params
)
2058 case GL_LIGHT_MODEL_AMBIENT
:
2059 fparam
[0] = INT_TO_FLOAT( params
[0] );
2060 fparam
[1] = INT_TO_FLOAT( params
[1] );
2061 fparam
[2] = INT_TO_FLOAT( params
[2] );
2062 fparam
[3] = INT_TO_FLOAT( params
[3] );
2064 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2065 case GL_LIGHT_MODEL_TWO_SIDE
:
2066 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2067 fparam
[0] = (GLfloat
) params
[0];
2070 /* Error will be caught later in gl_LightModelfv */
2073 save_LightModelfv(pname
, fparam
);
2077 static void save_LightModeli( GLenum pname
, GLint param
)
2079 save_LightModeliv(pname
, ¶m
);
2083 static void save_LineStipple( GLint factor
, GLushort pattern
)
2085 GET_CURRENT_CONTEXT(ctx
);
2087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2088 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_STIPPLE
, 2 );
2093 if (ctx
->ExecuteFlag
) {
2094 (*ctx
->Exec
->LineStipple
)( factor
, pattern
);
2099 static void save_LineWidth( GLfloat width
)
2101 GET_CURRENT_CONTEXT(ctx
);
2103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2104 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LINE_WIDTH
, 1 );
2108 if (ctx
->ExecuteFlag
) {
2109 (*ctx
->Exec
->LineWidth
)( width
);
2114 static void save_ListBase( GLuint base
)
2116 GET_CURRENT_CONTEXT(ctx
);
2118 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2119 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LIST_BASE
, 1 );
2123 if (ctx
->ExecuteFlag
) {
2124 (*ctx
->Exec
->ListBase
)( base
);
2129 static void save_LoadIdentity( void )
2131 GET_CURRENT_CONTEXT(ctx
);
2132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2133 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_IDENTITY
, 0 );
2134 if (ctx
->ExecuteFlag
) {
2135 (*ctx
->Exec
->LoadIdentity
)();
2140 static void save_LoadMatrixf( const GLfloat
*m
)
2142 GET_CURRENT_CONTEXT(ctx
);
2144 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2145 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_MATRIX
, 16 );
2148 for (i
=0;i
<16;i
++) {
2152 if (ctx
->ExecuteFlag
) {
2153 (*ctx
->Exec
->LoadMatrixf
)( m
);
2158 static void save_LoadMatrixd( const GLdouble
*m
)
2162 for (i
= 0; i
< 16; i
++) {
2163 f
[i
] = (GLfloat
) m
[i
];
2165 save_LoadMatrixf(f
);
2169 static void save_LoadName( GLuint name
)
2171 GET_CURRENT_CONTEXT(ctx
);
2173 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2174 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_NAME
, 1 );
2178 if (ctx
->ExecuteFlag
) {
2179 (*ctx
->Exec
->LoadName
)( name
);
2184 static void save_LogicOp( GLenum opcode
)
2186 GET_CURRENT_CONTEXT(ctx
);
2188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2189 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOGIC_OP
, 1 );
2193 if (ctx
->ExecuteFlag
) {
2194 (*ctx
->Exec
->LogicOp
)( opcode
);
2199 static void save_Map1d( GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2200 GLint order
, const GLdouble
*points
)
2202 GET_CURRENT_CONTEXT(ctx
);
2204 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2205 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2207 GLfloat
*pnts
= _mesa_copy_map_points1d( target
, stride
, order
, points
);
2209 n
[2].f
= (GLfloat
) u1
;
2210 n
[3].f
= (GLfloat
) u2
;
2211 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2213 n
[6].data
= (void *) pnts
;
2215 if (ctx
->ExecuteFlag
) {
2216 (*ctx
->Exec
->Map1d
)( target
, u1
, u2
, stride
, order
, points
);
2220 static void save_Map1f( GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2221 GLint order
, const GLfloat
*points
)
2223 GET_CURRENT_CONTEXT(ctx
);
2225 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2226 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP1
, 6 );
2228 GLfloat
*pnts
= _mesa_copy_map_points1f( target
, stride
, order
, points
);
2232 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2234 n
[6].data
= (void *) pnts
;
2236 if (ctx
->ExecuteFlag
) {
2237 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, stride
, order
, points
);
2242 static void save_Map2d( GLenum target
,
2243 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2244 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2245 const GLdouble
*points
)
2247 GET_CURRENT_CONTEXT(ctx
);
2249 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2250 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2252 GLfloat
*pnts
= _mesa_copy_map_points2d( target
, ustride
, uorder
,
2253 vstride
, vorder
, points
);
2255 n
[2].f
= (GLfloat
) u1
;
2256 n
[3].f
= (GLfloat
) u2
;
2257 n
[4].f
= (GLfloat
) v1
;
2258 n
[5].f
= (GLfloat
) v2
;
2259 /* XXX verify these strides are correct */
2260 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2261 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2264 n
[10].data
= (void *) pnts
;
2266 if (ctx
->ExecuteFlag
) {
2267 (*ctx
->Exec
->Map2d
)( target
,
2268 u1
, u2
, ustride
, uorder
,
2269 v1
, v2
, vstride
, vorder
, points
);
2274 static void save_Map2f( GLenum target
,
2275 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2276 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2277 const GLfloat
*points
)
2279 GET_CURRENT_CONTEXT(ctx
);
2281 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2282 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAP2
, 10 );
2284 GLfloat
*pnts
= _mesa_copy_map_points2f( target
, ustride
, uorder
,
2285 vstride
, vorder
, points
);
2291 /* XXX verify these strides are correct */
2292 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride*/
2293 n
[7].i
= _mesa_evaluator_components(target
); /*vstride*/
2296 n
[10].data
= (void *) pnts
;
2298 if (ctx
->ExecuteFlag
) {
2299 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
2300 v1
, v2
, vstride
, vorder
, points
);
2305 static void save_MapGrid1f( GLint un
, GLfloat u1
, GLfloat u2
)
2307 GET_CURRENT_CONTEXT(ctx
);
2309 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2310 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID1
, 3 );
2316 if (ctx
->ExecuteFlag
) {
2317 (*ctx
->Exec
->MapGrid1f
)( un
, u1
, u2
);
2322 static void save_MapGrid1d( GLint un
, GLdouble u1
, GLdouble u2
)
2324 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2328 static void save_MapGrid2f( GLint un
, GLfloat u1
, GLfloat u2
,
2329 GLint vn
, GLfloat v1
, GLfloat v2
)
2331 GET_CURRENT_CONTEXT(ctx
);
2333 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2334 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MAPGRID2
, 6 );
2343 if (ctx
->ExecuteFlag
) {
2344 (*ctx
->Exec
->MapGrid2f
)( un
, u1
, u2
, vn
, v1
, v2
);
2350 static void save_MapGrid2d( GLint un
, GLdouble u1
, GLdouble u2
,
2351 GLint vn
, GLdouble v1
, GLdouble v2
)
2353 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2354 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2358 static void save_MatrixMode( GLenum mode
)
2360 GET_CURRENT_CONTEXT(ctx
);
2362 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2363 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MATRIX_MODE
, 1 );
2367 if (ctx
->ExecuteFlag
) {
2368 (*ctx
->Exec
->MatrixMode
)( mode
);
2374 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
2376 GET_CURRENT_CONTEXT(ctx
);
2379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2380 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MIN_MAX
, 3 );
2383 n
[2].e
= internalFormat
;
2386 if (ctx
->ExecuteFlag
) {
2387 (*ctx
->Exec
->Minmax
)( target
, internalFormat
, sink
);
2392 static void save_MultMatrixf( const GLfloat
*m
)
2394 GET_CURRENT_CONTEXT(ctx
);
2396 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2397 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_MULT_MATRIX
, 16 );
2400 for (i
=0;i
<16;i
++) {
2404 if (ctx
->ExecuteFlag
) {
2405 (*ctx
->Exec
->MultMatrixf
)( m
);
2410 static void save_MultMatrixd( const GLdouble
*m
)
2414 for (i
= 0; i
< 16; i
++) {
2415 f
[i
] = (GLfloat
) m
[i
];
2417 save_MultMatrixf(f
);
2421 static void save_NewList( GLuint list
, GLenum mode
)
2423 GET_CURRENT_CONTEXT(ctx
);
2424 /* It's an error to call this function while building a display list */
2425 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
2432 static void save_Ortho( GLdouble left
, GLdouble right
,
2433 GLdouble bottom
, GLdouble top
,
2434 GLdouble nearval
, GLdouble farval
)
2436 GET_CURRENT_CONTEXT(ctx
);
2438 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2439 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ORTHO
, 6 );
2441 n
[1].f
= (GLfloat
) left
;
2442 n
[2].f
= (GLfloat
) right
;
2443 n
[3].f
= (GLfloat
) bottom
;
2444 n
[4].f
= (GLfloat
) top
;
2445 n
[5].f
= (GLfloat
) nearval
;
2446 n
[6].f
= (GLfloat
) farval
;
2448 if (ctx
->ExecuteFlag
) {
2449 (*ctx
->Exec
->Ortho
)( left
, right
, bottom
, top
, nearval
, farval
);
2455 save_PixelMapfv( GLenum map
, GLint mapsize
, const GLfloat
*values
)
2457 GET_CURRENT_CONTEXT(ctx
);
2459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2460 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_MAP
, 3 );
2464 n
[3].data
= (void *) MALLOC( mapsize
* sizeof(GLfloat
) );
2465 MEMCPY( n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
) );
2467 if (ctx
->ExecuteFlag
) {
2468 (*ctx
->Exec
->PixelMapfv
)( map
, mapsize
, values
);
2474 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2476 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2478 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2479 for (i
=0;i
<mapsize
;i
++) {
2480 fvalues
[i
] = (GLfloat
) values
[i
];
2484 for (i
=0;i
<mapsize
;i
++) {
2485 fvalues
[i
] = UINT_TO_FLOAT( values
[i
] );
2488 save_PixelMapfv(map
, mapsize
, fvalues
);
2493 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2495 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2497 if (map
==GL_PIXEL_MAP_I_TO_I
|| map
==GL_PIXEL_MAP_S_TO_S
) {
2498 for (i
=0;i
<mapsize
;i
++) {
2499 fvalues
[i
] = (GLfloat
) values
[i
];
2503 for (i
=0;i
<mapsize
;i
++) {
2504 fvalues
[i
] = USHORT_TO_FLOAT( values
[i
] );
2507 save_PixelMapfv(map
, mapsize
, fvalues
);
2512 save_PixelTransferf( GLenum pname
, GLfloat param
)
2514 GET_CURRENT_CONTEXT(ctx
);
2516 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2517 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TRANSFER
, 2 );
2522 if (ctx
->ExecuteFlag
) {
2523 (*ctx
->Exec
->PixelTransferf
)( pname
, param
);
2529 save_PixelTransferi( GLenum pname
, GLint param
)
2531 save_PixelTransferf( pname
, (GLfloat
) param
);
2536 save_PixelZoom( GLfloat xfactor
, GLfloat yfactor
)
2538 GET_CURRENT_CONTEXT(ctx
);
2540 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2541 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_ZOOM
, 2 );
2546 if (ctx
->ExecuteFlag
) {
2547 (*ctx
->Exec
->PixelZoom
)( xfactor
, yfactor
);
2553 save_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
2555 GET_CURRENT_CONTEXT(ctx
);
2557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2558 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_PARAMETERS
, 4 );
2565 if (ctx
->ExecuteFlag
) {
2566 (*ctx
->Exec
->PointParameterfvEXT
)( pname
, params
);
2571 static void save_PointParameterfEXT( GLenum pname
, GLfloat param
)
2573 save_PointParameterfvEXT(pname
, ¶m
);
2576 static void save_PointParameteriNV( GLenum pname
, GLint param
)
2578 GLfloat p
= (GLfloat
) param
;
2579 save_PointParameterfvEXT(pname
, &p
);
2582 static void save_PointParameterivNV( GLenum pname
, const GLint
*param
)
2584 GLfloat p
= (GLfloat
) param
[0];
2585 save_PointParameterfvEXT(pname
, &p
);
2589 static void save_PointSize( GLfloat size
)
2591 GET_CURRENT_CONTEXT(ctx
);
2593 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2594 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POINT_SIZE
, 1 );
2598 if (ctx
->ExecuteFlag
) {
2599 (*ctx
->Exec
->PointSize
)( size
);
2604 static void save_PolygonMode( GLenum face
, GLenum mode
)
2606 GET_CURRENT_CONTEXT(ctx
);
2608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2609 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_MODE
, 2 );
2614 if (ctx
->ExecuteFlag
) {
2615 (*ctx
->Exec
->PolygonMode
)( face
, mode
);
2621 * Polygon stipple must have been upacked already!
2623 static void save_PolygonStipple( const GLubyte
*pattern
)
2625 GET_CURRENT_CONTEXT(ctx
);
2627 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2628 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_STIPPLE
, 1 );
2631 n
[1].data
= MALLOC( 32 * 4 );
2632 data
= n
[1].data
; /* This needed for Acorn compiler */
2633 MEMCPY( data
, pattern
, 32 * 4 );
2635 if (ctx
->ExecuteFlag
) {
2636 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) pattern
);
2641 static void save_PolygonOffset( GLfloat factor
, GLfloat units
)
2643 GET_CURRENT_CONTEXT(ctx
);
2645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2646 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_POLYGON_OFFSET
, 2 );
2651 if (ctx
->ExecuteFlag
) {
2652 (*ctx
->Exec
->PolygonOffset
)( factor
, units
);
2657 static void save_PolygonOffsetEXT( GLfloat factor
, GLfloat bias
)
2659 GET_CURRENT_CONTEXT(ctx
);
2660 save_PolygonOffset(factor
, ctx
->DepthMaxF
* bias
);
2664 static void save_PopAttrib( void )
2666 GET_CURRENT_CONTEXT(ctx
);
2667 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2668 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_ATTRIB
, 0 );
2669 if (ctx
->ExecuteFlag
) {
2670 (*ctx
->Exec
->PopAttrib
)();
2675 static void save_PopMatrix( void )
2677 GET_CURRENT_CONTEXT(ctx
);
2678 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2679 FLUSH_CURRENT(ctx
, 0);
2680 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_MATRIX
, 0 );
2681 if (ctx
->ExecuteFlag
) {
2682 (*ctx
->Exec
->PopMatrix
)();
2687 static void save_PopName( void )
2689 GET_CURRENT_CONTEXT(ctx
);
2690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2691 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_POP_NAME
, 0 );
2692 if (ctx
->ExecuteFlag
) {
2693 (*ctx
->Exec
->PopName
)();
2698 static void save_PrioritizeTextures( GLsizei num
, const GLuint
*textures
,
2699 const GLclampf
*priorities
)
2701 GET_CURRENT_CONTEXT(ctx
);
2703 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2705 for (i
=0;i
<num
;i
++) {
2707 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2 );
2709 n
[1].ui
= textures
[i
];
2710 n
[2].f
= priorities
[i
];
2713 if (ctx
->ExecuteFlag
) {
2714 (*ctx
->Exec
->PrioritizeTextures
)( num
, textures
, priorities
);
2719 static void save_PushAttrib( GLbitfield mask
)
2721 GET_CURRENT_CONTEXT(ctx
);
2723 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2724 FLUSH_CURRENT(ctx
, 0);
2725 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_ATTRIB
, 1 );
2729 if (ctx
->ExecuteFlag
) {
2730 (*ctx
->Exec
->PushAttrib
)( mask
);
2735 static void save_PushMatrix( void )
2737 GET_CURRENT_CONTEXT(ctx
);
2738 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2739 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_MATRIX
, 0 );
2740 if (ctx
->ExecuteFlag
) {
2741 (*ctx
->Exec
->PushMatrix
)();
2746 static void save_PushName( GLuint name
)
2748 GET_CURRENT_CONTEXT(ctx
);
2750 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2751 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PUSH_NAME
, 1 );
2755 if (ctx
->ExecuteFlag
) {
2756 (*ctx
->Exec
->PushName
)( name
);
2761 static void save_RasterPos4f( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
2763 GET_CURRENT_CONTEXT(ctx
);
2765 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2766 FLUSH_CURRENT(ctx
, 0);
2767 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RASTER_POS
, 4 );
2774 if (ctx
->ExecuteFlag
) {
2775 (*ctx
->Exec
->RasterPos4f
)( x
, y
, z
, w
);
2779 static void save_RasterPos2d(GLdouble x
, GLdouble y
)
2781 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2784 static void save_RasterPos2f(GLfloat x
, GLfloat y
)
2786 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2789 static void save_RasterPos2i(GLint x
, GLint y
)
2791 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
2794 static void save_RasterPos2s(GLshort x
, GLshort y
)
2796 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
2799 static void save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
2801 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2804 static void save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
2806 save_RasterPos4f(x
, y
, z
, 1.0F
);
2809 static void save_RasterPos3i(GLint x
, GLint y
, GLint z
)
2811 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
2814 static void save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
2816 save_RasterPos4f(x
, y
, z
, 1.0F
);
2819 static void save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
2821 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2824 static void save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
2826 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
2829 static void save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
2831 save_RasterPos4f(x
, y
, z
, w
);
2834 static void save_RasterPos2dv(const GLdouble
*v
)
2836 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2839 static void save_RasterPos2fv(const GLfloat
*v
)
2841 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2844 static void save_RasterPos2iv(const GLint
*v
)
2846 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
2849 static void save_RasterPos2sv(const GLshort
*v
)
2851 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
2854 static void save_RasterPos3dv(const GLdouble
*v
)
2856 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2859 static void save_RasterPos3fv(const GLfloat
*v
)
2861 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2864 static void save_RasterPos3iv(const GLint
*v
)
2866 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
2869 static void save_RasterPos3sv(const GLshort
*v
)
2871 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
2874 static void save_RasterPos4dv(const GLdouble
*v
)
2876 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
2877 (GLfloat
) v
[2], (GLfloat
) v
[3]);
2880 static void save_RasterPos4fv(const GLfloat
*v
)
2882 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2885 static void save_RasterPos4iv(const GLint
*v
)
2887 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
2888 (GLfloat
) v
[2], (GLfloat
) v
[3]);
2891 static void save_RasterPos4sv(const GLshort
*v
)
2893 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
2897 static void save_PassThrough( GLfloat token
)
2899 GET_CURRENT_CONTEXT(ctx
);
2901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2902 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PASSTHROUGH
, 1 );
2906 if (ctx
->ExecuteFlag
) {
2907 (*ctx
->Exec
->PassThrough
)( token
);
2912 static void save_ReadBuffer( GLenum mode
)
2914 GET_CURRENT_CONTEXT(ctx
);
2916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2917 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_READ_BUFFER
, 1 );
2921 if (ctx
->ExecuteFlag
) {
2922 (*ctx
->Exec
->ReadBuffer
)( mode
);
2928 save_ResetHistogram(GLenum target
)
2930 GET_CURRENT_CONTEXT(ctx
);
2932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2933 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_HISTOGRAM
, 1 );
2937 if (ctx
->ExecuteFlag
) {
2938 (*ctx
->Exec
->ResetHistogram
)( target
);
2944 save_ResetMinmax(GLenum target
)
2946 GET_CURRENT_CONTEXT(ctx
);
2948 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2949 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_RESET_MIN_MAX
, 1 );
2953 if (ctx
->ExecuteFlag
) {
2954 (*ctx
->Exec
->ResetMinmax
)( target
);
2959 static void save_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
2961 GET_CURRENT_CONTEXT(ctx
);
2963 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2964 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ROTATE
, 4 );
2971 if (ctx
->ExecuteFlag
) {
2972 (*ctx
->Exec
->Rotatef
)( angle
, x
, y
, z
);
2977 static void save_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
2979 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
2983 static void save_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
2985 GET_CURRENT_CONTEXT(ctx
);
2987 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2988 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCALE
, 3 );
2994 if (ctx
->ExecuteFlag
) {
2995 (*ctx
->Exec
->Scalef
)( x
, y
, z
);
3000 static void save_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
3002 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3006 static void save_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3008 GET_CURRENT_CONTEXT(ctx
);
3010 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3011 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SCISSOR
, 4 );
3018 if (ctx
->ExecuteFlag
) {
3019 (*ctx
->Exec
->Scissor
)( x
, y
, width
, height
);
3024 static void save_ShadeModel( GLenum mode
)
3026 GET_CURRENT_CONTEXT(ctx
);
3028 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3029 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SHADE_MODEL
, 1 );
3033 if (ctx
->ExecuteFlag
) {
3034 (*ctx
->Exec
->ShadeModel
)( mode
);
3039 static void save_StencilFunc( GLenum func
, GLint ref
, GLuint mask
)
3041 GET_CURRENT_CONTEXT(ctx
);
3043 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3044 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_FUNC
, 3 );
3050 if (ctx
->ExecuteFlag
) {
3051 (*ctx
->Exec
->StencilFunc
)( func
, ref
, mask
);
3056 static void save_StencilMask( GLuint mask
)
3058 GET_CURRENT_CONTEXT(ctx
);
3060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3061 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_MASK
, 1 );
3065 if (ctx
->ExecuteFlag
) {
3066 (*ctx
->Exec
->StencilMask
)( mask
);
3071 static void save_StencilOp( GLenum fail
, GLenum zfail
, GLenum zpass
)
3073 GET_CURRENT_CONTEXT(ctx
);
3075 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3076 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_STENCIL_OP
, 3 );
3082 if (ctx
->ExecuteFlag
) {
3083 (*ctx
->Exec
->StencilOp
)( fail
, zfail
, zpass
);
3088 static void save_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*params
)
3090 GET_CURRENT_CONTEXT(ctx
);
3092 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3093 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXENV
, 6 );
3102 if (ctx
->ExecuteFlag
) {
3103 (*ctx
->Exec
->TexEnvfv
)( target
, pname
, params
);
3108 static void save_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
3110 save_TexEnvfv( target
, pname
, ¶m
);
3114 static void save_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
3117 p
[0] = (GLfloat
) param
;
3118 p
[1] = p
[2] = p
[3] = 0.0;
3119 save_TexEnvfv( target
, pname
, p
);
3123 static void save_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
3126 p
[0] = INT_TO_FLOAT( param
[0] );
3127 p
[1] = INT_TO_FLOAT( param
[1] );
3128 p
[2] = INT_TO_FLOAT( param
[2] );
3129 p
[3] = INT_TO_FLOAT( param
[3] );
3130 save_TexEnvfv( target
, pname
, p
);
3134 static void save_TexGenfv( GLenum coord
, GLenum pname
, const GLfloat
*params
)
3136 GET_CURRENT_CONTEXT(ctx
);
3138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3139 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXGEN
, 6 );
3148 if (ctx
->ExecuteFlag
) {
3149 (*ctx
->Exec
->TexGenfv
)( coord
, pname
, params
);
3154 static void save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3157 p
[0] = (GLfloat
) params
[0];
3158 p
[1] = (GLfloat
) params
[1];
3159 p
[2] = (GLfloat
) params
[2];
3160 p
[3] = (GLfloat
) params
[3];
3161 save_TexGenfv(coord
, pname
, p
);
3165 static void save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3167 GLfloat p
= (GLfloat
) param
;
3168 save_TexGenfv( coord
, pname
, &p
);
3172 static void save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3175 p
[0] = (GLfloat
) params
[0];
3176 p
[1] = (GLfloat
) params
[1];
3177 p
[2] = (GLfloat
) params
[2];
3178 p
[3] = (GLfloat
) params
[3];
3179 save_TexGenfv( coord
, pname
, p
);
3183 static void save_TexGenf( GLenum coord
, GLenum pname
, GLfloat param
)
3185 save_TexGenfv(coord
, pname
, ¶m
);
3189 static void save_TexGeni( GLenum coord
, GLenum pname
, GLint param
)
3191 save_TexGeniv( coord
, pname
, ¶m
);
3195 static void save_TexParameterfv( GLenum target
,
3196 GLenum pname
, const GLfloat
*params
)
3198 GET_CURRENT_CONTEXT(ctx
);
3200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3201 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEXPARAMETER
, 6 );
3210 if (ctx
->ExecuteFlag
) {
3211 (*ctx
->Exec
->TexParameterfv
)( target
, pname
, params
);
3216 static void save_TexParameterf( GLenum target
, GLenum pname
, GLfloat param
)
3218 save_TexParameterfv(target
, pname
, ¶m
);
3222 static void save_TexParameteri( GLenum target
, GLenum pname
, GLint param
)
3225 fparam
[0] = (GLfloat
) param
;
3226 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3227 save_TexParameterfv(target
, pname
, fparam
);
3231 static void save_TexParameteriv( GLenum target
, GLenum pname
, const GLint
*params
)
3234 fparam
[0] = (GLfloat
) params
[0];
3235 fparam
[1] = fparam
[2] = fparam
[3] = 0.0;
3236 save_TexParameterfv(target
, pname
, fparam
);
3240 static void save_TexImage1D( GLenum target
,
3241 GLint level
, GLint components
,
3242 GLsizei width
, GLint border
,
3243 GLenum format
, GLenum type
,
3244 const GLvoid
*pixels
)
3246 GET_CURRENT_CONTEXT(ctx
);
3247 if (target
== GL_PROXY_TEXTURE_1D
) {
3248 /* don't compile, execute immediately */
3249 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3250 border
, format
, type
, pixels
);
3253 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3254 pixels
, &ctx
->Unpack
);
3256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3257 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE1D
, 8 );
3261 n
[3].i
= components
;
3262 n
[4].i
= (GLint
) width
;
3271 if (ctx
->ExecuteFlag
) {
3272 (*ctx
->Exec
->TexImage1D
)( target
, level
, components
, width
,
3273 border
, format
, type
, pixels
);
3279 static void save_TexImage2D( GLenum target
,
3280 GLint level
, GLint components
,
3281 GLsizei width
, GLsizei height
, GLint border
,
3282 GLenum format
, GLenum type
,
3283 const GLvoid
*pixels
)
3285 GET_CURRENT_CONTEXT(ctx
);
3286 if (target
== GL_PROXY_TEXTURE_2D
) {
3287 /* don't compile, execute immediately */
3288 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3289 height
, border
, format
, type
, pixels
);
3292 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3293 pixels
, &ctx
->Unpack
);
3295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3296 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE2D
, 9 );
3300 n
[3].i
= components
;
3301 n
[4].i
= (GLint
) width
;
3302 n
[5].i
= (GLint
) height
;
3311 if (ctx
->ExecuteFlag
) {
3312 (*ctx
->Exec
->TexImage2D
)( target
, level
, components
, width
,
3313 height
, border
, format
, type
, pixels
);
3319 static void save_TexImage3D( GLenum target
,
3320 GLint level
, GLint internalFormat
,
3321 GLsizei width
, GLsizei height
, GLsizei depth
,
3323 GLenum format
, GLenum type
,
3324 const GLvoid
*pixels
)
3326 GET_CURRENT_CONTEXT(ctx
);
3327 if (target
== GL_PROXY_TEXTURE_3D
) {
3328 /* don't compile, execute immediately */
3329 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3330 height
, depth
, border
, format
, type
, pixels
);
3334 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3335 pixels
, &ctx
->Unpack
);
3336 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3337 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_IMAGE3D
, 10 );
3341 n
[3].i
= (GLint
) internalFormat
;
3342 n
[4].i
= (GLint
) width
;
3343 n
[5].i
= (GLint
) height
;
3344 n
[6].i
= (GLint
) depth
;
3353 if (ctx
->ExecuteFlag
) {
3354 (*ctx
->Exec
->TexImage3D
)( target
, level
, internalFormat
, width
,
3355 height
, depth
, border
, format
, type
, pixels
);
3361 static void save_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
3362 GLsizei width
, GLenum format
, GLenum type
,
3363 const GLvoid
*pixels
)
3365 GET_CURRENT_CONTEXT(ctx
);
3367 GLvoid
*image
= _mesa_unpack_image(width
, 1, 1, format
, type
,
3368 pixels
, &ctx
->Unpack
);
3369 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3370 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7 );
3375 n
[4].i
= (GLint
) width
;
3383 if (ctx
->ExecuteFlag
) {
3384 (*ctx
->Exec
->TexSubImage1D
)( target
, level
, xoffset
, width
,
3385 format
, type
, pixels
);
3390 static void save_TexSubImage2D( GLenum target
, GLint level
,
3391 GLint xoffset
, GLint yoffset
,
3392 GLsizei width
, GLsizei height
,
3393 GLenum format
, GLenum type
,
3394 const GLvoid
*pixels
)
3396 GET_CURRENT_CONTEXT(ctx
);
3398 GLvoid
*image
= _mesa_unpack_image(width
, height
, 1, format
, type
,
3399 pixels
, &ctx
->Unpack
);
3400 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3401 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9 );
3407 n
[5].i
= (GLint
) width
;
3408 n
[6].i
= (GLint
) height
;
3416 if (ctx
->ExecuteFlag
) {
3417 (*ctx
->Exec
->TexSubImage2D
)( target
, level
, xoffset
, yoffset
,
3418 width
, height
, format
, type
, pixels
);
3423 static void save_TexSubImage3D( GLenum target
, GLint level
,
3424 GLint xoffset
, GLint yoffset
,GLint zoffset
,
3425 GLsizei width
, GLsizei height
, GLsizei depth
,
3426 GLenum format
, GLenum type
,
3427 const GLvoid
*pixels
)
3429 GET_CURRENT_CONTEXT(ctx
);
3431 GLvoid
*image
= _mesa_unpack_image(width
, height
, depth
, format
, type
,
3432 pixels
, &ctx
->Unpack
);
3433 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3434 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11 );
3441 n
[6].i
= (GLint
) width
;
3442 n
[7].i
= (GLint
) height
;
3443 n
[8].i
= (GLint
) depth
;
3451 if (ctx
->ExecuteFlag
) {
3452 (*ctx
->Exec
->TexSubImage3D
)( target
, level
,
3453 xoffset
, yoffset
, zoffset
,
3454 width
, height
, depth
, format
, type
, pixels
);
3459 static void save_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
3461 GET_CURRENT_CONTEXT(ctx
);
3463 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3464 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRANSLATE
, 3 );
3470 if (ctx
->ExecuteFlag
) {
3471 (*ctx
->Exec
->Translatef
)( x
, y
, z
);
3476 static void save_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
3478 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3483 static void save_Viewport( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3485 GET_CURRENT_CONTEXT(ctx
);
3487 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3488 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_VIEWPORT
, 4 );
3492 n
[3].i
= (GLint
) width
;
3493 n
[4].i
= (GLint
) height
;
3495 if (ctx
->ExecuteFlag
) {
3496 (*ctx
->Exec
->Viewport
)( x
, y
, width
, height
);
3501 static void save_WindowPos4fMESA( GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3503 GET_CURRENT_CONTEXT(ctx
);
3505 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3506 FLUSH_CURRENT(ctx
, 0);
3507 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_WINDOW_POS
, 4 );
3514 if (ctx
->ExecuteFlag
) {
3515 (*ctx
->Exec
->WindowPos4fMESA
)( x
, y
, z
, w
);
3519 static void save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3521 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3524 static void save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3526 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3529 static void save_WindowPos2iMESA(GLint x
, GLint y
)
3531 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3534 static void save_WindowPos2sMESA(GLshort x
, GLshort y
)
3536 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3539 static void save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
3541 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3544 static void save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
3546 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3549 static void save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
3551 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3554 static void save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
3556 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
3559 static void save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3561 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3564 static void save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
3566 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3569 static void save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3571 save_WindowPos4fMESA(x
, y
, z
, w
);
3574 static void save_WindowPos2dvMESA(const GLdouble
*v
)
3576 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3579 static void save_WindowPos2fvMESA(const GLfloat
*v
)
3581 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3584 static void save_WindowPos2ivMESA(const GLint
*v
)
3586 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3589 static void save_WindowPos2svMESA(const GLshort
*v
)
3591 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
3594 static void save_WindowPos3dvMESA(const GLdouble
*v
)
3596 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3599 static void save_WindowPos3fvMESA(const GLfloat
*v
)
3601 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3604 static void save_WindowPos3ivMESA(const GLint
*v
)
3606 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3609 static void save_WindowPos3svMESA(const GLshort
*v
)
3611 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
3614 static void save_WindowPos4dvMESA(const GLdouble
*v
)
3616 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3617 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3620 static void save_WindowPos4fvMESA(const GLfloat
*v
)
3622 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3625 static void save_WindowPos4ivMESA(const GLint
*v
)
3627 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
3628 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3631 static void save_WindowPos4svMESA(const GLshort
*v
)
3633 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
3638 /* GL_ARB_multitexture */
3639 static void save_ActiveTextureARB( GLenum target
)
3641 GET_CURRENT_CONTEXT(ctx
);
3643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3644 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_TEXTURE
, 1 );
3648 if (ctx
->ExecuteFlag
) {
3649 (*ctx
->Exec
->ActiveTextureARB
)( target
);
3654 /* GL_ARB_transpose_matrix */
3656 static void save_LoadTransposeMatrixdARB( const GLdouble m
[16] )
3659 _math_transposefd(tm
, m
);
3660 save_LoadMatrixf(tm
);
3664 static void save_LoadTransposeMatrixfARB( const GLfloat m
[16] )
3667 _math_transposef(tm
, m
);
3668 save_LoadMatrixf(tm
);
3673 save_MultTransposeMatrixdARB( const GLdouble m
[16] )
3676 _math_transposefd(tm
, m
);
3677 save_MultMatrixf(tm
);
3682 save_MultTransposeMatrixfARB( const GLfloat m
[16] )
3685 _math_transposef(tm
, m
);
3686 save_MultMatrixf(tm
);
3691 save_PixelTexGenSGIX(GLenum mode
)
3693 GET_CURRENT_CONTEXT(ctx
);
3695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3696 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_SGIX
, 1 );
3700 if (ctx
->ExecuteFlag
) {
3701 (*ctx
->Exec
->PixelTexGenSGIX
)( mode
);
3706 /* GL_ARB_texture_compression */
3708 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
3709 GLenum internalFormat
, GLsizei width
,
3710 GLint border
, GLsizei imageSize
,
3713 GET_CURRENT_CONTEXT(ctx
);
3714 if (target
== GL_PROXY_TEXTURE_1D
) {
3715 /* don't compile, execute immediately */
3716 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3717 width
, border
, imageSize
, data
);
3722 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3723 /* make copy of image */
3724 image
= MALLOC(imageSize
);
3726 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage1DARB");
3729 MEMCPY(image
, data
, imageSize
);
3730 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7 );
3734 n
[3].e
= internalFormat
;
3735 n
[4].i
= (GLint
) width
;
3743 if (ctx
->ExecuteFlag
) {
3744 (*ctx
->Exec
->CompressedTexImage1DARB
)(target
, level
, internalFormat
,
3745 width
, border
, imageSize
, data
);
3752 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
3753 GLenum internalFormat
, GLsizei width
,
3754 GLsizei height
, GLint border
, GLsizei imageSize
,
3757 GET_CURRENT_CONTEXT(ctx
);
3758 if (target
== GL_PROXY_TEXTURE_2D
) {
3759 /* don't compile, execute immediately */
3760 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3761 width
, height
, border
, imageSize
, data
);
3766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3767 /* make copy of image */
3768 image
= MALLOC(imageSize
);
3770 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage2DARB");
3773 MEMCPY(image
, data
, imageSize
);
3774 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8 );
3778 n
[3].e
= internalFormat
;
3779 n
[4].i
= (GLint
) width
;
3780 n
[5].i
= (GLint
) height
;
3788 if (ctx
->ExecuteFlag
) {
3789 (*ctx
->Exec
->CompressedTexImage2DARB
)(target
, level
, internalFormat
,
3790 width
, height
, border
, imageSize
, data
);
3797 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
3798 GLenum internalFormat
, GLsizei width
,
3799 GLsizei height
, GLsizei depth
, GLint border
,
3800 GLsizei imageSize
, const GLvoid
*data
)
3802 GET_CURRENT_CONTEXT(ctx
);
3803 if (target
== GL_PROXY_TEXTURE_3D
) {
3804 /* don't compile, execute immediately */
3805 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3806 width
, height
, depth
, border
, imageSize
, data
);
3811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3812 /* make copy of image */
3813 image
= MALLOC(imageSize
);
3815 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexImage3DARB");
3818 MEMCPY(image
, data
, imageSize
);
3819 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9 );
3823 n
[3].e
= internalFormat
;
3824 n
[4].i
= (GLint
) width
;
3825 n
[5].i
= (GLint
) height
;
3826 n
[6].i
= (GLint
) depth
;
3834 if (ctx
->ExecuteFlag
) {
3835 (*ctx
->Exec
->CompressedTexImage3DARB
)(target
, level
, internalFormat
,
3836 width
, height
, depth
, border
, imageSize
, data
);
3843 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
3844 GLsizei width
, GLenum format
,
3845 GLsizei imageSize
, const GLvoid
*data
)
3850 GET_CURRENT_CONTEXT(ctx
);
3851 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3853 /* make copy of image */
3854 image
= MALLOC(imageSize
);
3856 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage1DARB");
3859 MEMCPY(image
, data
, imageSize
);
3860 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7 );
3865 n
[4].i
= (GLint
) width
;
3873 if (ctx
->ExecuteFlag
) {
3874 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(target
, level
, xoffset
,
3875 width
, format
, imageSize
, data
);
3881 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
3882 GLint yoffset
, GLsizei width
, GLsizei height
,
3883 GLenum format
, GLsizei imageSize
,
3889 GET_CURRENT_CONTEXT(ctx
);
3890 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3892 /* make copy of image */
3893 image
= MALLOC(imageSize
);
3895 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage2DARB");
3898 MEMCPY(image
, data
, imageSize
);
3899 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9 );
3905 n
[5].i
= (GLint
) width
;
3906 n
[6].i
= (GLint
) height
;
3914 if (ctx
->ExecuteFlag
) {
3915 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(target
, level
, xoffset
, yoffset
,
3916 width
, height
, format
, imageSize
, data
);
3922 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
3923 GLint yoffset
, GLint zoffset
, GLsizei width
,
3924 GLsizei height
, GLsizei depth
, GLenum format
,
3925 GLsizei imageSize
, const GLvoid
*data
)
3930 GET_CURRENT_CONTEXT(ctx
);
3931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3933 /* make copy of image */
3934 image
= MALLOC(imageSize
);
3936 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCompressedTexSubImage3DARB");
3939 MEMCPY(image
, data
, imageSize
);
3940 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11 );
3947 n
[6].i
= (GLint
) width
;
3948 n
[7].i
= (GLint
) height
;
3949 n
[8].i
= (GLint
) depth
;
3951 n
[10].i
= imageSize
;
3957 if (ctx
->ExecuteFlag
) {
3958 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(target
, level
, xoffset
, yoffset
,
3959 zoffset
, width
, height
, depth
, format
, imageSize
, data
);
3964 /* GL_ARB_multisample */
3966 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
3968 GET_CURRENT_CONTEXT(ctx
);
3970 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3971 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_SAMPLE_COVERAGE
, 2 );
3976 if (ctx
->ExecuteFlag
) {
3977 (*ctx
->Exec
->SampleCoverageARB
)( value
, invert
);
3982 /* GL_SGIS_pixel_texture */
3985 save_PixelTexGenParameteriSGIS(GLenum target
, GLint value
)
3987 GET_CURRENT_CONTEXT(ctx
);
3989 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3990 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
, 2 );
3995 if (ctx
->ExecuteFlag
) {
3996 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( target
, value
);
4002 save_PixelTexGenParameterfSGIS(GLenum target
, GLfloat value
)
4004 save_PixelTexGenParameteriSGIS(target
, (GLint
) value
);
4009 save_PixelTexGenParameterivSGIS(GLenum target
, const GLint
*value
)
4011 save_PixelTexGenParameteriSGIS(target
, *value
);
4016 save_PixelTexGenParameterfvSGIS(GLenum target
, const GLfloat
*value
)
4018 save_PixelTexGenParameteriSGIS(target
, (GLint
) *value
);
4023 * GL_NV_vertex_program
4025 #if FEATURE_NV_vertex_program
4027 save_BindProgramNV(GLenum target
, GLuint id
)
4029 GET_CURRENT_CONTEXT(ctx
);
4031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4032 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_BIND_PROGRAM_NV
, 2 );
4037 if (ctx
->ExecuteFlag
) {
4038 (*ctx
->Exec
->BindProgramNV
)( target
, id
);
4043 save_ExecuteProgramNV(GLenum target
, GLuint id
, const GLfloat
*params
)
4045 GET_CURRENT_CONTEXT(ctx
);
4047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4048 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_EXECUTE_PROGRAM_NV
, 6 );
4057 if (ctx
->ExecuteFlag
) {
4058 (*ctx
->Exec
->ExecuteProgramNV
)(target
, id
, params
);
4064 save_ProgramParameter4fNV(GLenum target
, GLuint index
,
4065 GLfloat x
, GLfloat y
,
4066 GLfloat z
, GLfloat w
)
4068 GET_CURRENT_CONTEXT(ctx
);
4070 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4071 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_PARAMETER4F_NV
, 6 );
4080 if (ctx
->ExecuteFlag
) {
4081 (*ctx
->Exec
->ProgramParameter4fNV
)(target
, index
, x
, y
, z
, w
);
4087 save_ProgramParameter4fvNV(GLenum target
, GLuint index
, const GLfloat
*params
)
4089 save_ProgramParameter4fNV(target
, index
, params
[0], params
[1],
4090 params
[2], params
[3]);
4095 save_ProgramParameter4dNV(GLenum target
, GLuint index
,
4096 GLdouble x
, GLdouble y
,
4097 GLdouble z
, GLdouble w
)
4099 save_ProgramParameter4fNV(target
, index
, (GLfloat
) x
, (GLfloat
) y
,
4100 (GLfloat
) z
, (GLfloat
) w
);
4105 save_ProgramParameter4dvNV(GLenum target
, GLuint index
,
4106 const GLdouble
*params
)
4108 save_ProgramParameter4fNV(target
, index
, (GLfloat
) params
[0],
4109 (GLfloat
) params
[1], (GLfloat
) params
[2],
4110 (GLfloat
) params
[3]);
4115 save_ProgramParameters4dvNV(GLenum target
, GLuint index
,
4116 GLuint num
, const GLdouble
*params
)
4119 for (i
= 0; i
< num
; i
++) {
4120 save_ProgramParameter4dvNV(target
, index
+ i
, params
+ 4 * i
);
4126 save_ProgramParameters4fvNV(GLenum target
, GLuint index
,
4127 GLuint num
, const GLfloat
*params
)
4130 for (i
= 0; i
< num
; i
++) {
4131 save_ProgramParameter4fvNV(target
, index
+ i
, params
+ 4 * i
);
4137 save_LoadProgramNV(GLenum target
, GLuint id
, GLsizei len
,
4138 const GLubyte
*program
)
4140 GET_CURRENT_CONTEXT(ctx
);
4142 GLubyte
*programCopy
;
4144 programCopy
= (GLubyte
*) _mesa_malloc(len
);
4146 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glLoadProgramNV");
4149 _mesa_memcpy(programCopy
, program
, len
);
4151 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4152 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_LOAD_PROGRAM_NV
, 4 );
4157 n
[4].data
= programCopy
;
4159 if (ctx
->ExecuteFlag
) {
4160 (*ctx
->Exec
->LoadProgramNV
)(target
, id
, len
, program
);
4166 save_RequestResidentProgramsNV(GLsizei num
, const GLuint
*ids
)
4168 GET_CURRENT_CONTEXT(ctx
);
4171 idCopy
= _mesa_malloc(num
* sizeof(GLuint
));
4173 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glRequestResidentProgramsNV");
4176 _mesa_memcpy(idCopy
, ids
, num
* sizeof(GLuint
));
4177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4178 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRACK_MATRIX_NV
, 2 );
4183 if (ctx
->ExecuteFlag
) {
4184 (*ctx
->Exec
->RequestResidentProgramsNV
)(num
, ids
);
4190 save_TrackMatrixNV(GLenum target
, GLuint address
,
4191 GLenum matrix
, GLenum transform
)
4193 GET_CURRENT_CONTEXT(ctx
);
4195 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4196 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_TRACK_MATRIX_NV
, 4 );
4203 if (ctx
->ExecuteFlag
) {
4204 (*ctx
->Exec
->TrackMatrixNV
)(target
, address
, matrix
, transform
);
4207 #endif /* FEATURE_NV_vertex_program */
4211 * GL_NV_fragment_program
4213 #if FEATURE_NV_fragment_program
4215 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4216 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4218 GET_CURRENT_CONTEXT(ctx
);
4220 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4221 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6 );
4230 if (ctx
->ExecuteFlag
) {
4231 (*ctx
->Exec
->ProgramLocalParameter4fARB
)(target
, index
, x
, y
, z
, w
);
4237 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4238 const GLfloat
*params
)
4240 GET_CURRENT_CONTEXT(ctx
);
4242 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4243 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6 );
4252 if (ctx
->ExecuteFlag
) {
4253 (*ctx
->Exec
->ProgramLocalParameter4fvARB
)(target
, index
, params
);
4259 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4260 GLdouble x
, GLdouble y
,
4261 GLdouble z
, GLdouble w
)
4263 GET_CURRENT_CONTEXT(ctx
);
4265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4266 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6 );
4270 n
[3].f
= (GLfloat
) x
;
4271 n
[4].f
= (GLfloat
) y
;
4272 n
[5].f
= (GLfloat
) z
;
4273 n
[6].f
= (GLfloat
) w
;
4275 if (ctx
->ExecuteFlag
) {
4276 (*ctx
->Exec
->ProgramLocalParameter4dARB
)(target
, index
, x
, y
, z
, w
);
4282 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4283 const GLdouble
*params
)
4285 GET_CURRENT_CONTEXT(ctx
);
4287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4288 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6 );
4292 n
[3].f
= (GLfloat
) params
[0];
4293 n
[4].f
= (GLfloat
) params
[1];
4294 n
[5].f
= (GLfloat
) params
[2];
4295 n
[6].f
= (GLfloat
) params
[3];
4297 if (ctx
->ExecuteFlag
) {
4298 (*ctx
->Exec
->ProgramLocalParameter4dvARB
)(target
, index
, params
);
4303 save_ProgramNamedParameter4fNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
4304 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4306 GET_CURRENT_CONTEXT(ctx
);
4310 nameCopy
= _mesa_malloc(len
);
4312 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramNamedParameter4fNV");
4315 _mesa_memcpy(nameCopy
, name
, len
);
4317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4318 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_PROGRAM_NAMED_PARAMETER_NV
, 6 );
4322 n
[3].data
= nameCopy
;
4328 if (ctx
->ExecuteFlag
) {
4329 (*ctx
->Exec
->ProgramNamedParameter4fNV
)(id
, len
, name
, x
, y
, z
, w
);
4335 save_ProgramNamedParameter4fvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
4338 save_ProgramNamedParameter4fNV(id
, len
, name
, v
[0], v
[1], v
[2], v
[3]);
4343 save_ProgramNamedParameter4dNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
4344 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4346 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) x
, (GLfloat
) y
,
4347 (GLfloat
) z
,(GLfloat
) w
);
4352 save_ProgramNamedParameter4dvNV(GLuint id
, GLsizei len
, const GLubyte
*name
,
4355 save_ProgramNamedParameter4fNV(id
, len
, name
, (GLfloat
) v
[0],
4356 (GLfloat
) v
[1], (GLfloat
) v
[2],
4360 #endif /* FEATURE_NV_fragment_program */
4364 /* GL_EXT_stencil_two_side */
4365 static void save_ActiveStencilFaceEXT( GLenum face
)
4367 GET_CURRENT_CONTEXT(ctx
);
4369 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4370 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1 );
4374 if (ctx
->ExecuteFlag
) {
4375 (*ctx
->Exec
->ActiveStencilFaceEXT
)( face
);
4380 /* GL_EXT_depth_bounds_test */
4381 static void save_DepthBoundsEXT( GLclampd zmin
, GLclampd zmax
)
4383 GET_CURRENT_CONTEXT(ctx
);
4385 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4386 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 2 );
4388 n
[1].f
= (GLfloat
) zmin
;
4389 n
[2].f
= (GLfloat
) zmax
;
4391 if (ctx
->ExecuteFlag
) {
4392 (*ctx
->Exec
->DepthBoundsEXT
)( zmin
, zmax
);
4399 /* KW: Compile commands
4401 * Will appear in the list before the vertex buffer containing the
4402 * command that provoked the error. I don't see this as a problem.
4405 _mesa_save_error( GLcontext
*ctx
, GLenum error
, const char *s
)
4408 n
= ALLOC_INSTRUCTION( ctx
, OPCODE_ERROR
, 2 );
4411 n
[2].data
= (void *) s
;
4413 /* execute already done */
4418 * Compile an error into current display list.
4421 _mesa_compile_error( GLcontext
*ctx
, GLenum error
, const char *s
)
4423 if (ctx
->CompileFlag
)
4424 _mesa_save_error( ctx
, error
, s
);
4426 if (ctx
->ExecuteFlag
)
4427 _mesa_error( ctx
, error
, s
);
4433 islist(GLcontext
*ctx
, GLuint list
)
4435 if (list
> 0 && _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
)) {
4445 /**********************************************************************/
4446 /* Display list execution */
4447 /**********************************************************************/
4451 * Execute a display list. Note that the ListBase offset must have already
4452 * been added before calling this function. I.e. the list argument is
4453 * the absolute list number, not relative to ListBase.
4454 * \param list - display list number
4457 execute_list( GLcontext
*ctx
, GLuint list
)
4462 if (list
== 0 || !islist(ctx
,list
))
4465 if (ctx
->Driver
.BeginCallList
)
4466 ctx
->Driver
.BeginCallList( ctx
, list
);
4470 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
4474 OpCode opcode
= n
[0].opcode
;
4475 int i
= (int)n
[0].opcode
- (int)OPCODE_DRV_0
;
4477 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
4478 ctx
->listext
.opcode
[i
].execute(ctx
, &n
[1]);
4479 n
+= ctx
->listext
.opcode
[i
].size
;
4484 _mesa_error( ctx
, n
[1].e
, (const char *) n
[2].data
);
4487 (*ctx
->Exec
->Accum
)( n
[1].e
, n
[2].f
);
4489 case OPCODE_ALPHA_FUNC
:
4490 (*ctx
->Exec
->AlphaFunc
)( n
[1].e
, n
[2].f
);
4492 case OPCODE_BIND_TEXTURE
:
4493 (*ctx
->Exec
->BindTexture
)( n
[1].e
, n
[2].ui
);
4497 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4498 ctx
->Unpack
= _mesa_native_packing
;
4499 (*ctx
->Exec
->Bitmap
)( (GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
4500 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (const GLubyte
*) n
[7].data
);
4501 ctx
->Unpack
= save
; /* restore */
4504 case OPCODE_BLEND_COLOR
:
4505 (*ctx
->Exec
->BlendColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4507 case OPCODE_BLEND_EQUATION
:
4508 (*ctx
->Exec
->BlendEquation
)( n
[1].e
);
4510 case OPCODE_BLEND_FUNC
:
4511 (*ctx
->Exec
->BlendFunc
)( n
[1].e
, n
[2].e
);
4513 case OPCODE_BLEND_FUNC_SEPARATE
:
4514 (*ctx
->Exec
->BlendFuncSeparateEXT
)(n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
);
4516 case OPCODE_CALL_LIST
:
4517 /* Generated by glCallList(), don't add ListBase */
4518 if (ctx
->CallDepth
<MAX_LIST_NESTING
) {
4519 execute_list( ctx
, n
[1].ui
);
4522 case OPCODE_CALL_LIST_OFFSET
:
4523 /* Generated by glCallLists() so we must add ListBase */
4525 /* user specified a bad data type at compile time */
4526 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
4528 else if (ctx
->CallDepth
< MAX_LIST_NESTING
) {
4529 execute_list( ctx
, ctx
->List
.ListBase
+ n
[1].ui
);
4533 (*ctx
->Exec
->Clear
)( n
[1].bf
);
4535 case OPCODE_CLEAR_COLOR
:
4536 (*ctx
->Exec
->ClearColor
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4538 case OPCODE_CLEAR_ACCUM
:
4539 (*ctx
->Exec
->ClearAccum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4541 case OPCODE_CLEAR_DEPTH
:
4542 (*ctx
->Exec
->ClearDepth
)( (GLclampd
) n
[1].f
);
4544 case OPCODE_CLEAR_INDEX
:
4545 (*ctx
->Exec
->ClearIndex
)( (GLfloat
) n
[1].ui
);
4547 case OPCODE_CLEAR_STENCIL
:
4548 (*ctx
->Exec
->ClearStencil
)( n
[1].i
);
4550 case OPCODE_CLIP_PLANE
:
4557 (*ctx
->Exec
->ClipPlane
)( n
[1].e
, eq
);
4560 case OPCODE_COLOR_MASK
:
4561 (*ctx
->Exec
->ColorMask
)( n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
);
4563 case OPCODE_COLOR_MATERIAL
:
4564 (*ctx
->Exec
->ColorMaterial
)( n
[1].e
, n
[2].e
);
4566 case OPCODE_COLOR_TABLE
:
4568 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4569 ctx
->Unpack
= _mesa_native_packing
;
4570 (*ctx
->Exec
->ColorTable
)( n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
4571 n
[5].e
, n
[6].data
);
4572 ctx
->Unpack
= save
; /* restore */
4575 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
4582 (*ctx
->Exec
->ColorTableParameterfv
)( n
[1].e
, n
[2].e
, params
);
4585 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
4592 (*ctx
->Exec
->ColorTableParameteriv
)( n
[1].e
, n
[2].e
, params
);
4595 case OPCODE_COLOR_SUB_TABLE
:
4597 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4598 ctx
->Unpack
= _mesa_native_packing
;
4599 (*ctx
->Exec
->ColorSubTable
)( n
[1].e
, n
[2].i
, n
[3].i
,
4600 n
[4].e
, n
[5].e
, n
[6].data
);
4601 ctx
->Unpack
= save
; /* restore */
4604 case OPCODE_CONVOLUTION_FILTER_1D
:
4606 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4607 ctx
->Unpack
= _mesa_native_packing
;
4608 (*ctx
->Exec
->ConvolutionFilter1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4609 n
[4].e
, n
[5].e
, n
[6].data
);
4610 ctx
->Unpack
= save
; /* restore */
4613 case OPCODE_CONVOLUTION_FILTER_2D
:
4615 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4616 ctx
->Unpack
= _mesa_native_packing
;
4617 (*ctx
->Exec
->ConvolutionFilter2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4618 n
[4].i
, n
[5].e
, n
[6].e
, n
[7].data
);
4619 ctx
->Unpack
= save
; /* restore */
4622 case OPCODE_CONVOLUTION_PARAMETER_I
:
4623 (*ctx
->Exec
->ConvolutionParameteri
)( n
[1].e
, n
[2].e
, n
[3].i
);
4625 case OPCODE_CONVOLUTION_PARAMETER_IV
:
4632 (*ctx
->Exec
->ConvolutionParameteriv
)( n
[1].e
, n
[2].e
, params
);
4635 case OPCODE_CONVOLUTION_PARAMETER_F
:
4636 (*ctx
->Exec
->ConvolutionParameterf
)( n
[1].e
, n
[2].e
, n
[3].f
);
4638 case OPCODE_CONVOLUTION_PARAMETER_FV
:
4645 (*ctx
->Exec
->ConvolutionParameterfv
)( n
[1].e
, n
[2].e
, params
);
4648 case OPCODE_COPY_COLOR_SUB_TABLE
:
4649 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4650 n
[3].i
, n
[4].i
, n
[5].i
);
4652 case OPCODE_COPY_COLOR_TABLE
:
4653 (*ctx
->Exec
->CopyColorSubTable
)( n
[1].e
, n
[2].i
,
4654 n
[3].i
, n
[4].i
, n
[5].i
);
4656 case OPCODE_COPY_PIXELS
:
4657 (*ctx
->Exec
->CopyPixels
)( n
[1].i
, n
[2].i
,
4658 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
, n
[5].e
);
4660 case OPCODE_COPY_TEX_IMAGE1D
:
4661 (*ctx
->Exec
->CopyTexImage1D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4662 n
[5].i
, n
[6].i
, n
[7].i
);
4664 case OPCODE_COPY_TEX_IMAGE2D
:
4665 (*ctx
->Exec
->CopyTexImage2D
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
4666 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4668 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
4669 (*ctx
->Exec
->CopyTexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4670 n
[4].i
, n
[5].i
, n
[6].i
);
4672 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
4673 (*ctx
->Exec
->CopyTexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4674 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
);
4676 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
4677 (*ctx
->Exec
->CopyTexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
4678 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
4680 case OPCODE_CULL_FACE
:
4681 (*ctx
->Exec
->CullFace
)( n
[1].e
);
4683 case OPCODE_DEPTH_FUNC
:
4684 (*ctx
->Exec
->DepthFunc
)( n
[1].e
);
4686 case OPCODE_DEPTH_MASK
:
4687 (*ctx
->Exec
->DepthMask
)( n
[1].b
);
4689 case OPCODE_DEPTH_RANGE
:
4690 (*ctx
->Exec
->DepthRange
)( (GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
);
4692 case OPCODE_DISABLE
:
4693 (*ctx
->Exec
->Disable
)( n
[1].e
);
4695 case OPCODE_DRAW_BUFFER
:
4696 (*ctx
->Exec
->DrawBuffer
)( n
[1].e
);
4698 case OPCODE_DRAW_PIXELS
:
4700 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4701 ctx
->Unpack
= _mesa_native_packing
;
4702 (*ctx
->Exec
->DrawPixels
)( n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
4704 ctx
->Unpack
= save
; /* restore */
4708 (*ctx
->Exec
->Enable
)( n
[1].e
);
4710 case OPCODE_EVALMESH1
:
4711 (*ctx
->Exec
->EvalMesh1
)( n
[1].e
, n
[2].i
, n
[3].i
);
4713 case OPCODE_EVALMESH2
:
4714 (*ctx
->Exec
->EvalMesh2
)( n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
);
4723 (*ctx
->Exec
->Fogfv
)( n
[1].e
, p
);
4726 case OPCODE_FRONT_FACE
:
4727 (*ctx
->Exec
->FrontFace
)( n
[1].e
);
4729 case OPCODE_FRUSTUM
:
4730 (*ctx
->Exec
->Frustum
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4733 (*ctx
->Exec
->Hint
)( n
[1].e
, n
[2].e
);
4735 case OPCODE_HISTOGRAM
:
4736 (*ctx
->Exec
->Histogram
)( n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
);
4738 case OPCODE_INDEX_MASK
:
4739 (*ctx
->Exec
->IndexMask
)( n
[1].ui
);
4741 case OPCODE_INIT_NAMES
:
4742 (*ctx
->Exec
->InitNames
)();
4751 (*ctx
->Exec
->Lightfv
)( n
[1].e
, n
[2].e
, p
);
4754 case OPCODE_LIGHT_MODEL
:
4761 (*ctx
->Exec
->LightModelfv
)( n
[1].e
, p
);
4764 case OPCODE_LINE_STIPPLE
:
4765 (*ctx
->Exec
->LineStipple
)( n
[1].i
, n
[2].us
);
4767 case OPCODE_LINE_WIDTH
:
4768 (*ctx
->Exec
->LineWidth
)( n
[1].f
);
4770 case OPCODE_LIST_BASE
:
4771 (*ctx
->Exec
->ListBase
)( n
[1].ui
);
4773 case OPCODE_LOAD_IDENTITY
:
4774 (*ctx
->Exec
->LoadIdentity
)();
4776 case OPCODE_LOAD_MATRIX
:
4777 if (sizeof(Node
)==sizeof(GLfloat
)) {
4778 (*ctx
->Exec
->LoadMatrixf
)( &n
[1].f
);
4783 for (i
=0;i
<16;i
++) {
4786 (*ctx
->Exec
->LoadMatrixf
)( m
);
4789 case OPCODE_LOAD_NAME
:
4790 (*ctx
->Exec
->LoadName
)( n
[1].ui
);
4792 case OPCODE_LOGIC_OP
:
4793 (*ctx
->Exec
->LogicOp
)( n
[1].e
);
4797 GLenum target
= n
[1].e
;
4798 GLint ustride
= _mesa_evaluator_components(target
);
4799 GLint uorder
= n
[5].i
;
4800 GLfloat u1
= n
[2].f
;
4801 GLfloat u2
= n
[3].f
;
4802 (*ctx
->Exec
->Map1f
)( target
, u1
, u2
, ustride
, uorder
,
4803 (GLfloat
*) n
[6].data
);
4808 GLenum target
= n
[1].e
;
4809 GLfloat u1
= n
[2].f
;
4810 GLfloat u2
= n
[3].f
;
4811 GLfloat v1
= n
[4].f
;
4812 GLfloat v2
= n
[5].f
;
4813 GLint ustride
= n
[6].i
;
4814 GLint vstride
= n
[7].i
;
4815 GLint uorder
= n
[8].i
;
4816 GLint vorder
= n
[9].i
;
4817 (*ctx
->Exec
->Map2f
)( target
, u1
, u2
, ustride
, uorder
,
4818 v1
, v2
, vstride
, vorder
,
4819 (GLfloat
*) n
[10].data
);
4822 case OPCODE_MAPGRID1
:
4823 (*ctx
->Exec
->MapGrid1f
)( n
[1].i
, n
[2].f
, n
[3].f
);
4825 case OPCODE_MAPGRID2
:
4826 (*ctx
->Exec
->MapGrid2f
)( n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
4828 case OPCODE_MATRIX_MODE
:
4829 (*ctx
->Exec
->MatrixMode
)( n
[1].e
);
4831 case OPCODE_MIN_MAX
:
4832 (*ctx
->Exec
->Minmax
)(n
[1].e
, n
[2].e
, n
[3].b
);
4834 case OPCODE_MULT_MATRIX
:
4835 if (sizeof(Node
)==sizeof(GLfloat
)) {
4836 (*ctx
->Exec
->MultMatrixf
)( &n
[1].f
);
4841 for (i
=0;i
<16;i
++) {
4844 (*ctx
->Exec
->MultMatrixf
)( m
);
4848 (*ctx
->Exec
->Ortho
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
4850 case OPCODE_PASSTHROUGH
:
4851 (*ctx
->Exec
->PassThrough
)( n
[1].f
);
4853 case OPCODE_PIXEL_MAP
:
4854 (*ctx
->Exec
->PixelMapfv
)( n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
);
4856 case OPCODE_PIXEL_TRANSFER
:
4857 (*ctx
->Exec
->PixelTransferf
)( n
[1].e
, n
[2].f
);
4859 case OPCODE_PIXEL_ZOOM
:
4860 (*ctx
->Exec
->PixelZoom
)( n
[1].f
, n
[2].f
);
4862 case OPCODE_POINT_SIZE
:
4863 (*ctx
->Exec
->PointSize
)( n
[1].f
);
4865 case OPCODE_POINT_PARAMETERS
:
4871 (*ctx
->Exec
->PointParameterfvEXT
)( n
[1].e
, params
);
4874 case OPCODE_POLYGON_MODE
:
4875 (*ctx
->Exec
->PolygonMode
)( n
[1].e
, n
[2].e
);
4877 case OPCODE_POLYGON_STIPPLE
:
4878 (*ctx
->Exec
->PolygonStipple
)( (GLubyte
*) n
[1].data
);
4880 case OPCODE_POLYGON_OFFSET
:
4881 (*ctx
->Exec
->PolygonOffset
)( n
[1].f
, n
[2].f
);
4883 case OPCODE_POP_ATTRIB
:
4884 (*ctx
->Exec
->PopAttrib
)();
4886 case OPCODE_POP_MATRIX
:
4887 (*ctx
->Exec
->PopMatrix
)();
4889 case OPCODE_POP_NAME
:
4890 (*ctx
->Exec
->PopName
)();
4892 case OPCODE_PRIORITIZE_TEXTURE
:
4893 (*ctx
->Exec
->PrioritizeTextures
)( 1, &n
[1].ui
, &n
[2].f
);
4895 case OPCODE_PUSH_ATTRIB
:
4896 (*ctx
->Exec
->PushAttrib
)( n
[1].bf
);
4898 case OPCODE_PUSH_MATRIX
:
4899 (*ctx
->Exec
->PushMatrix
)();
4901 case OPCODE_PUSH_NAME
:
4902 (*ctx
->Exec
->PushName
)( n
[1].ui
);
4904 case OPCODE_RASTER_POS
:
4905 (*ctx
->Exec
->RasterPos4f
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4907 case OPCODE_READ_BUFFER
:
4908 (*ctx
->Exec
->ReadBuffer
)( n
[1].e
);
4910 case OPCODE_RESET_HISTOGRAM
:
4911 (*ctx
->Exec
->ResetHistogram
)( n
[1].e
);
4913 case OPCODE_RESET_MIN_MAX
:
4914 (*ctx
->Exec
->ResetMinmax
)( n
[1].e
);
4917 (*ctx
->Exec
->Rotatef
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
4920 (*ctx
->Exec
->Scalef
)( n
[1].f
, n
[2].f
, n
[3].f
);
4922 case OPCODE_SCISSOR
:
4923 (*ctx
->Exec
->Scissor
)( n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
4925 case OPCODE_SHADE_MODEL
:
4926 (*ctx
->Exec
->ShadeModel
)( n
[1].e
);
4928 case OPCODE_STENCIL_FUNC
:
4929 (*ctx
->Exec
->StencilFunc
)( n
[1].e
, n
[2].i
, n
[3].ui
);
4931 case OPCODE_STENCIL_MASK
:
4932 (*ctx
->Exec
->StencilMask
)( n
[1].ui
);
4934 case OPCODE_STENCIL_OP
:
4935 (*ctx
->Exec
->StencilOp
)( n
[1].e
, n
[2].e
, n
[3].e
);
4944 (*ctx
->Exec
->TexEnvfv
)( n
[1].e
, n
[2].e
, params
);
4954 (*ctx
->Exec
->TexGenfv
)( n
[1].e
, n
[2].e
, params
);
4957 case OPCODE_TEXPARAMETER
:
4964 (*ctx
->Exec
->TexParameterfv
)( n
[1].e
, n
[2].e
, params
);
4967 case OPCODE_TEX_IMAGE1D
:
4969 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4970 ctx
->Unpack
= _mesa_native_packing
;
4971 (*ctx
->Exec
->TexImage1D
)(
4972 n
[1].e
, /* target */
4974 n
[3].i
, /* components */
4976 n
[5].e
, /* border */
4977 n
[6].e
, /* format */
4980 ctx
->Unpack
= save
; /* restore */
4983 case OPCODE_TEX_IMAGE2D
:
4985 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
4986 ctx
->Unpack
= _mesa_native_packing
;
4987 (*ctx
->Exec
->TexImage2D
)(
4988 n
[1].e
, /* target */
4990 n
[3].i
, /* components */
4992 n
[5].i
, /* height */
4993 n
[6].e
, /* border */
4994 n
[7].e
, /* format */
4997 ctx
->Unpack
= save
; /* restore */
5000 case OPCODE_TEX_IMAGE3D
:
5002 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5003 ctx
->Unpack
= _mesa_native_packing
;
5004 (*ctx
->Exec
->TexImage3D
)(
5005 n
[1].e
, /* target */
5007 n
[3].i
, /* components */
5009 n
[5].i
, /* height */
5011 n
[7].e
, /* border */
5012 n
[8].e
, /* format */
5015 ctx
->Unpack
= save
; /* restore */
5018 case OPCODE_TEX_SUB_IMAGE1D
:
5020 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5021 ctx
->Unpack
= _mesa_native_packing
;
5022 (*ctx
->Exec
->TexSubImage1D
)( n
[1].e
, n
[2].i
, n
[3].i
,
5024 n
[6].e
, n
[7].data
);
5025 ctx
->Unpack
= save
; /* restore */
5028 case OPCODE_TEX_SUB_IMAGE2D
:
5030 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5031 ctx
->Unpack
= _mesa_native_packing
;
5032 (*ctx
->Exec
->TexSubImage2D
)( n
[1].e
, n
[2].i
, n
[3].i
,
5034 n
[6].i
, n
[7].e
, n
[8].e
, n
[9].data
);
5035 ctx
->Unpack
= save
; /* restore */
5038 case OPCODE_TEX_SUB_IMAGE3D
:
5040 struct gl_pixelstore_attrib save
= ctx
->Unpack
;
5041 ctx
->Unpack
= _mesa_native_packing
;
5042 (*ctx
->Exec
->TexSubImage3D
)( n
[1].e
, n
[2].i
, n
[3].i
,
5043 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
5044 n
[8].i
, n
[9].e
, n
[10].e
,
5046 ctx
->Unpack
= save
; /* restore */
5049 case OPCODE_TRANSLATE
:
5050 (*ctx
->Exec
->Translatef
)( n
[1].f
, n
[2].f
, n
[3].f
);
5052 case OPCODE_VIEWPORT
:
5053 (*ctx
->Exec
->Viewport
)(n
[1].i
, n
[2].i
,
5054 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
);
5056 case OPCODE_WINDOW_POS
:
5057 (*ctx
->Exec
->WindowPos4fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
5059 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
5060 (*ctx
->Exec
->ActiveTextureARB
)( n
[1].e
);
5062 case OPCODE_PIXEL_TEXGEN_SGIX
: /* GL_SGIX_pixel_texture */
5063 (*ctx
->Exec
->PixelTexGenSGIX
)( n
[1].e
);
5065 case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS
: /* GL_SGIS_pixel_texture */
5066 (*ctx
->Exec
->PixelTexGenParameteriSGIS
)( n
[1].e
, n
[2].i
);
5068 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
5069 (*ctx
->Exec
->CompressedTexImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
5070 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].data
);
5072 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
5073 (*ctx
->Exec
->CompressedTexImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
5074 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].data
);
5076 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
5077 (*ctx
->Exec
->CompressedTexImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].e
,
5078 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
, n
[9].data
);
5080 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
5081 (*ctx
->Exec
->CompressedTexSubImage1DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
5082 n
[4].i
, n
[5].e
, n
[6].i
, n
[7].data
);
5084 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
5085 (*ctx
->Exec
->CompressedTexSubImage2DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
5086 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
, n
[9].data
);
5088 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
5089 (*ctx
->Exec
->CompressedTexSubImage3DARB
)(n
[1].e
, n
[2].i
, n
[3].i
,
5090 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
5091 n
[9].e
, n
[10].i
, n
[11].data
);
5093 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
5094 (*ctx
->Exec
->SampleCoverageARB
)(n
[1].f
, n
[2].b
);
5096 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
5097 (*ctx
->Exec
->WindowPos3fMESA
)( n
[1].f
, n
[2].f
, n
[3].f
);
5099 #if FEATURE_NV_vertex_program
5100 case OPCODE_BIND_PROGRAM_NV
: /* GL_NV_vertex_program */
5101 (*ctx
->Exec
->BindProgramNV
)( n
[1].e
, n
[2].ui
);
5103 case OPCODE_EXECUTE_PROGRAM_NV
:
5110 (*ctx
->Exec
->ExecuteProgramNV
)(n
[1].e
, n
[2].ui
, v
);
5113 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV
:
5114 (*ctx
->Exec
->RequestResidentProgramsNV
)(n
[1].ui
, n
[2].data
);
5116 case OPCODE_LOAD_PROGRAM_NV
:
5117 (*ctx
->Exec
->LoadProgramNV
)(n
[1].e
, n
[2].ui
, n
[3].i
, n
[4].data
);
5119 case OPCODE_PROGRAM_PARAMETER4F_NV
:
5120 (*ctx
->Exec
->ProgramParameter4fNV
)(n
[1].e
, n
[2].ui
, n
[3].f
,
5121 n
[4].f
, n
[5].f
, n
[6].f
);
5123 case OPCODE_TRACK_MATRIX_NV
:
5124 (*ctx
->Exec
->TrackMatrixNV
)(n
[1].e
, n
[2].ui
, n
[3].e
, n
[4].e
);
5128 #if FEATURE_NV_fragment_program
5129 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
5130 (*ctx
->Exec
->ProgramLocalParameter4fARB
)(n
[1].e
, n
[2].ui
, n
[3].f
,
5131 n
[4].f
, n
[5].f
, n
[6].f
);
5133 case OPCODE_PROGRAM_NAMED_PARAMETER_NV
:
5134 (*ctx
->Exec
->ProgramNamedParameter4fNV
)(n
[1].ui
, n
[2].i
, n
[3].data
,
5135 n
[4].f
, n
[5].f
, n
[6].f
, n
[7].f
);
5139 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
5140 (*ctx
->Exec
->ActiveStencilFaceEXT
)(n
[1].e
);
5142 case OPCODE_DEPTH_BOUNDS_EXT
:
5143 (*ctx
->Exec
->DepthBoundsEXT
)(n
[1].f
, n
[2].f
);
5146 case OPCODE_CONTINUE
:
5147 n
= (Node
*) n
[1].next
;
5149 case OPCODE_END_OF_LIST
:
5155 _mesa_sprintf(msg
, "Error in execute_list: opcode=%d", (int) opcode
);
5156 _mesa_problem(ctx
, msg
);
5161 /* increment n to point to next compiled command */
5162 if (opcode
!=OPCODE_CONTINUE
) {
5163 n
+= InstSize
[opcode
];
5169 if (ctx
->Driver
.EndCallList
)
5170 ctx
->Driver
.EndCallList( ctx
);
5177 /**********************************************************************/
5179 /**********************************************************************/
5185 * Test if a display list number is valid.
5188 _mesa_IsList( GLuint list
)
5190 GET_CURRENT_CONTEXT(ctx
);
5191 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
5192 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
5193 return islist(ctx
, list
);
5198 * Delete a sequence of consecutive display lists.
5201 _mesa_DeleteLists( GLuint list
, GLsizei range
)
5203 GET_CURRENT_CONTEXT(ctx
);
5205 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
5206 ASSERT_OUTSIDE_BEGIN_END(ctx
);
5209 _mesa_error( ctx
, GL_INVALID_VALUE
, "glDeleteLists" );
5212 for (i
=list
;i
<list
+range
;i
++) {
5213 _mesa_destroy_list( ctx
, i
);
5220 * Return a display list number, n, such that lists n through n+range-1
5224 _mesa_GenLists(GLsizei range
)
5226 GET_CURRENT_CONTEXT(ctx
);
5228 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
5229 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
5232 _mesa_error( ctx
, GL_INVALID_VALUE
, "glGenLists" );
5240 * Make this an atomic operation
5242 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
5244 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
5246 /* reserve the list IDs by with empty/dummy lists */
5248 for (i
=0; i
<range
; i
++) {
5249 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+i
, make_empty_list());
5253 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
5261 * Begin a new display list.
5264 _mesa_NewList( GLuint list
, GLenum mode
)
5266 GET_CURRENT_CONTEXT(ctx
);
5267 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
5268 ASSERT_OUTSIDE_BEGIN_END(ctx
);
5270 if (MESA_VERBOSE
&VERBOSE_API
)
5271 _mesa_debug(ctx
, "glNewList %u %s\n", list
,
5272 _mesa_lookup_enum_by_nr(mode
));
5275 _mesa_error( ctx
, GL_INVALID_VALUE
, "glNewList" );
5279 if (mode
!=GL_COMPILE
&& mode
!=GL_COMPILE_AND_EXECUTE
) {
5280 _mesa_error( ctx
, GL_INVALID_ENUM
, "glNewList" );
5284 if (ctx
->CurrentListPtr
) {
5285 /* already compiling a display list */
5286 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glNewList" );
5290 /* Allocate new display list */
5291 ctx
->CurrentListNum
= list
;
5292 ctx
->CurrentBlock
= (Node
*) MALLOC( sizeof(Node
) * BLOCK_SIZE
);
5293 ctx
->CurrentListPtr
= ctx
->CurrentBlock
;
5294 ctx
->CurrentPos
= 0;
5295 ctx
->CompileFlag
= GL_TRUE
;
5296 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
5298 ctx
->Driver
.NewList( ctx
, list
, mode
);
5300 ctx
->CurrentDispatch
= ctx
->Save
;
5301 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5307 * End definition of current display list. Is the current
5308 * ASSERT_OUTSIDE_BEGIN_END strong enough to really guarentee that
5309 * we are outside begin/end calls?
5312 _mesa_EndList( void )
5314 GET_CURRENT_CONTEXT(ctx
);
5315 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
5316 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
5318 if (MESA_VERBOSE
&VERBOSE_API
)
5319 _mesa_debug(ctx
, "glEndList\n");
5321 /* Check that a list is under construction */
5322 if (!ctx
->CurrentListPtr
) {
5323 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEndList" );
5327 (void) ALLOC_INSTRUCTION( ctx
, OPCODE_END_OF_LIST
, 0 );
5329 /* Destroy old list, if any */
5330 _mesa_destroy_list(ctx
, ctx
->CurrentListNum
);
5331 /* Install the list */
5332 _mesa_HashInsert(ctx
->Shared
->DisplayList
, ctx
->CurrentListNum
, ctx
->CurrentListPtr
);
5335 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
5336 mesa_print_display_list(ctx
->CurrentListNum
);
5338 ctx
->CurrentListNum
= 0;
5339 ctx
->CurrentListPtr
= NULL
;
5340 ctx
->ExecuteFlag
= GL_TRUE
;
5341 ctx
->CompileFlag
= GL_FALSE
;
5343 ctx
->Driver
.EndList( ctx
);
5345 ctx
->CurrentDispatch
= ctx
->Exec
;
5346 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5352 _mesa_CallList( GLuint list
)
5354 GLboolean save_compile_flag
;
5355 GET_CURRENT_CONTEXT(ctx
);
5356 FLUSH_CURRENT(ctx
, 0);
5357 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
5358 /* execute the display list, and restore the CompileFlag. */
5360 if (MESA_VERBOSE
& VERBOSE_API
)
5361 _mesa_debug(ctx
, "glCallList %d\n", list
);
5364 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
5368 /* mesa_print_display_list( list ); */
5370 save_compile_flag
= ctx
->CompileFlag
;
5371 if (save_compile_flag
) {
5372 ctx
->CompileFlag
= GL_FALSE
;
5375 execute_list( ctx
, list
);
5376 ctx
->CompileFlag
= save_compile_flag
;
5378 /* also restore API function pointers to point to "save" versions */
5379 if (save_compile_flag
) {
5380 ctx
->CurrentDispatch
= ctx
->Save
;
5381 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5388 * Execute glCallLists: call multiple display lists.
5391 _mesa_CallLists( GLsizei n
, GLenum type
, const GLvoid
*lists
)
5393 GET_CURRENT_CONTEXT(ctx
);
5396 GLboolean save_compile_flag
;
5398 if (MESA_VERBOSE
& VERBOSE_API
)
5399 _mesa_debug(ctx
, "glCallLists %d\n", n
);
5403 case GL_UNSIGNED_BYTE
:
5405 case GL_UNSIGNED_SHORT
:
5407 case GL_UNSIGNED_INT
:
5415 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
5419 /* Save the CompileFlag status, turn it off, execute display list,
5420 * and restore the CompileFlag.
5422 save_compile_flag
= ctx
->CompileFlag
;
5423 ctx
->CompileFlag
= GL_FALSE
;
5426 list
= translate_id( i
, type
, lists
);
5427 execute_list( ctx
, ctx
->List
.ListBase
+ list
);
5430 ctx
->CompileFlag
= save_compile_flag
;
5432 /* also restore API function pointers to point to "save" versions */
5433 if (save_compile_flag
) {
5434 ctx
->CurrentDispatch
= ctx
->Save
;
5435 _glapi_set_dispatch( ctx
->CurrentDispatch
);
5442 * Set the offset added to list numbers in glCallLists.
5445 _mesa_ListBase( GLuint base
)
5447 GET_CURRENT_CONTEXT(ctx
);
5448 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
5449 ASSERT_OUTSIDE_BEGIN_END(ctx
);
5450 ctx
->List
.ListBase
= base
;
5454 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
5456 static void exec_Finish( void )
5458 GET_CURRENT_CONTEXT(ctx
);
5459 FLUSH_VERTICES(ctx
, 0);
5460 ctx
->Exec
->Finish();
5463 static void exec_Flush( void )
5465 GET_CURRENT_CONTEXT(ctx
);
5466 FLUSH_VERTICES(ctx
, 0);
5467 ctx
->Exec
->Flush( );
5470 static void exec_GetBooleanv( GLenum pname
, GLboolean
*params
)
5472 GET_CURRENT_CONTEXT(ctx
);
5473 FLUSH_VERTICES(ctx
, 0);
5474 ctx
->Exec
->GetBooleanv( pname
, params
);
5477 static void exec_GetClipPlane( GLenum plane
, GLdouble
*equation
)
5479 GET_CURRENT_CONTEXT(ctx
);
5480 FLUSH_VERTICES(ctx
, 0);
5481 ctx
->Exec
->GetClipPlane( plane
, equation
);
5484 static void exec_GetDoublev( GLenum pname
, GLdouble
*params
)
5486 GET_CURRENT_CONTEXT(ctx
);
5487 FLUSH_VERTICES(ctx
, 0);
5488 ctx
->Exec
->GetDoublev( pname
, params
);
5491 static GLenum
exec_GetError( void )
5493 GET_CURRENT_CONTEXT(ctx
);
5494 FLUSH_VERTICES(ctx
, 0);
5495 return ctx
->Exec
->GetError( );
5498 static void exec_GetFloatv( GLenum pname
, GLfloat
*params
)
5500 GET_CURRENT_CONTEXT(ctx
);
5501 FLUSH_VERTICES(ctx
, 0);
5502 ctx
->Exec
->GetFloatv( pname
, params
);
5505 static void exec_GetIntegerv( GLenum pname
, GLint
*params
)
5507 GET_CURRENT_CONTEXT(ctx
);
5508 FLUSH_VERTICES(ctx
, 0);
5509 ctx
->Exec
->GetIntegerv( pname
, params
);
5512 static void exec_GetLightfv( GLenum light
, GLenum pname
, GLfloat
*params
)
5514 GET_CURRENT_CONTEXT(ctx
);
5515 FLUSH_VERTICES(ctx
, 0);
5516 ctx
->Exec
->GetLightfv( light
, pname
, params
);
5519 static void exec_GetLightiv( GLenum light
, GLenum pname
, GLint
*params
)
5521 GET_CURRENT_CONTEXT(ctx
);
5522 FLUSH_VERTICES(ctx
, 0);
5523 ctx
->Exec
->GetLightiv( light
, pname
, params
);
5526 static void exec_GetMapdv( GLenum target
, GLenum query
, GLdouble
*v
)
5528 GET_CURRENT_CONTEXT(ctx
);
5529 FLUSH_VERTICES(ctx
, 0);
5530 ctx
->Exec
->GetMapdv( target
, query
, v
);
5533 static void exec_GetMapfv( GLenum target
, GLenum query
, GLfloat
*v
)
5535 GET_CURRENT_CONTEXT(ctx
);
5536 FLUSH_VERTICES(ctx
, 0);
5537 ctx
->Exec
->GetMapfv( target
, query
, v
);
5540 static void exec_GetMapiv( GLenum target
, GLenum query
, GLint
*v
)
5542 GET_CURRENT_CONTEXT(ctx
);
5543 FLUSH_VERTICES(ctx
, 0);
5544 ctx
->Exec
->GetMapiv( target
, query
, v
);
5547 static void exec_GetMaterialfv( GLenum face
, GLenum pname
, GLfloat
*params
)
5549 GET_CURRENT_CONTEXT(ctx
);
5550 FLUSH_VERTICES(ctx
, 0);
5551 ctx
->Exec
->GetMaterialfv( face
, pname
, params
);
5554 static void exec_GetMaterialiv( GLenum face
, GLenum pname
, GLint
*params
)
5556 GET_CURRENT_CONTEXT(ctx
);
5557 FLUSH_VERTICES(ctx
, 0);
5558 ctx
->Exec
->GetMaterialiv( face
, pname
, params
);
5561 static void exec_GetPixelMapfv( GLenum map
, GLfloat
*values
)
5563 GET_CURRENT_CONTEXT(ctx
);
5564 FLUSH_VERTICES(ctx
, 0);
5565 ctx
->Exec
->GetPixelMapfv( map
, values
);
5568 static void exec_GetPixelMapuiv( GLenum map
, GLuint
*values
)
5570 GET_CURRENT_CONTEXT(ctx
);
5571 FLUSH_VERTICES(ctx
, 0);
5572 ctx
->Exec
->GetPixelMapuiv( map
, values
);
5575 static void exec_GetPixelMapusv( GLenum map
, GLushort
*values
)
5577 GET_CURRENT_CONTEXT(ctx
);
5578 FLUSH_VERTICES(ctx
, 0);
5579 ctx
->Exec
->GetPixelMapusv( map
, values
);
5582 static void exec_GetPolygonStipple( GLubyte
*dest
)
5584 GET_CURRENT_CONTEXT(ctx
);
5585 FLUSH_VERTICES(ctx
, 0);
5586 ctx
->Exec
->GetPolygonStipple( dest
);
5589 static const GLubyte
*exec_GetString( GLenum name
)
5591 GET_CURRENT_CONTEXT(ctx
);
5592 FLUSH_VERTICES(ctx
, 0);
5593 return ctx
->Exec
->GetString( name
);
5596 static void exec_GetTexEnvfv( GLenum target
, GLenum pname
, GLfloat
*params
)
5598 GET_CURRENT_CONTEXT(ctx
);
5599 FLUSH_VERTICES(ctx
, 0);
5600 ctx
->Exec
->GetTexEnvfv( target
, pname
, params
);
5603 static void exec_GetTexEnviv( GLenum target
, GLenum pname
, GLint
*params
)
5605 GET_CURRENT_CONTEXT(ctx
);
5606 FLUSH_VERTICES(ctx
, 0);
5607 ctx
->Exec
->GetTexEnviv( target
, pname
, params
);
5610 static void exec_GetTexGendv( GLenum coord
, GLenum pname
, GLdouble
*params
)
5612 GET_CURRENT_CONTEXT(ctx
);
5613 FLUSH_VERTICES(ctx
, 0);
5614 ctx
->Exec
->GetTexGendv( coord
, pname
, params
);
5617 static void exec_GetTexGenfv( GLenum coord
, GLenum pname
, GLfloat
*params
)
5619 GET_CURRENT_CONTEXT(ctx
);
5620 FLUSH_VERTICES(ctx
, 0);
5621 ctx
->Exec
->GetTexGenfv( coord
, pname
, params
);
5624 static void exec_GetTexGeniv( GLenum coord
, GLenum pname
, GLint
*params
)
5626 GET_CURRENT_CONTEXT(ctx
);
5627 FLUSH_VERTICES(ctx
, 0);
5628 ctx
->Exec
->GetTexGeniv( coord
, pname
, params
);
5631 static void exec_GetTexImage( GLenum target
, GLint level
, GLenum format
,
5632 GLenum type
, GLvoid
*pixels
)
5634 GET_CURRENT_CONTEXT(ctx
);
5635 FLUSH_VERTICES(ctx
, 0);
5636 ctx
->Exec
->GetTexImage( target
, level
, format
, type
, pixels
);
5639 static void exec_GetTexLevelParameterfv( GLenum target
, GLint level
,
5640 GLenum pname
, GLfloat
*params
)
5642 GET_CURRENT_CONTEXT(ctx
);
5643 FLUSH_VERTICES(ctx
, 0);
5644 ctx
->Exec
->GetTexLevelParameterfv( target
, level
, pname
, params
);
5647 static void exec_GetTexLevelParameteriv( GLenum target
, GLint level
,
5648 GLenum pname
, GLint
*params
)
5650 GET_CURRENT_CONTEXT(ctx
);
5651 FLUSH_VERTICES(ctx
, 0);
5652 ctx
->Exec
->GetTexLevelParameteriv( target
, level
, pname
, params
);
5655 static void exec_GetTexParameterfv( GLenum target
, GLenum pname
,
5658 GET_CURRENT_CONTEXT(ctx
);
5659 FLUSH_VERTICES(ctx
, 0);
5660 ctx
->Exec
->GetTexParameterfv( target
, pname
, params
);
5663 static void exec_GetTexParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
5665 GET_CURRENT_CONTEXT(ctx
);
5666 FLUSH_VERTICES(ctx
, 0);
5667 ctx
->Exec
->GetTexParameteriv( target
, pname
, params
);
5670 static GLboolean
exec_IsEnabled( GLenum cap
)
5672 GET_CURRENT_CONTEXT(ctx
);
5673 FLUSH_VERTICES(ctx
, 0);
5674 return ctx
->Exec
->IsEnabled( cap
);
5677 static void exec_PixelStoref( GLenum pname
, GLfloat param
)
5679 GET_CURRENT_CONTEXT(ctx
);
5680 FLUSH_VERTICES(ctx
, 0);
5681 ctx
->Exec
->PixelStoref( pname
, param
);
5684 static void exec_PixelStorei( GLenum pname
, GLint param
)
5686 GET_CURRENT_CONTEXT(ctx
);
5687 FLUSH_VERTICES(ctx
, 0);
5688 ctx
->Exec
->PixelStorei( pname
, param
);
5691 static void exec_ReadPixels( GLint x
, GLint y
, GLsizei width
, GLsizei height
,
5692 GLenum format
, GLenum type
, GLvoid
*pixels
)
5694 GET_CURRENT_CONTEXT(ctx
);
5695 FLUSH_VERTICES(ctx
, 0);
5696 ctx
->Exec
->ReadPixels( x
, y
, width
, height
, format
, type
, pixels
);
5699 static GLint
exec_RenderMode( GLenum mode
)
5701 GET_CURRENT_CONTEXT(ctx
);
5702 FLUSH_VERTICES(ctx
, 0);
5703 return ctx
->Exec
->RenderMode( mode
);
5706 static void exec_FeedbackBuffer( GLsizei size
, GLenum type
, GLfloat
*buffer
)
5708 GET_CURRENT_CONTEXT(ctx
);
5709 FLUSH_VERTICES(ctx
, 0);
5710 ctx
->Exec
->FeedbackBuffer( size
, type
, buffer
);
5713 static void exec_SelectBuffer( GLsizei size
, GLuint
*buffer
)
5715 GET_CURRENT_CONTEXT(ctx
);
5716 FLUSH_VERTICES(ctx
, 0);
5717 ctx
->Exec
->SelectBuffer( size
, buffer
);
5720 static GLboolean
exec_AreTexturesResident(GLsizei n
, const GLuint
*texName
,
5721 GLboolean
*residences
)
5723 GET_CURRENT_CONTEXT(ctx
);
5724 FLUSH_VERTICES(ctx
, 0);
5725 return ctx
->Exec
->AreTexturesResident( n
, texName
, residences
);
5728 static void exec_ColorPointer(GLint size
, GLenum type
, GLsizei stride
,
5731 GET_CURRENT_CONTEXT(ctx
);
5732 FLUSH_VERTICES(ctx
, 0);
5733 ctx
->Exec
->ColorPointer( size
, type
, stride
, ptr
);
5736 static void exec_DeleteTextures( GLsizei n
, const GLuint
*texName
)
5738 GET_CURRENT_CONTEXT(ctx
);
5739 FLUSH_VERTICES(ctx
, 0);
5740 ctx
->Exec
->DeleteTextures( n
, texName
);
5743 static void exec_DisableClientState( GLenum cap
)
5745 GET_CURRENT_CONTEXT(ctx
);
5746 FLUSH_VERTICES(ctx
, 0);
5747 ctx
->Exec
->DisableClientState( cap
);
5750 static void exec_EdgeFlagPointer(GLsizei stride
, const void *vptr
)
5752 GET_CURRENT_CONTEXT(ctx
);
5753 FLUSH_VERTICES(ctx
, 0);
5754 ctx
->Exec
->EdgeFlagPointer( stride
, vptr
);
5757 static void exec_EnableClientState( GLenum cap
)
5759 GET_CURRENT_CONTEXT(ctx
);
5760 FLUSH_VERTICES(ctx
, 0);
5761 ctx
->Exec
->EnableClientState( cap
);
5764 static void exec_GenTextures( GLsizei n
, GLuint
*texName
)
5766 GET_CURRENT_CONTEXT(ctx
);
5767 FLUSH_VERTICES(ctx
, 0);
5768 ctx
->Exec
->GenTextures( n
, texName
);
5771 static void exec_GetPointerv( GLenum pname
, GLvoid
**params
)
5773 GET_CURRENT_CONTEXT(ctx
);
5774 FLUSH_VERTICES(ctx
, 0);
5775 ctx
->Exec
->GetPointerv( pname
, params
);
5778 static void exec_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5780 GET_CURRENT_CONTEXT(ctx
);
5781 FLUSH_VERTICES(ctx
, 0);
5782 ctx
->Exec
->IndexPointer( type
, stride
, ptr
);
5785 static void exec_InterleavedArrays(GLenum format
, GLsizei stride
,
5786 const GLvoid
*pointer
)
5788 GET_CURRENT_CONTEXT(ctx
);
5789 FLUSH_VERTICES(ctx
, 0);
5790 ctx
->Exec
->InterleavedArrays( format
, stride
, pointer
);
5793 static GLboolean
exec_IsTexture( GLuint texture
)
5795 GET_CURRENT_CONTEXT(ctx
);
5796 FLUSH_VERTICES(ctx
, 0);
5797 return ctx
->Exec
->IsTexture( texture
);
5800 static void exec_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
5802 GET_CURRENT_CONTEXT(ctx
);
5803 FLUSH_VERTICES(ctx
, 0);
5804 ctx
->Exec
->NormalPointer( type
, stride
, ptr
);
5807 static void exec_PopClientAttrib(void)
5809 GET_CURRENT_CONTEXT(ctx
);
5810 FLUSH_VERTICES(ctx
, 0);
5811 ctx
->Exec
->PopClientAttrib();
5814 static void exec_PushClientAttrib(GLbitfield mask
)
5816 GET_CURRENT_CONTEXT(ctx
);
5817 FLUSH_VERTICES(ctx
, 0);
5818 ctx
->Exec
->PushClientAttrib( mask
);
5821 static void exec_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
5824 GET_CURRENT_CONTEXT(ctx
);
5825 FLUSH_VERTICES(ctx
, 0);
5826 ctx
->Exec
->TexCoordPointer( size
, type
, stride
, ptr
);
5829 static void exec_GetCompressedTexImageARB(GLenum target
, GLint level
,
5832 GET_CURRENT_CONTEXT(ctx
);
5833 FLUSH_VERTICES(ctx
, 0);
5834 ctx
->Exec
->GetCompressedTexImageARB( target
, level
, img
);
5837 static void exec_VertexPointer(GLint size
, GLenum type
, GLsizei stride
,
5840 GET_CURRENT_CONTEXT(ctx
);
5841 FLUSH_VERTICES(ctx
, 0);
5842 ctx
->Exec
->VertexPointer( size
, type
, stride
, ptr
);
5845 static void exec_CopyConvolutionFilter1D(GLenum target
, GLenum internalFormat
,
5846 GLint x
, GLint y
, GLsizei width
)
5848 GET_CURRENT_CONTEXT(ctx
);
5849 FLUSH_VERTICES(ctx
, 0);
5850 ctx
->Exec
->CopyConvolutionFilter1D( target
, internalFormat
, x
, y
, width
);
5853 static void exec_CopyConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
5854 GLint x
, GLint y
, GLsizei width
,
5857 GET_CURRENT_CONTEXT(ctx
);
5858 FLUSH_VERTICES(ctx
, 0);
5859 ctx
->Exec
->CopyConvolutionFilter2D( target
, internalFormat
, x
, y
, width
,
5863 static void exec_GetColorTable( GLenum target
, GLenum format
,
5864 GLenum type
, GLvoid
*data
)
5866 GET_CURRENT_CONTEXT(ctx
);
5867 FLUSH_VERTICES(ctx
, 0);
5868 ctx
->Exec
->GetColorTable( target
, format
, type
, data
);
5871 static void exec_GetColorTableParameterfv( GLenum target
, GLenum pname
,
5874 GET_CURRENT_CONTEXT(ctx
);
5875 FLUSH_VERTICES(ctx
, 0);
5876 ctx
->Exec
->GetColorTableParameterfv( target
, pname
, params
);
5879 static void exec_GetColorTableParameteriv( GLenum target
, GLenum pname
,
5882 GET_CURRENT_CONTEXT(ctx
);
5883 FLUSH_VERTICES(ctx
, 0);
5884 ctx
->Exec
->GetColorTableParameteriv( target
, pname
, params
);
5887 static void exec_GetConvolutionFilter(GLenum target
, GLenum format
, GLenum type
,
5890 GET_CURRENT_CONTEXT(ctx
);
5891 FLUSH_VERTICES(ctx
, 0);
5892 ctx
->Exec
->GetConvolutionFilter( target
, format
, type
, image
);
5895 static void exec_GetConvolutionParameterfv(GLenum target
, GLenum pname
,
5898 GET_CURRENT_CONTEXT(ctx
);
5899 FLUSH_VERTICES(ctx
, 0);
5900 ctx
->Exec
->GetConvolutionParameterfv( target
, pname
, params
);
5903 static void exec_GetConvolutionParameteriv(GLenum target
, GLenum pname
,
5906 GET_CURRENT_CONTEXT(ctx
);
5907 FLUSH_VERTICES(ctx
, 0);
5908 ctx
->Exec
->GetConvolutionParameteriv( target
, pname
, params
);
5911 static void exec_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
,
5912 GLenum type
, GLvoid
*values
)
5914 GET_CURRENT_CONTEXT(ctx
);
5915 FLUSH_VERTICES(ctx
, 0);
5916 ctx
->Exec
->GetHistogram( target
, reset
, format
, type
, values
);
5919 static void exec_GetHistogramParameterfv(GLenum target
, GLenum pname
,
5922 GET_CURRENT_CONTEXT(ctx
);
5923 FLUSH_VERTICES(ctx
, 0);
5924 ctx
->Exec
->GetHistogramParameterfv( target
, pname
, params
);
5927 static void exec_GetHistogramParameteriv(GLenum target
, GLenum pname
,
5930 GET_CURRENT_CONTEXT(ctx
);
5931 FLUSH_VERTICES(ctx
, 0);
5932 ctx
->Exec
->GetHistogramParameteriv( target
, pname
, params
);
5935 static void exec_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
,
5936 GLenum type
, GLvoid
*values
)
5938 GET_CURRENT_CONTEXT(ctx
);
5939 FLUSH_VERTICES(ctx
, 0);
5940 ctx
->Exec
->GetMinmax( target
, reset
, format
, type
, values
);
5943 static void exec_GetMinmaxParameterfv(GLenum target
, GLenum pname
,
5946 GET_CURRENT_CONTEXT(ctx
);
5947 FLUSH_VERTICES(ctx
, 0);
5948 ctx
->Exec
->GetMinmaxParameterfv( target
, pname
, params
);
5951 static void exec_GetMinmaxParameteriv(GLenum target
, GLenum pname
,
5954 GET_CURRENT_CONTEXT(ctx
);
5955 FLUSH_VERTICES(ctx
, 0);
5956 ctx
->Exec
->GetMinmaxParameteriv( target
, pname
, params
);
5959 static void exec_GetSeparableFilter(GLenum target
, GLenum format
, GLenum type
,
5960 GLvoid
*row
, GLvoid
*column
, GLvoid
*span
)
5962 GET_CURRENT_CONTEXT(ctx
);
5963 FLUSH_VERTICES(ctx
, 0);
5964 ctx
->Exec
->GetSeparableFilter( target
, format
, type
, row
, column
, span
);
5967 static void exec_SeparableFilter2D(GLenum target
, GLenum internalFormat
,
5968 GLsizei width
, GLsizei height
, GLenum format
,
5969 GLenum type
, const GLvoid
*row
,
5970 const GLvoid
*column
)
5972 GET_CURRENT_CONTEXT(ctx
);
5973 FLUSH_VERTICES(ctx
, 0);
5974 ctx
->Exec
->SeparableFilter2D( target
, internalFormat
, width
, height
, format
,
5978 static void exec_GetPixelTexGenParameterivSGIS(GLenum target
, GLint
*value
)
5980 GET_CURRENT_CONTEXT(ctx
);
5981 FLUSH_VERTICES(ctx
, 0);
5982 ctx
->Exec
->GetPixelTexGenParameterivSGIS( target
, value
);
5985 static void exec_GetPixelTexGenParameterfvSGIS(GLenum target
, GLfloat
*value
)
5987 GET_CURRENT_CONTEXT(ctx
);
5988 FLUSH_VERTICES(ctx
, 0);
5989 ctx
->Exec
->GetPixelTexGenParameterfvSGIS( target
, value
);
5992 static void exec_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
5993 GLsizei count
, const GLvoid
*ptr
)
5995 GET_CURRENT_CONTEXT(ctx
);
5996 FLUSH_VERTICES(ctx
, 0);
5997 ctx
->Exec
->ColorPointerEXT( size
, type
, stride
, count
, ptr
);
6000 static void exec_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
,
6001 const GLboolean
*ptr
)
6003 GET_CURRENT_CONTEXT(ctx
);
6004 FLUSH_VERTICES(ctx
, 0);
6005 ctx
->Exec
->EdgeFlagPointerEXT( stride
, count
, ptr
);
6008 static void exec_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
6011 GET_CURRENT_CONTEXT(ctx
);
6012 FLUSH_VERTICES(ctx
, 0);
6013 ctx
->Exec
->IndexPointerEXT( type
, stride
, count
, ptr
);
6016 static void exec_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
6019 GET_CURRENT_CONTEXT(ctx
);
6020 FLUSH_VERTICES(ctx
, 0);
6021 ctx
->Exec
->NormalPointerEXT( type
, stride
, count
, ptr
);
6024 static void exec_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
6025 GLsizei count
, const GLvoid
*ptr
)
6027 GET_CURRENT_CONTEXT(ctx
);
6028 FLUSH_VERTICES(ctx
, 0);
6029 ctx
->Exec
->TexCoordPointerEXT( size
, type
, stride
, count
, ptr
);
6032 static void exec_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
6033 GLsizei count
, const GLvoid
*ptr
)
6035 GET_CURRENT_CONTEXT(ctx
);
6036 FLUSH_VERTICES(ctx
, 0);
6037 ctx
->Exec
->VertexPointerEXT( size
, type
, stride
, count
, ptr
);
6040 static void exec_LockArraysEXT(GLint first
, GLsizei count
)
6042 GET_CURRENT_CONTEXT(ctx
);
6043 FLUSH_VERTICES(ctx
, 0);
6044 ctx
->Exec
->LockArraysEXT( first
, count
);
6047 static void exec_UnlockArraysEXT( void )
6049 GET_CURRENT_CONTEXT(ctx
);
6050 FLUSH_VERTICES(ctx
, 0);
6051 ctx
->Exec
->UnlockArraysEXT( );
6054 static void exec_ResizeBuffersMESA( void )
6056 GET_CURRENT_CONTEXT(ctx
);
6057 FLUSH_VERTICES(ctx
, 0);
6058 ctx
->Exec
->ResizeBuffersMESA( );
6062 static void exec_ClientActiveTextureARB( GLenum target
)
6064 GET_CURRENT_CONTEXT(ctx
);
6065 FLUSH_VERTICES(ctx
, 0);
6066 ctx
->Exec
->ClientActiveTextureARB(target
);
6069 static void exec_SecondaryColorPointerEXT(GLint size
, GLenum type
,
6070 GLsizei stride
, const GLvoid
*ptr
)
6072 GET_CURRENT_CONTEXT(ctx
);
6073 FLUSH_VERTICES(ctx
, 0);
6074 ctx
->Exec
->SecondaryColorPointerEXT( size
, type
, stride
, ptr
);
6077 static void exec_FogCoordPointerEXT(GLenum type
, GLsizei stride
,
6080 GET_CURRENT_CONTEXT(ctx
);
6081 FLUSH_VERTICES(ctx
, 0);
6082 ctx
->Exec
->FogCoordPointerEXT( type
, stride
, ptr
);
6085 /* GL_EXT_multi_draw_arrays */
6086 static void exec_MultiDrawArraysEXT(GLenum mode
, GLint
*first
,
6087 GLsizei
*count
, GLsizei primcount
)
6089 GET_CURRENT_CONTEXT(ctx
);
6090 FLUSH_VERTICES(ctx
, 0);
6091 ctx
->Exec
->MultiDrawArraysEXT( mode
, first
, count
, primcount
);
6094 /* GL_EXT_multi_draw_arrays */
6095 static void exec_MultiDrawElementsEXT(GLenum mode
, const GLsizei
*count
,
6096 GLenum type
, const GLvoid
**indices
,
6099 GET_CURRENT_CONTEXT(ctx
);
6100 FLUSH_VERTICES(ctx
, 0);
6101 ctx
->Exec
->MultiDrawElementsEXT(mode
, count
, type
, indices
, primcount
);
6104 /* GL_IBM_multimode_draw_arrays */
6105 static void exec_MultiModeDrawArraysIBM(const GLenum
*mode
, const GLint
*first
,
6106 const GLsizei
*count
, GLsizei primcount
,
6109 GET_CURRENT_CONTEXT(ctx
);
6110 FLUSH_VERTICES(ctx
, 0);
6111 ctx
->Exec
->MultiModeDrawArraysIBM(mode
, first
, count
, primcount
, modestride
);
6114 /* GL_IBM_multimode_draw_arrays */
6115 static void exec_MultiModeDrawElementsIBM(const GLenum
*mode
,
6116 const GLsizei
*count
,
6118 const GLvoid
* const *indices
,
6119 GLsizei primcount
, GLint modestride
)
6121 GET_CURRENT_CONTEXT(ctx
);
6122 FLUSH_VERTICES(ctx
, 0);
6123 ctx
->Exec
->MultiModeDrawElementsIBM(mode
, count
, type
, indices
, primcount
,
6130 * Assign all the pointers in <table> to point to Mesa's display list
6131 * building functions.
6133 * This does not include any of the tnl functions - they are
6134 * initialized from _mesa_init_api_defaults and from the active vtxfmt
6138 _mesa_init_dlist_table( struct _glapi_table
*table
, GLuint tableSize
)
6140 _mesa_init_no_op_table(table
, tableSize
);
6142 _mesa_loopback_init_api_table( table
, GL_TRUE
);
6145 table
->Accum
= save_Accum
;
6146 table
->AlphaFunc
= save_AlphaFunc
;
6147 table
->Bitmap
= save_Bitmap
;
6148 table
->BlendFunc
= save_BlendFunc
;
6149 table
->CallList
= _mesa_save_CallList
;
6150 table
->CallLists
= _mesa_save_CallLists
;
6151 table
->Clear
= save_Clear
;
6152 table
->ClearAccum
= save_ClearAccum
;
6153 table
->ClearColor
= save_ClearColor
;
6154 table
->ClearDepth
= save_ClearDepth
;
6155 table
->ClearIndex
= save_ClearIndex
;
6156 table
->ClearStencil
= save_ClearStencil
;
6157 table
->ClipPlane
= save_ClipPlane
;
6158 table
->ColorMask
= save_ColorMask
;
6159 table
->ColorMaterial
= save_ColorMaterial
;
6160 table
->CopyPixels
= save_CopyPixels
;
6161 table
->CullFace
= save_CullFace
;
6162 table
->DeleteLists
= _mesa_DeleteLists
;
6163 table
->DepthFunc
= save_DepthFunc
;
6164 table
->DepthMask
= save_DepthMask
;
6165 table
->DepthRange
= save_DepthRange
;
6166 table
->Disable
= save_Disable
;
6167 table
->DrawBuffer
= save_DrawBuffer
;
6168 table
->DrawPixels
= save_DrawPixels
;
6169 table
->Enable
= save_Enable
;
6170 table
->EndList
= _mesa_EndList
;
6171 table
->EvalMesh1
= _mesa_save_EvalMesh1
;
6172 table
->EvalMesh2
= _mesa_save_EvalMesh2
;
6173 table
->Finish
= exec_Finish
;
6174 table
->Flush
= exec_Flush
;
6175 table
->Fogf
= save_Fogf
;
6176 table
->Fogfv
= save_Fogfv
;
6177 table
->Fogi
= save_Fogi
;
6178 table
->Fogiv
= save_Fogiv
;
6179 table
->FrontFace
= save_FrontFace
;
6180 table
->Frustum
= save_Frustum
;
6181 table
->GenLists
= _mesa_GenLists
;
6182 table
->GetBooleanv
= exec_GetBooleanv
;
6183 table
->GetClipPlane
= exec_GetClipPlane
;
6184 table
->GetDoublev
= exec_GetDoublev
;
6185 table
->GetError
= exec_GetError
;
6186 table
->GetFloatv
= exec_GetFloatv
;
6187 table
->GetIntegerv
= exec_GetIntegerv
;
6188 table
->GetLightfv
= exec_GetLightfv
;
6189 table
->GetLightiv
= exec_GetLightiv
;
6190 table
->GetMapdv
= exec_GetMapdv
;
6191 table
->GetMapfv
= exec_GetMapfv
;
6192 table
->GetMapiv
= exec_GetMapiv
;
6193 table
->GetMaterialfv
= exec_GetMaterialfv
;
6194 table
->GetMaterialiv
= exec_GetMaterialiv
;
6195 table
->GetPixelMapfv
= exec_GetPixelMapfv
;
6196 table
->GetPixelMapuiv
= exec_GetPixelMapuiv
;
6197 table
->GetPixelMapusv
= exec_GetPixelMapusv
;
6198 table
->GetPolygonStipple
= exec_GetPolygonStipple
;
6199 table
->GetString
= exec_GetString
;
6200 table
->GetTexEnvfv
= exec_GetTexEnvfv
;
6201 table
->GetTexEnviv
= exec_GetTexEnviv
;
6202 table
->GetTexGendv
= exec_GetTexGendv
;
6203 table
->GetTexGenfv
= exec_GetTexGenfv
;
6204 table
->GetTexGeniv
= exec_GetTexGeniv
;
6205 table
->GetTexImage
= exec_GetTexImage
;
6206 table
->GetTexLevelParameterfv
= exec_GetTexLevelParameterfv
;
6207 table
->GetTexLevelParameteriv
= exec_GetTexLevelParameteriv
;
6208 table
->GetTexParameterfv
= exec_GetTexParameterfv
;
6209 table
->GetTexParameteriv
= exec_GetTexParameteriv
;
6210 table
->Hint
= save_Hint
;
6211 table
->IndexMask
= save_IndexMask
;
6212 table
->InitNames
= save_InitNames
;
6213 table
->IsEnabled
= exec_IsEnabled
;
6214 table
->IsList
= _mesa_IsList
;
6215 table
->LightModelf
= save_LightModelf
;
6216 table
->LightModelfv
= save_LightModelfv
;
6217 table
->LightModeli
= save_LightModeli
;
6218 table
->LightModeliv
= save_LightModeliv
;
6219 table
->Lightf
= save_Lightf
;
6220 table
->Lightfv
= save_Lightfv
;
6221 table
->Lighti
= save_Lighti
;
6222 table
->Lightiv
= save_Lightiv
;
6223 table
->LineStipple
= save_LineStipple
;
6224 table
->LineWidth
= save_LineWidth
;
6225 table
->ListBase
= save_ListBase
;
6226 table
->LoadIdentity
= save_LoadIdentity
;
6227 table
->LoadMatrixd
= save_LoadMatrixd
;
6228 table
->LoadMatrixf
= save_LoadMatrixf
;
6229 table
->LoadName
= save_LoadName
;
6230 table
->LogicOp
= save_LogicOp
;
6231 table
->Map1d
= save_Map1d
;
6232 table
->Map1f
= save_Map1f
;
6233 table
->Map2d
= save_Map2d
;
6234 table
->Map2f
= save_Map2f
;
6235 table
->MapGrid1d
= save_MapGrid1d
;
6236 table
->MapGrid1f
= save_MapGrid1f
;
6237 table
->MapGrid2d
= save_MapGrid2d
;
6238 table
->MapGrid2f
= save_MapGrid2f
;
6239 table
->MatrixMode
= save_MatrixMode
;
6240 table
->MultMatrixd
= save_MultMatrixd
;
6241 table
->MultMatrixf
= save_MultMatrixf
;
6242 table
->NewList
= save_NewList
;
6243 table
->Ortho
= save_Ortho
;
6244 table
->PassThrough
= save_PassThrough
;
6245 table
->PixelMapfv
= save_PixelMapfv
;
6246 table
->PixelMapuiv
= save_PixelMapuiv
;
6247 table
->PixelMapusv
= save_PixelMapusv
;
6248 table
->PixelStoref
= exec_PixelStoref
;
6249 table
->PixelStorei
= exec_PixelStorei
;
6250 table
->PixelTransferf
= save_PixelTransferf
;
6251 table
->PixelTransferi
= save_PixelTransferi
;
6252 table
->PixelZoom
= save_PixelZoom
;
6253 table
->PointSize
= save_PointSize
;
6254 table
->PolygonMode
= save_PolygonMode
;
6255 table
->PolygonOffset
= save_PolygonOffset
;
6256 table
->PolygonStipple
= save_PolygonStipple
;
6257 table
->PopAttrib
= save_PopAttrib
;
6258 table
->PopMatrix
= save_PopMatrix
;
6259 table
->PopName
= save_PopName
;
6260 table
->PushAttrib
= save_PushAttrib
;
6261 table
->PushMatrix
= save_PushMatrix
;
6262 table
->PushName
= save_PushName
;
6263 table
->RasterPos2d
= save_RasterPos2d
;
6264 table
->RasterPos2dv
= save_RasterPos2dv
;
6265 table
->RasterPos2f
= save_RasterPos2f
;
6266 table
->RasterPos2fv
= save_RasterPos2fv
;
6267 table
->RasterPos2i
= save_RasterPos2i
;
6268 table
->RasterPos2iv
= save_RasterPos2iv
;
6269 table
->RasterPos2s
= save_RasterPos2s
;
6270 table
->RasterPos2sv
= save_RasterPos2sv
;
6271 table
->RasterPos3d
= save_RasterPos3d
;
6272 table
->RasterPos3dv
= save_RasterPos3dv
;
6273 table
->RasterPos3f
= save_RasterPos3f
;
6274 table
->RasterPos3fv
= save_RasterPos3fv
;
6275 table
->RasterPos3i
= save_RasterPos3i
;
6276 table
->RasterPos3iv
= save_RasterPos3iv
;
6277 table
->RasterPos3s
= save_RasterPos3s
;
6278 table
->RasterPos3sv
= save_RasterPos3sv
;
6279 table
->RasterPos4d
= save_RasterPos4d
;
6280 table
->RasterPos4dv
= save_RasterPos4dv
;
6281 table
->RasterPos4f
= save_RasterPos4f
;
6282 table
->RasterPos4fv
= save_RasterPos4fv
;
6283 table
->RasterPos4i
= save_RasterPos4i
;
6284 table
->RasterPos4iv
= save_RasterPos4iv
;
6285 table
->RasterPos4s
= save_RasterPos4s
;
6286 table
->RasterPos4sv
= save_RasterPos4sv
;
6287 table
->ReadBuffer
= save_ReadBuffer
;
6288 table
->ReadPixels
= exec_ReadPixels
;
6289 table
->RenderMode
= exec_RenderMode
;
6290 table
->Rotated
= save_Rotated
;
6291 table
->Rotatef
= save_Rotatef
;
6292 table
->Scaled
= save_Scaled
;
6293 table
->Scalef
= save_Scalef
;
6294 table
->Scissor
= save_Scissor
;
6295 table
->FeedbackBuffer
= exec_FeedbackBuffer
;
6296 table
->SelectBuffer
= exec_SelectBuffer
;
6297 table
->ShadeModel
= save_ShadeModel
;
6298 table
->StencilFunc
= save_StencilFunc
;
6299 table
->StencilMask
= save_StencilMask
;
6300 table
->StencilOp
= save_StencilOp
;
6301 table
->TexEnvf
= save_TexEnvf
;
6302 table
->TexEnvfv
= save_TexEnvfv
;
6303 table
->TexEnvi
= save_TexEnvi
;
6304 table
->TexEnviv
= save_TexEnviv
;
6305 table
->TexGend
= save_TexGend
;
6306 table
->TexGendv
= save_TexGendv
;
6307 table
->TexGenf
= save_TexGenf
;
6308 table
->TexGenfv
= save_TexGenfv
;
6309 table
->TexGeni
= save_TexGeni
;
6310 table
->TexGeniv
= save_TexGeniv
;
6311 table
->TexImage1D
= save_TexImage1D
;
6312 table
->TexImage2D
= save_TexImage2D
;
6313 table
->TexParameterf
= save_TexParameterf
;
6314 table
->TexParameterfv
= save_TexParameterfv
;
6315 table
->TexParameteri
= save_TexParameteri
;
6316 table
->TexParameteriv
= save_TexParameteriv
;
6317 table
->Translated
= save_Translated
;
6318 table
->Translatef
= save_Translatef
;
6319 table
->Viewport
= save_Viewport
;
6322 table
->AreTexturesResident
= exec_AreTexturesResident
;
6323 table
->AreTexturesResidentEXT
= exec_AreTexturesResident
;
6324 table
->BindTexture
= save_BindTexture
;
6325 table
->ColorPointer
= exec_ColorPointer
;
6326 table
->CopyTexImage1D
= save_CopyTexImage1D
;
6327 table
->CopyTexImage2D
= save_CopyTexImage2D
;
6328 table
->CopyTexSubImage1D
= save_CopyTexSubImage1D
;
6329 table
->CopyTexSubImage2D
= save_CopyTexSubImage2D
;
6330 table
->DeleteTextures
= exec_DeleteTextures
;
6331 table
->DisableClientState
= exec_DisableClientState
;
6332 table
->EdgeFlagPointer
= exec_EdgeFlagPointer
;
6333 table
->EnableClientState
= exec_EnableClientState
;
6334 table
->GenTextures
= exec_GenTextures
;
6335 table
->GenTexturesEXT
= exec_GenTextures
;
6336 table
->GetPointerv
= exec_GetPointerv
;
6337 table
->IndexPointer
= exec_IndexPointer
;
6338 table
->InterleavedArrays
= exec_InterleavedArrays
;
6339 table
->IsTexture
= exec_IsTexture
;
6340 table
->IsTextureEXT
= exec_IsTexture
;
6341 table
->NormalPointer
= exec_NormalPointer
;
6342 table
->PopClientAttrib
= exec_PopClientAttrib
;
6343 table
->PrioritizeTextures
= save_PrioritizeTextures
;
6344 table
->PushClientAttrib
= exec_PushClientAttrib
;
6345 table
->TexCoordPointer
= exec_TexCoordPointer
;
6346 table
->TexSubImage1D
= save_TexSubImage1D
;
6347 table
->TexSubImage2D
= save_TexSubImage2D
;
6348 table
->VertexPointer
= exec_VertexPointer
;
6351 table
->CopyTexSubImage3D
= save_CopyTexSubImage3D
;
6352 table
->TexImage3D
= save_TexImage3D
;
6353 table
->TexSubImage3D
= save_TexSubImage3D
;
6355 /* GL_ARB_imaging */
6356 /* Not all are supported */
6357 table
->BlendColor
= save_BlendColor
;
6358 table
->BlendEquation
= save_BlendEquation
;
6359 table
->ColorSubTable
= save_ColorSubTable
;
6360 table
->ColorTable
= save_ColorTable
;
6361 table
->ColorTableParameterfv
= save_ColorTableParameterfv
;
6362 table
->ColorTableParameteriv
= save_ColorTableParameteriv
;
6363 table
->ConvolutionFilter1D
= save_ConvolutionFilter1D
;
6364 table
->ConvolutionFilter2D
= save_ConvolutionFilter2D
;
6365 table
->ConvolutionParameterf
= save_ConvolutionParameterf
;
6366 table
->ConvolutionParameterfv
= save_ConvolutionParameterfv
;
6367 table
->ConvolutionParameteri
= save_ConvolutionParameteri
;
6368 table
->ConvolutionParameteriv
= save_ConvolutionParameteriv
;
6369 table
->CopyColorSubTable
= save_CopyColorSubTable
;
6370 table
->CopyColorTable
= save_CopyColorTable
;
6371 table
->CopyConvolutionFilter1D
= exec_CopyConvolutionFilter1D
;
6372 table
->CopyConvolutionFilter2D
= exec_CopyConvolutionFilter2D
;
6373 table
->GetColorTable
= exec_GetColorTable
;
6374 table
->GetColorTableEXT
= exec_GetColorTable
;
6375 table
->GetColorTableParameterfv
= exec_GetColorTableParameterfv
;
6376 table
->GetColorTableParameterfvEXT
= exec_GetColorTableParameterfv
;
6377 table
->GetColorTableParameteriv
= exec_GetColorTableParameteriv
;
6378 table
->GetColorTableParameterivEXT
= exec_GetColorTableParameteriv
;
6379 table
->GetConvolutionFilter
= exec_GetConvolutionFilter
;
6380 table
->GetConvolutionFilterEXT
= exec_GetConvolutionFilter
;
6381 table
->GetConvolutionParameterfv
= exec_GetConvolutionParameterfv
;
6382 table
->GetConvolutionParameterfvEXT
= exec_GetConvolutionParameterfv
;
6383 table
->GetConvolutionParameteriv
= exec_GetConvolutionParameteriv
;
6384 table
->GetConvolutionParameterivEXT
= exec_GetConvolutionParameteriv
;
6385 table
->GetHistogram
= exec_GetHistogram
;
6386 table
->GetHistogramEXT
= exec_GetHistogram
;
6387 table
->GetHistogramParameterfv
= exec_GetHistogramParameterfv
;
6388 table
->GetHistogramParameterfvEXT
= exec_GetHistogramParameterfv
;
6389 table
->GetHistogramParameteriv
= exec_GetHistogramParameteriv
;
6390 table
->GetHistogramParameterivEXT
= exec_GetHistogramParameteriv
;
6391 table
->GetMinmax
= exec_GetMinmax
;
6392 table
->GetMinmaxEXT
= exec_GetMinmax
;
6393 table
->GetMinmaxParameterfv
= exec_GetMinmaxParameterfv
;
6394 table
->GetMinmaxParameterfvEXT
= exec_GetMinmaxParameterfv
;
6395 table
->GetMinmaxParameteriv
= exec_GetMinmaxParameteriv
;
6396 table
->GetMinmaxParameterivEXT
= exec_GetMinmaxParameteriv
;
6397 table
->GetSeparableFilter
= exec_GetSeparableFilter
;
6398 table
->GetSeparableFilterEXT
= exec_GetSeparableFilter
;
6399 table
->Histogram
= save_Histogram
;
6400 table
->Minmax
= save_Minmax
;
6401 table
->ResetHistogram
= save_ResetHistogram
;
6402 table
->ResetMinmax
= save_ResetMinmax
;
6403 table
->SeparableFilter2D
= exec_SeparableFilter2D
;
6405 /* 2. GL_EXT_blend_color */
6407 table
->BlendColorEXT
= save_BlendColorEXT
;
6410 /* 3. GL_EXT_polygon_offset */
6411 table
->PolygonOffsetEXT
= save_PolygonOffsetEXT
;
6413 /* 6. GL_EXT_texture3d */
6415 table
->CopyTexSubImage3DEXT
= save_CopyTexSubImage3D
;
6416 table
->TexImage3DEXT
= save_TexImage3DEXT
;
6417 table
->TexSubImage3DEXT
= save_TexSubImage3D
;
6420 /* 15. GL_SGIX_pixel_texture */
6421 table
->PixelTexGenSGIX
= save_PixelTexGenSGIX
;
6423 /* 15. GL_SGIS_pixel_texture */
6424 table
->PixelTexGenParameteriSGIS
= save_PixelTexGenParameteriSGIS
;
6425 table
->PixelTexGenParameterfSGIS
= save_PixelTexGenParameterfSGIS
;
6426 table
->PixelTexGenParameterivSGIS
= save_PixelTexGenParameterivSGIS
;
6427 table
->PixelTexGenParameterfvSGIS
= save_PixelTexGenParameterfvSGIS
;
6428 table
->GetPixelTexGenParameterivSGIS
= exec_GetPixelTexGenParameterivSGIS
;
6429 table
->GetPixelTexGenParameterfvSGIS
= exec_GetPixelTexGenParameterfvSGIS
;
6431 /* 30. GL_EXT_vertex_array */
6432 table
->ColorPointerEXT
= exec_ColorPointerEXT
;
6433 table
->EdgeFlagPointerEXT
= exec_EdgeFlagPointerEXT
;
6434 table
->IndexPointerEXT
= exec_IndexPointerEXT
;
6435 table
->NormalPointerEXT
= exec_NormalPointerEXT
;
6436 table
->TexCoordPointerEXT
= exec_TexCoordPointerEXT
;
6437 table
->VertexPointerEXT
= exec_VertexPointerEXT
;
6439 /* 37. GL_EXT_blend_minmax */
6441 table
->BlendEquationEXT
= save_BlendEquationEXT
;
6444 /* 54. GL_EXT_point_parameters */
6445 table
->PointParameterfEXT
= save_PointParameterfEXT
;
6446 table
->PointParameterfvEXT
= save_PointParameterfvEXT
;
6448 /* 78. GL_EXT_paletted_texture */
6450 table
->ColorTableEXT
= save_ColorTable
;
6451 table
->ColorSubTableEXT
= save_ColorSubTable
;
6453 table
->GetColorTableEXT
= exec_GetColorTable
;
6454 table
->GetColorTableParameterfvEXT
= exec_GetColorTableParameterfv
;
6455 table
->GetColorTableParameterivEXT
= exec_GetColorTableParameteriv
;
6457 /* 97. GL_EXT_compiled_vertex_array */
6458 table
->LockArraysEXT
= exec_LockArraysEXT
;
6459 table
->UnlockArraysEXT
= exec_UnlockArraysEXT
;
6461 /* 145. GL_EXT_secondary_color */
6462 table
->SecondaryColorPointerEXT
= exec_SecondaryColorPointerEXT
;
6464 /* 148. GL_EXT_multi_draw_arrays */
6465 table
->MultiDrawArraysEXT
= exec_MultiDrawArraysEXT
;
6466 table
->MultiDrawElementsEXT
= exec_MultiDrawElementsEXT
;
6468 /* 149. GL_EXT_fog_coord */
6469 table
->FogCoordPointerEXT
= exec_FogCoordPointerEXT
;
6471 /* 173. GL_EXT_blend_func_separate */
6472 table
->BlendFuncSeparateEXT
= save_BlendFuncSeparateEXT
;
6474 /* 196. GL_MESA_resize_buffers */
6475 table
->ResizeBuffersMESA
= exec_ResizeBuffersMESA
;
6477 /* 197. GL_MESA_window_pos */
6478 table
->WindowPos2dMESA
= save_WindowPos2dMESA
;
6479 table
->WindowPos2dvMESA
= save_WindowPos2dvMESA
;
6480 table
->WindowPos2fMESA
= save_WindowPos2fMESA
;
6481 table
->WindowPos2fvMESA
= save_WindowPos2fvMESA
;
6482 table
->WindowPos2iMESA
= save_WindowPos2iMESA
;
6483 table
->WindowPos2ivMESA
= save_WindowPos2ivMESA
;
6484 table
->WindowPos2sMESA
= save_WindowPos2sMESA
;
6485 table
->WindowPos2svMESA
= save_WindowPos2svMESA
;
6486 table
->WindowPos3dMESA
= save_WindowPos3dMESA
;
6487 table
->WindowPos3dvMESA
= save_WindowPos3dvMESA
;
6488 table
->WindowPos3fMESA
= save_WindowPos3fMESA
;
6489 table
->WindowPos3fvMESA
= save_WindowPos3fvMESA
;
6490 table
->WindowPos3iMESA
= save_WindowPos3iMESA
;
6491 table
->WindowPos3ivMESA
= save_WindowPos3ivMESA
;
6492 table
->WindowPos3sMESA
= save_WindowPos3sMESA
;
6493 table
->WindowPos3svMESA
= save_WindowPos3svMESA
;
6494 table
->WindowPos4dMESA
= save_WindowPos4dMESA
;
6495 table
->WindowPos4dvMESA
= save_WindowPos4dvMESA
;
6496 table
->WindowPos4fMESA
= save_WindowPos4fMESA
;
6497 table
->WindowPos4fvMESA
= save_WindowPos4fvMESA
;
6498 table
->WindowPos4iMESA
= save_WindowPos4iMESA
;
6499 table
->WindowPos4ivMESA
= save_WindowPos4ivMESA
;
6500 table
->WindowPos4sMESA
= save_WindowPos4sMESA
;
6501 table
->WindowPos4svMESA
= save_WindowPos4svMESA
;
6503 /* 200. GL_IBM_multimode_draw_arrays */
6504 table
->MultiModeDrawArraysIBM
= exec_MultiModeDrawArraysIBM
;
6505 table
->MultiModeDrawElementsIBM
= exec_MultiModeDrawElementsIBM
;
6507 #if FEATURE_NV_vertex_program
6508 /* 233. GL_NV_vertex_program */
6509 /* The following commands DO NOT go into display lists:
6510 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
6511 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
6513 table
->BindProgramNV
= save_BindProgramNV
;
6514 table
->DeleteProgramsNV
= _mesa_DeletePrograms
;
6515 table
->ExecuteProgramNV
= save_ExecuteProgramNV
;
6516 table
->GenProgramsNV
= _mesa_GenPrograms
;
6517 table
->AreProgramsResidentNV
= _mesa_AreProgramsResidentNV
;
6518 table
->RequestResidentProgramsNV
= save_RequestResidentProgramsNV
;
6519 table
->GetProgramParameterfvNV
= _mesa_GetProgramParameterfvNV
;
6520 table
->GetProgramParameterdvNV
= _mesa_GetProgramParameterdvNV
;
6521 table
->GetProgramivNV
= _mesa_GetProgramivNV
;
6522 table
->GetProgramStringNV
= _mesa_GetProgramStringNV
;
6523 table
->GetTrackMatrixivNV
= _mesa_GetTrackMatrixivNV
;
6524 table
->GetVertexAttribdvNV
= _mesa_GetVertexAttribdvNV
;
6525 table
->GetVertexAttribfvNV
= _mesa_GetVertexAttribfvNV
;
6526 table
->GetVertexAttribivNV
= _mesa_GetVertexAttribivNV
;
6527 table
->GetVertexAttribPointervNV
= _mesa_GetVertexAttribPointervNV
;
6528 table
->IsProgramNV
= _mesa_IsProgram
;
6529 table
->LoadProgramNV
= save_LoadProgramNV
;
6530 table
->ProgramParameter4dNV
= save_ProgramParameter4dNV
;
6531 table
->ProgramParameter4dvNV
= save_ProgramParameter4dvNV
;
6532 table
->ProgramParameter4fNV
= save_ProgramParameter4fNV
;
6533 table
->ProgramParameter4fvNV
= save_ProgramParameter4fvNV
;
6534 table
->ProgramParameters4dvNV
= save_ProgramParameters4dvNV
;
6535 table
->ProgramParameters4fvNV
= save_ProgramParameters4fvNV
;
6536 table
->TrackMatrixNV
= save_TrackMatrixNV
;
6537 table
->VertexAttribPointerNV
= _mesa_VertexAttribPointerNV
;
6540 /* 282. GL_NV_fragment_program */
6541 #if FEATURE_NV_fragment_program
6542 table
->ProgramNamedParameter4fNV
= save_ProgramNamedParameter4fNV
;
6543 table
->ProgramNamedParameter4dNV
= save_ProgramNamedParameter4dNV
;
6544 table
->ProgramNamedParameter4fvNV
= save_ProgramNamedParameter4fvNV
;
6545 table
->ProgramNamedParameter4dvNV
= save_ProgramNamedParameter4dvNV
;
6546 table
->GetProgramNamedParameterfvNV
= _mesa_GetProgramNamedParameterfvNV
;
6547 table
->GetProgramNamedParameterdvNV
= _mesa_GetProgramNamedParameterdvNV
;
6548 table
->ProgramLocalParameter4dARB
= save_ProgramLocalParameter4dARB
;
6549 table
->ProgramLocalParameter4dvARB
= save_ProgramLocalParameter4dvARB
;
6550 table
->ProgramLocalParameter4fARB
= save_ProgramLocalParameter4fARB
;
6551 table
->ProgramLocalParameter4fvARB
= save_ProgramLocalParameter4fvARB
;
6552 table
->GetProgramLocalParameterdvARB
= _mesa_GetProgramLocalParameterdvARB
;
6553 table
->GetProgramLocalParameterfvARB
= _mesa_GetProgramLocalParameterfvARB
;
6556 /* 262. GL_NV_point_sprite */
6557 table
->PointParameteriNV
= save_PointParameteriNV
;
6558 table
->PointParameterivNV
= save_PointParameterivNV
;
6560 /* 268. GL_EXT_stencil_two_side */
6561 table
->ActiveStencilFaceEXT
= save_ActiveStencilFaceEXT
;
6563 /* ???. GL_EXT_depth_bounds_test */
6564 table
->DepthBoundsEXT
= save_DepthBoundsEXT
;
6566 /* ARB 1. GL_ARB_multitexture */
6567 table
->ActiveTextureARB
= save_ActiveTextureARB
;
6568 table
->ClientActiveTextureARB
= exec_ClientActiveTextureARB
;
6570 /* ARB 3. GL_ARB_transpose_matrix */
6571 table
->LoadTransposeMatrixdARB
= save_LoadTransposeMatrixdARB
;
6572 table
->LoadTransposeMatrixfARB
= save_LoadTransposeMatrixfARB
;
6573 table
->MultTransposeMatrixdARB
= save_MultTransposeMatrixdARB
;
6574 table
->MultTransposeMatrixfARB
= save_MultTransposeMatrixfARB
;
6576 /* ARB 5. GL_ARB_multisample */
6577 table
->SampleCoverageARB
= save_SampleCoverageARB
;
6579 /* ARB 12. GL_ARB_texture_compression */
6580 table
->CompressedTexImage3DARB
= save_CompressedTexImage3DARB
;
6581 table
->CompressedTexImage2DARB
= save_CompressedTexImage2DARB
;
6582 table
->CompressedTexImage1DARB
= save_CompressedTexImage1DARB
;
6583 table
->CompressedTexSubImage3DARB
= save_CompressedTexSubImage3DARB
;
6584 table
->CompressedTexSubImage2DARB
= save_CompressedTexSubImage2DARB
;
6585 table
->CompressedTexSubImage1DARB
= save_CompressedTexSubImage1DARB
;
6586 table
->GetCompressedTexImageARB
= exec_GetCompressedTexImageARB
;
6588 /* ARB 14. GL_ARB_point_parameters */
6589 /* aliased with EXT_point_parameters functions */
6591 /* ARB 25. GL_ARB_window_pos */
6592 /* aliased with MESA_window_pos functions */
6594 /* ARB 26. GL_ARB_vertex_program */
6596 /* ARB 27. GL_ARB_vertex_program */
6598 /* ARB 28. GL_ARB_vertex_buffer_object */
6607 static const char *enum_string( GLenum k
)
6609 return _mesa_lookup_enum_by_nr( k
);
6614 * Print the commands in a display list. For debugging only.
6615 * TODO: many commands aren't handled yet.
6617 static void print_list( GLcontext
*ctx
, GLuint list
)
6622 if (!glIsList(list
)) {
6623 _mesa_printf("%u is not a display list ID\n", list
);
6627 n
= (Node
*) _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
6629 _mesa_printf("START-LIST %u, address %p\n", list
, (void*)n
);
6631 done
= n
? GL_FALSE
: GL_TRUE
;
6633 OpCode opcode
= n
[0].opcode
;
6634 GLint i
= (GLint
) n
[0].opcode
- (GLint
) OPCODE_DRV_0
;
6636 if (i
>= 0 && i
< (GLint
) ctx
->listext
.nr_opcodes
) {
6637 ctx
->listext
.opcode
[i
].print(ctx
, &n
[1]);
6638 n
+= ctx
->listext
.opcode
[i
].size
;
6643 _mesa_printf("accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
6646 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
6647 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
6649 case OPCODE_CALL_LIST
:
6650 _mesa_printf("CallList %d\n", (int) n
[1].ui
);
6652 case OPCODE_CALL_LIST_OFFSET
:
6653 _mesa_printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
6654 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
6656 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
6657 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
6658 enum_string(n
[1].e
), enum_string(n
[2].e
),
6659 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6661 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
6662 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
6663 enum_string(n
[1].e
), enum_string(n
[2].e
),
6664 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
6666 case OPCODE_DISABLE
:
6667 _mesa_printf("Disable %s\n", enum_string(n
[1].e
));
6670 _mesa_printf("Enable %s\n", enum_string(n
[1].e
));
6672 case OPCODE_FRUSTUM
:
6673 _mesa_printf("Frustum %g %g %g %g %g %g\n",
6674 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6676 case OPCODE_LINE_STIPPLE
:
6677 _mesa_printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
6679 case OPCODE_LOAD_IDENTITY
:
6680 _mesa_printf("LoadIdentity\n");
6682 case OPCODE_LOAD_MATRIX
:
6683 _mesa_printf("LoadMatrix\n");
6684 _mesa_printf(" %8f %8f %8f %8f\n",
6685 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
6686 _mesa_printf(" %8f %8f %8f %8f\n",
6687 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
6688 _mesa_printf(" %8f %8f %8f %8f\n",
6689 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
6690 _mesa_printf(" %8f %8f %8f %8f\n",
6691 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
6693 case OPCODE_MULT_MATRIX
:
6694 _mesa_printf("MultMatrix (or Rotate)\n");
6695 _mesa_printf(" %8f %8f %8f %8f\n",
6696 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
6697 _mesa_printf(" %8f %8f %8f %8f\n",
6698 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
6699 _mesa_printf(" %8f %8f %8f %8f\n",
6700 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
6701 _mesa_printf(" %8f %8f %8f %8f\n",
6702 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
6705 _mesa_printf("Ortho %g %g %g %g %g %g\n",
6706 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
6708 case OPCODE_POP_ATTRIB
:
6709 _mesa_printf("PopAttrib\n");
6711 case OPCODE_POP_MATRIX
:
6712 _mesa_printf("PopMatrix\n");
6714 case OPCODE_POP_NAME
:
6715 _mesa_printf("PopName\n");
6717 case OPCODE_PUSH_ATTRIB
:
6718 _mesa_printf("PushAttrib %x\n", n
[1].bf
);
6720 case OPCODE_PUSH_MATRIX
:
6721 _mesa_printf("PushMatrix\n");
6723 case OPCODE_PUSH_NAME
:
6724 _mesa_printf("PushName %d\n", (int) n
[1].ui
);
6726 case OPCODE_RASTER_POS
:
6727 _mesa_printf("RasterPos %g %g %g %g\n",
6728 n
[1].f
, n
[2].f
,n
[3].f
,n
[4].f
);
6731 _mesa_printf("Rotate %g %g %g %g\n",
6732 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
6735 _mesa_printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
6737 case OPCODE_TRANSLATE
:
6738 _mesa_printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
6740 case OPCODE_BIND_TEXTURE
:
6741 _mesa_printf("BindTexture %s %d\n",
6742 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
6744 case OPCODE_SHADE_MODEL
:
6745 _mesa_printf("ShadeModel %s\n",
6746 _mesa_lookup_enum_by_nr(n
[1].ui
));
6749 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
6750 _mesa_lookup_enum_by_nr(n
[1].ui
),
6751 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
6754 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
6755 _mesa_lookup_enum_by_nr(n
[1].ui
),
6756 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
6757 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
6759 case OPCODE_MAPGRID1
:
6760 _mesa_printf("MapGrid1 %d %.3f %.3f\n",
6761 n
[1].i
, n
[2].f
, n
[3].f
);
6763 case OPCODE_MAPGRID2
:
6764 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
6765 n
[1].i
, n
[2].f
, n
[3].f
,
6766 n
[4].i
, n
[5].f
, n
[6].f
);
6768 case OPCODE_EVALMESH1
:
6769 _mesa_printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
6771 case OPCODE_EVALMESH2
:
6772 _mesa_printf("EvalMesh2 %d %d %d %d\n",
6773 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
6777 * meta opcodes/commands
6780 _mesa_printf("Error: %s %s\n",
6781 enum_string(n
[1].e
), (const char *)n
[2].data
);
6783 case OPCODE_CONTINUE
:
6784 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
6785 n
= (Node
*) n
[1].next
;
6787 case OPCODE_END_OF_LIST
:
6788 _mesa_printf("END-LIST %u\n", list
);
6792 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
6793 _mesa_printf("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
6798 _mesa_printf("command %d, %u operands\n", opcode
, InstSize
[opcode
]);
6801 /* increment n to point to next compiled command */
6802 if (opcode
!=OPCODE_CONTINUE
) {
6803 n
+= InstSize
[opcode
];
6812 * Clients may call this function to help debug display list problems.
6813 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
6814 * changed, or break in the future without notice.
6816 void mesa_print_display_list( GLuint list
)
6818 GET_CURRENT_CONTEXT(ctx
);
6819 print_list( ctx
, list
);
6823 /**********************************************************************/
6824 /***** Initialization *****/
6825 /**********************************************************************/
6827 void _mesa_init_display_list( GLcontext
* ctx
)
6831 ctx
->ExecuteFlag
= GL_TRUE
;
6832 ctx
->CompileFlag
= GL_FALSE
;
6833 ctx
->CurrentListPtr
= NULL
;
6834 ctx
->CurrentBlock
= NULL
;
6835 ctx
->CurrentListNum
= 0;
6836 ctx
->CurrentPos
= 0;
6838 /* Display List group */
6839 ctx
->List
.ListBase
= 0;