2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
29 * Display lists management functions.
35 #include "api_arrayelt.h"
37 #include "api_loopback.h"
38 #include "draw_validate.h"
39 #include "atifragshader.h"
41 #include "bufferobj.h"
48 #include "framebuffer.h"
49 #include "glapi/glapi.h"
50 #include "glformats.h"
58 #include "samplerobj.h"
59 #include "shaderapi.h"
62 #include "texstorage.h"
65 #include "arbprogram.h"
66 #include "transformfeedback.h"
68 #include "math/m_matrix.h"
70 #include "main/dispatch.h"
75 #define USE_BITMAP_ATLAS 1
80 * Other parts of Mesa (such as the VBO module) can plug into the display
81 * list system. This structure describes new display list instructions.
83 struct gl_list_instruction
86 void (*Execute
)( struct gl_context
*ctx
, void *data
);
87 void (*Destroy
)( struct gl_context
*ctx
, void *data
);
88 void (*Print
)( struct gl_context
*ctx
, void *data
, FILE *f
);
92 #define MAX_DLIST_EXT_OPCODES 16
95 * Used by device drivers to hook new commands into display lists.
97 struct gl_list_extensions
99 struct gl_list_instruction Opcode
[MAX_DLIST_EXT_OPCODES
];
108 * \param ctx GL context.
110 * Checks if dd_function_table::SaveNeedFlush is marked to flush
111 * stored (save) vertices, and calls vbo_save_SaveFlushVertices if so.
113 #define SAVE_FLUSH_VERTICES(ctx) \
115 if (ctx->Driver.SaveNeedFlush) \
116 vbo_save_SaveFlushVertices(ctx); \
121 * Macro to assert that the API call was made outside the
122 * glBegin()/glEnd() pair, with return value.
124 * \param ctx GL context.
125 * \param retval value to return value in case the assertion fails.
127 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
129 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
130 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
136 * Macro to assert that the API call was made outside the
137 * glBegin()/glEnd() pair.
139 * \param ctx GL context.
141 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
143 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
144 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
150 * Macro to assert that the API call was made outside the
151 * glBegin()/glEnd() pair and flush the vertices.
153 * \param ctx GL context.
155 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
157 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
158 SAVE_FLUSH_VERTICES(ctx); \
162 * Macro to assert that the API call was made outside the
163 * glBegin()/glEnd() pair and flush the vertices, with return value.
165 * \param ctx GL context.
166 * \param retval value to return value in case the assertion fails.
168 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
170 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
171 SAVE_FLUSH_VERTICES(ctx); \
176 * Display list opcodes.
178 * The fact that these identifiers are assigned consecutive
179 * integer values starting at 0 is very important, see InstSize array usage)
183 OPCODE_INVALID
= -1, /* Force signed enum */
189 OPCODE_BLEND_EQUATION
,
190 OPCODE_BLEND_EQUATION_SEPARATE
,
191 OPCODE_BLEND_FUNC_SEPARATE
,
193 OPCODE_BLEND_EQUATION_I
,
194 OPCODE_BLEND_EQUATION_SEPARATE_I
,
196 OPCODE_BLEND_FUNC_SEPARATE_I
,
205 OPCODE_CLEAR_STENCIL
,
206 OPCODE_CLEAR_BUFFER_IV
,
207 OPCODE_CLEAR_BUFFER_UIV
,
208 OPCODE_CLEAR_BUFFER_FV
,
209 OPCODE_CLEAR_BUFFER_FI
,
212 OPCODE_COLOR_MASK_INDEXED
,
213 OPCODE_COLOR_MATERIAL
,
215 OPCODE_COPY_TEX_IMAGE1D
,
216 OPCODE_COPY_TEX_IMAGE2D
,
217 OPCODE_COPY_TEX_SUB_IMAGE1D
,
218 OPCODE_COPY_TEX_SUB_IMAGE2D
,
219 OPCODE_COPY_TEX_SUB_IMAGE3D
,
225 OPCODE_DISABLE_INDEXED
,
229 OPCODE_ENABLE_INDEXED
,
243 OPCODE_LOAD_IDENTITY
,
256 OPCODE_PIXEL_TRANSFER
,
259 OPCODE_POINT_PARAMETERS
,
261 OPCODE_POLYGON_STIPPLE
,
262 OPCODE_POLYGON_OFFSET
,
266 OPCODE_PRIORITIZE_TEXTURE
,
275 OPCODE_SELECT_TEXTURE_SGIS
,
276 OPCODE_SELECT_TEXTURE_COORD_SET
,
287 OPCODE_TEX_SUB_IMAGE1D
,
288 OPCODE_TEX_SUB_IMAGE2D
,
289 OPCODE_TEX_SUB_IMAGE3D
,
293 /* GL_ARB_multitexture */
294 OPCODE_ACTIVE_TEXTURE
,
295 /* GL_ARB_texture_compression */
296 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
297 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
298 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
299 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
300 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
301 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
302 /* GL_ARB_multisample */
303 OPCODE_SAMPLE_COVERAGE
,
304 /* GL_ARB_window_pos */
305 OPCODE_WINDOW_POS_ARB
,
306 /* GL_ARB_vertex_program */
307 OPCODE_BIND_PROGRAM_ARB
,
308 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
309 /* GL_EXT_stencil_two_side */
310 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
311 /* GL_EXT_depth_bounds_test */
312 OPCODE_DEPTH_BOUNDS_EXT
,
313 /* GL_ARB_vertex/fragment_program */
314 OPCODE_PROGRAM_STRING_ARB
,
315 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
316 /* GL_ARB_occlusion_query */
317 OPCODE_BEGIN_QUERY_ARB
,
318 OPCODE_END_QUERY_ARB
,
319 /* GL_ARB_draw_buffers */
320 OPCODE_DRAW_BUFFERS_ARB
,
321 /* GL_ATI_fragment_shader */
322 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
323 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
325 OPCODE_STENCIL_FUNC_SEPARATE
,
326 OPCODE_STENCIL_OP_SEPARATE
,
327 OPCODE_STENCIL_MASK_SEPARATE
,
328 /* GL_NV_primitive_restart */
329 OPCODE_PRIMITIVE_RESTART_NV
,
330 /* GL_ARB_shader_objects */
348 OPCODE_UNIFORM_MATRIX22
,
349 OPCODE_UNIFORM_MATRIX33
,
350 OPCODE_UNIFORM_MATRIX44
,
351 OPCODE_UNIFORM_MATRIX23
,
352 OPCODE_UNIFORM_MATRIX32
,
353 OPCODE_UNIFORM_MATRIX24
,
354 OPCODE_UNIFORM_MATRIX42
,
355 OPCODE_UNIFORM_MATRIX34
,
356 OPCODE_UNIFORM_MATRIX43
,
368 /* OpenGL 4.0 / GL_ARB_tessellation_shader */
369 OPCODE_PATCH_PARAMETER_I
,
370 OPCODE_PATCH_PARAMETER_FV_INNER
,
371 OPCODE_PATCH_PARAMETER_FV_OUTER
,
373 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
374 OPCODE_USE_PROGRAM_STAGES
,
375 OPCODE_PROGRAM_UNIFORM_1F
,
376 OPCODE_PROGRAM_UNIFORM_2F
,
377 OPCODE_PROGRAM_UNIFORM_3F
,
378 OPCODE_PROGRAM_UNIFORM_4F
,
379 OPCODE_PROGRAM_UNIFORM_1FV
,
380 OPCODE_PROGRAM_UNIFORM_2FV
,
381 OPCODE_PROGRAM_UNIFORM_3FV
,
382 OPCODE_PROGRAM_UNIFORM_4FV
,
383 OPCODE_PROGRAM_UNIFORM_1I
,
384 OPCODE_PROGRAM_UNIFORM_2I
,
385 OPCODE_PROGRAM_UNIFORM_3I
,
386 OPCODE_PROGRAM_UNIFORM_4I
,
387 OPCODE_PROGRAM_UNIFORM_1IV
,
388 OPCODE_PROGRAM_UNIFORM_2IV
,
389 OPCODE_PROGRAM_UNIFORM_3IV
,
390 OPCODE_PROGRAM_UNIFORM_4IV
,
391 OPCODE_PROGRAM_UNIFORM_1UI
,
392 OPCODE_PROGRAM_UNIFORM_2UI
,
393 OPCODE_PROGRAM_UNIFORM_3UI
,
394 OPCODE_PROGRAM_UNIFORM_4UI
,
395 OPCODE_PROGRAM_UNIFORM_1UIV
,
396 OPCODE_PROGRAM_UNIFORM_2UIV
,
397 OPCODE_PROGRAM_UNIFORM_3UIV
,
398 OPCODE_PROGRAM_UNIFORM_4UIV
,
399 OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
400 OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
401 OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
402 OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
403 OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
404 OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
405 OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
406 OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
407 OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
409 /* GL_ARB_clip_control */
412 /* GL_ARB_color_buffer_float */
415 /* GL_EXT_framebuffer_blit */
416 OPCODE_BLIT_FRAMEBUFFER
,
418 /* Vertex attributes -- fallback for when optimized display
419 * list build isn't active.
438 /* GL_EXT_provoking_vertex */
439 OPCODE_PROVOKING_VERTEX
,
441 /* GL_EXT_transform_feedback */
442 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
443 OPCODE_END_TRANSFORM_FEEDBACK
,
444 OPCODE_BIND_TRANSFORM_FEEDBACK
,
445 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
446 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
447 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
449 /* GL_EXT_texture_integer */
451 OPCODE_CLEARCOLOR_UI
,
452 OPCODE_TEXPARAMETER_I
,
453 OPCODE_TEXPARAMETER_UI
,
455 /* GL_ARB_instanced_arrays */
456 OPCODE_VERTEX_ATTRIB_DIVISOR
,
458 /* GL_NV_texture_barrier */
459 OPCODE_TEXTURE_BARRIER_NV
,
461 /* GL_ARB_sampler_object */
463 OPCODE_SAMPLER_PARAMETERIV
,
464 OPCODE_SAMPLER_PARAMETERFV
,
465 OPCODE_SAMPLER_PARAMETERIIV
,
466 OPCODE_SAMPLER_PARAMETERUIV
,
471 /* GL_NV_conditional_render */
472 OPCODE_BEGIN_CONDITIONAL_RENDER
,
473 OPCODE_END_CONDITIONAL_RENDER
,
475 /* ARB_timer_query */
476 OPCODE_QUERY_COUNTER
,
478 /* ARB_transform_feedback3 */
479 OPCODE_BEGIN_QUERY_INDEXED
,
480 OPCODE_END_QUERY_INDEXED
,
481 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
483 /* ARB_transform_feedback_instanced */
484 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
485 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
487 /* ARB_uniform_buffer_object */
488 OPCODE_UNIFORM_BLOCK_BINDING
,
490 /* EXT_polygon_offset_clamp */
491 OPCODE_POLYGON_OFFSET_CLAMP
,
493 /* EXT_window_rectangles */
494 OPCODE_WINDOW_RECTANGLES
,
496 /* NV_conservative_raster */
497 OPCODE_SUBPIXEL_PRECISION_BIAS
,
499 /* NV_conservative_raster_dilate */
500 OPCODE_CONSERVATIVE_RASTER_PARAMETER_F
,
502 /* NV_conservative_raster_pre_snap_triangles */
503 OPCODE_CONSERVATIVE_RASTER_PARAMETER_I
,
505 /* The following three are meta instructions */
506 OPCODE_ERROR
, /* raise compiled-in error */
508 OPCODE_NOP
, /* No-op (used for 8-byte alignment */
518 * Display list instructions are stored as sequences of "nodes". Nodes
519 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
520 * are linked together with a pointer.
522 * Each instruction in the display list is stored as a sequence of
523 * contiguous nodes in memory.
524 * Each node is the union of a variety of data types.
526 * Note, all of these members should be 4 bytes in size or less for the
527 * sake of compact display lists. We store 8-byte pointers in a pair of
528 * these nodes using the save/get_pointer() functions below.
546 typedef union gl_dlist_node Node
;
549 /** How many 4-byte dwords to store a pointer */
550 #define POINTER_DWORDS (sizeof(void *) / 4)
552 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
553 * space for display lists. The following types and functions are
554 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
559 GLuint dwords
[POINTER_DWORDS
];
564 * Save a 4 or 8-byte pointer at dest (and dest+1).
567 save_pointer(Node
*dest
, void *src
)
572 STATIC_ASSERT(POINTER_DWORDS
== 1 || POINTER_DWORDS
== 2);
573 STATIC_ASSERT(sizeof(Node
) == 4);
577 for (i
= 0; i
< POINTER_DWORDS
; i
++)
578 dest
[i
].ui
= p
.dwords
[i
];
583 * Retrieve a 4 or 8-byte pointer from node (node+1).
586 get_pointer(const Node
*node
)
591 for (i
= 0; i
< POINTER_DWORDS
; i
++)
592 p
.dwords
[i
] = node
[i
].ui
;
599 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
610 * How many nodes to allocate at a time. Note that bulk vertex data
611 * from glBegin/glVertex/glEnd primitives will typically wind up in
612 * a VBO, and not directly in the display list itself.
614 #define BLOCK_SIZE 256
619 * Number of nodes of storage needed for each instruction.
620 * Sizes for dynamically allocated opcodes are stored in the context struct.
622 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
625 void mesa_print_display_list(GLuint list
);
629 * Does the given display list only contain a single glBitmap call?
632 is_bitmap_list(const struct gl_display_list
*dlist
)
634 const Node
*n
= dlist
->Head
;
635 if (n
[0].opcode
== OPCODE_BITMAP
) {
636 n
+= InstSize
[OPCODE_BITMAP
];
637 if (n
[0].opcode
== OPCODE_END_OF_LIST
)
645 * Is the given display list an empty list?
648 is_empty_list(const struct gl_display_list
*dlist
)
650 const Node
*n
= dlist
->Head
;
651 return n
[0].opcode
== OPCODE_END_OF_LIST
;
656 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
659 _mesa_delete_bitmap_atlas(struct gl_context
*ctx
, struct gl_bitmap_atlas
*atlas
)
662 ctx
->Driver
.DeleteTexture(ctx
, atlas
->texObj
);
669 * Lookup a gl_bitmap_atlas by listBase ID.
671 static struct gl_bitmap_atlas
*
672 lookup_bitmap_atlas(struct gl_context
*ctx
, GLuint listBase
)
674 struct gl_bitmap_atlas
*atlas
;
676 assert(listBase
> 0);
677 atlas
= _mesa_HashLookup(ctx
->Shared
->BitmapAtlas
, listBase
);
683 * Create new bitmap atlas and insert into hash table.
685 static struct gl_bitmap_atlas
*
686 alloc_bitmap_atlas(struct gl_context
*ctx
, GLuint listBase
)
688 struct gl_bitmap_atlas
*atlas
;
690 assert(listBase
> 0);
691 assert(_mesa_HashLookup(ctx
->Shared
->BitmapAtlas
, listBase
) == NULL
);
693 atlas
= calloc(1, sizeof(*atlas
));
695 _mesa_HashInsert(ctx
->Shared
->BitmapAtlas
, listBase
, atlas
);
703 * Try to build a bitmap atlas. This involves examining a sequence of
704 * display lists which contain glBitmap commands and putting the bitmap
705 * images into a texture map (the atlas).
706 * If we succeed, gl_bitmap_atlas::complete will be set to true.
707 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
710 build_bitmap_atlas(struct gl_context
*ctx
, struct gl_bitmap_atlas
*atlas
,
713 unsigned i
, row_height
= 0, xpos
= 0, ypos
= 0;
718 assert(!atlas
->complete
);
719 assert(atlas
->numBitmaps
> 0);
721 /* We use a rectangle texture (non-normalized coords) for the atlas */
722 assert(ctx
->Extensions
.NV_texture_rectangle
);
723 assert(ctx
->Const
.MaxTextureRectSize
>= 1024);
725 atlas
->texWidth
= 1024;
726 atlas
->texHeight
= 0; /* determined below */
728 atlas
->glyphs
= malloc(atlas
->numBitmaps
* sizeof(atlas
->glyphs
[0]));
729 if (!atlas
->glyphs
) {
731 atlas
->incomplete
= true;
735 /* Loop over the display lists. They should all contain a single glBitmap
736 * call. If not, bail out. Also, compute the position and sizes of each
737 * bitmap in the atlas to determine the texture atlas size.
739 for (i
= 0; i
< atlas
->numBitmaps
; i
++) {
740 const struct gl_display_list
*list
= _mesa_lookup_list(ctx
, listBase
+ i
);
742 struct gl_bitmap_glyph
*g
= &atlas
->glyphs
[i
];
743 unsigned bitmap_width
, bitmap_height
;
744 float bitmap_xmove
, bitmap_ymove
, bitmap_xorig
, bitmap_yorig
;
746 if (!list
|| is_empty_list(list
)) {
748 atlas
->numBitmaps
= i
;
752 if (!is_bitmap_list(list
)) {
753 /* This list does not contain exactly one glBitmap command. Give up. */
754 atlas
->incomplete
= true;
758 /* get bitmap info from the display list command */
760 assert(n
[0].opcode
== OPCODE_BITMAP
);
761 bitmap_width
= n
[1].i
;
762 bitmap_height
= n
[2].i
;
763 bitmap_xorig
= n
[3].f
;
764 bitmap_yorig
= n
[4].f
;
765 bitmap_xmove
= n
[5].f
;
766 bitmap_ymove
= n
[6].f
;
768 if (xpos
+ bitmap_width
> atlas
->texWidth
) {
769 /* advance to the next row of the texture */
775 /* save the bitmap's position in the atlas */
779 g
->h
= bitmap_height
;
780 g
->xorig
= bitmap_xorig
;
781 g
->yorig
= bitmap_yorig
;
782 g
->xmove
= bitmap_xmove
;
783 g
->ymove
= bitmap_ymove
;
785 xpos
+= bitmap_width
;
787 /* keep track of tallest bitmap in the row */
788 row_height
= MAX2(row_height
, bitmap_height
);
791 /* Now we know the texture height */
792 atlas
->texHeight
= ypos
+ row_height
;
794 if (atlas
->texHeight
== 0) {
795 /* no glyphs found, give up */
798 else if (atlas
->texHeight
> ctx
->Const
.MaxTextureRectSize
) {
799 /* too large, give up */
803 /* Create atlas texture (texture ID is irrelevant) */
804 atlas
->texObj
= ctx
->Driver
.NewTextureObject(ctx
, 999, GL_TEXTURE_RECTANGLE
);
805 if (!atlas
->texObj
) {
809 atlas
->texObj
->Sampler
.MinFilter
= GL_NEAREST
;
810 atlas
->texObj
->Sampler
.MagFilter
= GL_NEAREST
;
811 atlas
->texObj
->MaxLevel
= 0;
812 atlas
->texObj
->Immutable
= GL_TRUE
;
814 atlas
->texImage
= _mesa_get_tex_image(ctx
, atlas
->texObj
,
815 GL_TEXTURE_RECTANGLE
, 0);
816 if (!atlas
->texImage
) {
820 _mesa_init_teximage_fields(ctx
, atlas
->texImage
,
821 atlas
->texWidth
, atlas
->texHeight
, 1, 0,
822 GL_ALPHA
, MESA_FORMAT_A_UNORM8
);
824 /* alloc image storage */
825 if (!ctx
->Driver
.AllocTextureImageBuffer(ctx
, atlas
->texImage
)) {
829 /* map teximage, load with bitmap glyphs */
830 ctx
->Driver
.MapTextureImage(ctx
, atlas
->texImage
, 0,
831 0, 0, atlas
->texWidth
, atlas
->texHeight
,
832 GL_MAP_WRITE_BIT
, &map
, &map_stride
);
837 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
838 memset(map
, 0xff, map_stride
* atlas
->texHeight
);
840 for (i
= 0; i
< atlas
->numBitmaps
; i
++) {
841 const struct gl_display_list
*list
= _mesa_lookup_list(ctx
, listBase
+ i
);
842 const Node
*n
= list
->Head
;
844 assert(n
[0].opcode
== OPCODE_BITMAP
||
845 n
[0].opcode
== OPCODE_END_OF_LIST
);
847 if (n
[0].opcode
== OPCODE_BITMAP
) {
848 unsigned bitmap_width
= n
[1].i
;
849 unsigned bitmap_height
= n
[2].i
;
850 unsigned xpos
= atlas
->glyphs
[i
].x
;
851 unsigned ypos
= atlas
->glyphs
[i
].y
;
852 const void *bitmap_image
= get_pointer(&n
[7]);
854 assert(atlas
->glyphs
[i
].w
== bitmap_width
);
855 assert(atlas
->glyphs
[i
].h
== bitmap_height
);
857 /* put the bitmap image into the texture image */
858 _mesa_expand_bitmap(bitmap_width
, bitmap_height
,
859 &ctx
->DefaultPacking
, bitmap_image
,
860 map
+ map_stride
* ypos
+ xpos
, /* dest addr */
865 ctx
->Driver
.UnmapTextureImage(ctx
, atlas
->texImage
, 0);
867 atlas
->complete
= true;
872 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Display list bitmap atlas");
875 ctx
->Driver
.DeleteTexture(ctx
, atlas
->texObj
);
878 atlas
->glyphs
= NULL
;
879 atlas
->incomplete
= true;
884 * Allocate a gl_display_list object with an initial block of storage.
885 * \param count how many display list nodes/tokens to allocate
887 static struct gl_display_list
*
888 make_list(GLuint name
, GLuint count
)
890 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
892 dlist
->Head
= malloc(sizeof(Node
) * count
);
893 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
899 * Lookup function to just encapsulate casting.
901 struct gl_display_list
*
902 _mesa_lookup_list(struct gl_context
*ctx
, GLuint list
)
904 return (struct gl_display_list
*)
905 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
909 /** Is the given opcode an extension code? */
910 static inline GLboolean
911 is_ext_opcode(OpCode opcode
)
913 return (opcode
>= OPCODE_EXT_0
);
917 /** Destroy an extended opcode instruction */
919 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
921 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
923 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
924 step
= ctx
->ListExt
->Opcode
[i
].Size
;
929 /** Execute an extended opcode instruction */
931 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
933 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
935 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
936 step
= ctx
->ListExt
->Opcode
[i
].Size
;
941 /** Print an extended opcode instruction */
943 ext_opcode_print(struct gl_context
*ctx
, Node
*node
, FILE *f
)
945 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
947 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1], f
);
948 step
= ctx
->ListExt
->Opcode
[i
].Size
;
954 * Delete the named display list, but don't remove from hash table.
955 * \param dlist - display list pointer
958 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
963 n
= block
= dlist
->Head
;
965 done
= block
? GL_FALSE
: GL_TRUE
;
967 const OpCode opcode
= n
[0].opcode
;
969 /* check for extension opcodes first */
970 if (is_ext_opcode(opcode
)) {
971 n
+= ext_opcode_destroy(ctx
, n
);
975 /* for some commands, we need to free malloc'd memory */
977 free(get_pointer(&n
[6]));
980 free(get_pointer(&n
[10]));
982 case OPCODE_CALL_LISTS
:
983 free(get_pointer(&n
[3]));
985 case OPCODE_DRAW_PIXELS
:
986 free(get_pointer(&n
[5]));
989 free(get_pointer(&n
[7]));
991 case OPCODE_POLYGON_STIPPLE
:
992 free(get_pointer(&n
[1]));
994 case OPCODE_TEX_IMAGE1D
:
995 free(get_pointer(&n
[8]));
997 case OPCODE_TEX_IMAGE2D
:
998 free(get_pointer(&n
[9]));
1000 case OPCODE_TEX_IMAGE3D
:
1001 free(get_pointer(&n
[10]));
1003 case OPCODE_TEX_SUB_IMAGE1D
:
1004 free(get_pointer(&n
[7]));
1006 case OPCODE_TEX_SUB_IMAGE2D
:
1007 free(get_pointer(&n
[9]));
1009 case OPCODE_TEX_SUB_IMAGE3D
:
1010 free(get_pointer(&n
[11]));
1012 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
1013 free(get_pointer(&n
[7]));
1015 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
1016 free(get_pointer(&n
[8]));
1018 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
1019 free(get_pointer(&n
[9]));
1021 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
1022 free(get_pointer(&n
[7]));
1024 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
1025 free(get_pointer(&n
[9]));
1027 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
1028 free(get_pointer(&n
[11]));
1030 case OPCODE_PROGRAM_STRING_ARB
:
1031 free(get_pointer(&n
[4])); /* program string */
1033 case OPCODE_UNIFORM_1FV
:
1034 case OPCODE_UNIFORM_2FV
:
1035 case OPCODE_UNIFORM_3FV
:
1036 case OPCODE_UNIFORM_4FV
:
1037 case OPCODE_UNIFORM_1IV
:
1038 case OPCODE_UNIFORM_2IV
:
1039 case OPCODE_UNIFORM_3IV
:
1040 case OPCODE_UNIFORM_4IV
:
1041 case OPCODE_UNIFORM_1UIV
:
1042 case OPCODE_UNIFORM_2UIV
:
1043 case OPCODE_UNIFORM_3UIV
:
1044 case OPCODE_UNIFORM_4UIV
:
1045 free(get_pointer(&n
[3]));
1047 case OPCODE_UNIFORM_MATRIX22
:
1048 case OPCODE_UNIFORM_MATRIX33
:
1049 case OPCODE_UNIFORM_MATRIX44
:
1050 case OPCODE_UNIFORM_MATRIX24
:
1051 case OPCODE_UNIFORM_MATRIX42
:
1052 case OPCODE_UNIFORM_MATRIX23
:
1053 case OPCODE_UNIFORM_MATRIX32
:
1054 case OPCODE_UNIFORM_MATRIX34
:
1055 case OPCODE_UNIFORM_MATRIX43
:
1056 free(get_pointer(&n
[4]));
1058 case OPCODE_PROGRAM_UNIFORM_1FV
:
1059 case OPCODE_PROGRAM_UNIFORM_2FV
:
1060 case OPCODE_PROGRAM_UNIFORM_3FV
:
1061 case OPCODE_PROGRAM_UNIFORM_4FV
:
1062 case OPCODE_PROGRAM_UNIFORM_1IV
:
1063 case OPCODE_PROGRAM_UNIFORM_2IV
:
1064 case OPCODE_PROGRAM_UNIFORM_3IV
:
1065 case OPCODE_PROGRAM_UNIFORM_4IV
:
1066 case OPCODE_PROGRAM_UNIFORM_1UIV
:
1067 case OPCODE_PROGRAM_UNIFORM_2UIV
:
1068 case OPCODE_PROGRAM_UNIFORM_3UIV
:
1069 case OPCODE_PROGRAM_UNIFORM_4UIV
:
1070 free(get_pointer(&n
[4]));
1072 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
1073 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
1074 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
1075 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
1076 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
1077 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
1078 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
1079 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
1080 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
1081 free(get_pointer(&n
[5]));
1083 case OPCODE_PIXEL_MAP
:
1084 free(get_pointer(&n
[3]));
1086 case OPCODE_WINDOW_RECTANGLES
:
1087 free(get_pointer(&n
[3]));
1089 case OPCODE_CONTINUE
:
1090 n
= (Node
*) get_pointer(&n
[1]);
1094 case OPCODE_END_OF_LIST
:
1099 /* just increment 'n' pointer, below */
1103 if (opcode
!= OPCODE_CONTINUE
) {
1104 assert(InstSize
[opcode
] > 0);
1105 n
+= InstSize
[opcode
];
1116 * Called by _mesa_HashWalk() to check if a display list which is being
1117 * deleted belongs to a bitmap texture atlas.
1120 check_atlas_for_deleted_list(GLuint atlas_id
, void *data
, void *userData
)
1122 struct gl_bitmap_atlas
*atlas
= (struct gl_bitmap_atlas
*) data
;
1123 GLuint list_id
= *((GLuint
*) userData
); /* the list being deleted */
1125 /* See if the list_id falls in the range contained in this texture atlas */
1126 if (atlas
->complete
&&
1127 list_id
>= atlas_id
&&
1128 list_id
< atlas_id
+ atlas
->numBitmaps
) {
1129 /* Mark the atlas as incomplete so it doesn't get used. But don't
1130 * delete it yet since we don't want to try to recreate it in the next
1133 atlas
->complete
= false;
1134 atlas
->incomplete
= true;
1140 * Destroy a display list and remove from hash table.
1141 * \param list - display list number
1144 destroy_list(struct gl_context
*ctx
, GLuint list
)
1146 struct gl_display_list
*dlist
;
1151 dlist
= _mesa_lookup_list(ctx
, list
);
1155 if (is_bitmap_list(dlist
)) {
1156 /* If we're destroying a simple glBitmap display list, there's a
1157 * chance that we're destroying a bitmap image that's in a texture
1158 * atlas. Examine all atlases to see if that's the case. There's
1159 * usually few (if any) atlases so this isn't expensive.
1161 _mesa_HashWalk(ctx
->Shared
->BitmapAtlas
,
1162 check_atlas_for_deleted_list
, &list
);
1165 _mesa_delete_list(ctx
, dlist
);
1166 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
1171 * Translate the nth element of list from <type> to GLint.
1174 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
1186 bptr
= (GLbyte
*) list
;
1187 return (GLint
) bptr
[n
];
1188 case GL_UNSIGNED_BYTE
:
1189 ubptr
= (GLubyte
*) list
;
1190 return (GLint
) ubptr
[n
];
1192 sptr
= (GLshort
*) list
;
1193 return (GLint
) sptr
[n
];
1194 case GL_UNSIGNED_SHORT
:
1195 usptr
= (GLushort
*) list
;
1196 return (GLint
) usptr
[n
];
1198 iptr
= (GLint
*) list
;
1200 case GL_UNSIGNED_INT
:
1201 uiptr
= (GLuint
*) list
;
1202 return (GLint
) uiptr
[n
];
1204 fptr
= (GLfloat
*) list
;
1205 return (GLint
) floorf(fptr
[n
]);
1207 ubptr
= ((GLubyte
*) list
) + 2 * n
;
1208 return (GLint
) ubptr
[0] * 256
1211 ubptr
= ((GLubyte
*) list
) + 3 * n
;
1212 return (GLint
) ubptr
[0] * 65536
1213 + (GLint
) ubptr
[1] * 256
1216 ubptr
= ((GLubyte
*) list
) + 4 * n
;
1217 return (GLint
) ubptr
[0] * 16777216
1218 + (GLint
) ubptr
[1] * 65536
1219 + (GLint
) ubptr
[2] * 256
1228 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1229 * If width < 0 or height < 0 or format or type are invalid we'll just
1230 * return NULL. We will not generate an error since OpenGL command
1231 * arguments aren't error-checked until the command is actually executed
1232 * (not when they're compiled).
1233 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1236 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
1237 GLsizei width
, GLsizei height
, GLsizei depth
,
1238 GLenum format
, GLenum type
, const GLvoid
* pixels
,
1239 const struct gl_pixelstore_attrib
*unpack
)
1241 if (width
<= 0 || height
<= 0) {
1245 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
1246 /* bad format and/or type */
1250 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
1254 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
1255 format
, type
, pixels
, unpack
);
1256 if (pixels
&& !image
) {
1257 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1261 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
1262 depth
, format
, type
, INT_MAX
, pixels
)) {
1263 const GLubyte
*map
, *src
;
1267 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
1268 GL_MAP_READ_BIT
, unpack
->BufferObj
,
1271 /* unable to map src buffer! */
1272 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
1276 src
= ADD_POINTERS(map
, pixels
);
1277 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
1278 format
, type
, src
, unpack
);
1280 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
, MAP_INTERNAL
);
1283 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1289 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
1294 /** Return copy of memory */
1296 memdup(const void *src
, GLsizei bytes
)
1298 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
1300 memcpy(b
, src
, bytes
);
1306 * Allocate space for a display list instruction (opcode + payload space).
1307 * \param opcode the instruction opcode (OPCODE_* value)
1308 * \param bytes instruction payload size (not counting opcode)
1309 * \param align8 does the payload need to be 8-byte aligned?
1310 * This is only relevant in 64-bit environments.
1311 * \return pointer to allocated memory (the payload will be at pointer+1)
1314 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
, bool align8
)
1316 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
1317 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
1321 assert(bytes
<= BLOCK_SIZE
* sizeof(Node
));
1323 if (opcode
< OPCODE_EXT_0
) {
1324 if (InstSize
[opcode
] == 0) {
1325 /* save instruction size now */
1326 InstSize
[opcode
] = numNodes
;
1329 /* make sure instruction size agrees */
1330 assert(numNodes
== InstSize
[opcode
]);
1334 if (sizeof(void *) > sizeof(Node
) && align8
1335 && ctx
->ListState
.CurrentPos
% 2 == 0) {
1336 /* The opcode would get placed at node[0] and the payload would start
1337 * at node[1]. But the payload needs to be at an even offset (8-byte
1346 if (ctx
->ListState
.CurrentPos
+ nopNode
+ numNodes
+ contNodes
1348 /* This block is full. Allocate a new block and chain to it */
1350 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1351 n
[0].opcode
= OPCODE_CONTINUE
;
1352 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
1354 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
1358 /* a fresh block should be 8-byte aligned on 64-bit systems */
1359 assert(((GLintptr
) newblock
) % sizeof(void *) == 0);
1361 save_pointer(&n
[1], newblock
);
1362 ctx
->ListState
.CurrentBlock
= newblock
;
1363 ctx
->ListState
.CurrentPos
= 0;
1365 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1366 * we have to insert a NOP so that the payload of the real opcode lands
1367 * on an even location:
1368 * node[0] = OPCODE_NOP
1369 * node[1] = OPCODE_x;
1370 * node[2] = start of payload
1372 nopNode
= sizeof(void *) > sizeof(Node
) && align8
;
1375 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1377 assert(ctx
->ListState
.CurrentPos
% 2 == 0); /* even value */
1378 n
[0].opcode
= OPCODE_NOP
;
1380 /* The "real" opcode will now be at an odd location and the payload
1381 * will be at an even location.
1384 ctx
->ListState
.CurrentPos
+= nopNode
+ numNodes
;
1386 n
[0].opcode
= opcode
;
1394 * Allocate space for a display list instruction. Used by callers outside
1395 * this file for things like VBO vertex data.
1397 * \param opcode the instruction opcode (OPCODE_* value)
1398 * \param bytes instruction size in bytes, not counting opcode.
1399 * \return pointer to the usable data area (not including the internal
1403 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1405 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, false);
1407 return n
+ 1; /* return pointer to payload area, after opcode */
1414 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1415 * aligned in 64-bit environments, 4-byte aligned otherwise.
1418 _mesa_dlist_alloc_aligned(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1420 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, true);
1422 return n
+ 1; /* return pointer to payload area, after opcode */
1429 * This function allows modules and drivers to get their own opcodes
1430 * for extending display list functionality.
1431 * \param ctx the rendering context
1432 * \param size number of bytes for storing the new display list command
1433 * \param execute function to execute the new display list command
1434 * \param destroy function to destroy the new display list command
1435 * \param print function to print the new display list command
1436 * \return the new opcode number or -1 if error
1439 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1441 void (*execute
) (struct gl_context
*, void *),
1442 void (*destroy
) (struct gl_context
*, void *),
1443 void (*print
) (struct gl_context
*, void *, FILE *))
1445 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1446 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1447 ctx
->ListExt
->Opcode
[i
].Size
=
1448 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1449 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1450 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1451 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1452 return i
+ OPCODE_EXT_0
;
1459 * Allocate space for a display list instruction. The space is basically
1460 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1461 * function parameter, node[2] is the second parameter, etc.
1463 * \param opcode one of OPCODE_x
1464 * \param nparams number of function parameters
1465 * \return pointer to start of instruction space
1467 static inline Node
*
1468 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1470 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
), false);
1475 * Called by EndList to try to reduce memory used for the list.
1478 trim_list(struct gl_context
*ctx
)
1480 /* If the list we're ending only has one allocated block of nodes/tokens
1481 * and its size isn't a full block size, realloc the block to use less
1482 * memory. This is important for apps that create many small display
1483 * lists and apps that use glXUseXFont (many lists each containing one
1485 * Note: we currently only trim display lists that allocated one block
1486 * of tokens. That hits the short list case which is what we're mainly
1487 * concerned with. Trimming longer lists would involve traversing the
1488 * linked list of blocks.
1490 struct gl_dlist_state
*list
= &ctx
->ListState
;
1492 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1493 (list
->CurrentPos
< BLOCK_SIZE
)) {
1494 /* There's only one block and it's not full, so realloc */
1495 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1496 list
->CurrentList
->Head
=
1497 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1498 if (!list
->CurrentBlock
) {
1499 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1507 * Display List compilation functions
1509 static void GLAPIENTRY
1510 save_Accum(GLenum op
, GLfloat value
)
1512 GET_CURRENT_CONTEXT(ctx
);
1514 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1515 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1520 if (ctx
->ExecuteFlag
) {
1521 CALL_Accum(ctx
->Exec
, (op
, value
));
1526 static void GLAPIENTRY
1527 save_AlphaFunc(GLenum func
, GLclampf ref
)
1529 GET_CURRENT_CONTEXT(ctx
);
1531 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1532 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1535 n
[2].f
= (GLfloat
) ref
;
1537 if (ctx
->ExecuteFlag
) {
1538 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1543 static void GLAPIENTRY
1544 save_BindTexture(GLenum target
, GLuint texture
)
1546 GET_CURRENT_CONTEXT(ctx
);
1548 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1549 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1554 if (ctx
->ExecuteFlag
) {
1555 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1560 static void GLAPIENTRY
1561 save_Bitmap(GLsizei width
, GLsizei height
,
1562 GLfloat xorig
, GLfloat yorig
,
1563 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1565 GET_CURRENT_CONTEXT(ctx
);
1567 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1568 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1570 n
[1].i
= (GLint
) width
;
1571 n
[2].i
= (GLint
) height
;
1577 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1578 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1580 if (ctx
->ExecuteFlag
) {
1581 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1582 xorig
, yorig
, xmove
, ymove
, pixels
));
1587 static void GLAPIENTRY
1588 save_BlendEquation(GLenum mode
)
1590 GET_CURRENT_CONTEXT(ctx
);
1592 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1593 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1597 if (ctx
->ExecuteFlag
) {
1598 CALL_BlendEquation(ctx
->Exec
, (mode
));
1603 static void GLAPIENTRY
1604 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1606 GET_CURRENT_CONTEXT(ctx
);
1608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1609 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1614 if (ctx
->ExecuteFlag
) {
1615 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1620 static void GLAPIENTRY
1621 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1622 GLenum sfactorA
, GLenum dfactorA
)
1624 GET_CURRENT_CONTEXT(ctx
);
1626 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1627 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1629 n
[1].e
= sfactorRGB
;
1630 n
[2].e
= dfactorRGB
;
1634 if (ctx
->ExecuteFlag
) {
1635 CALL_BlendFuncSeparate(ctx
->Exec
,
1636 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1641 static void GLAPIENTRY
1642 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1644 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1648 static void GLAPIENTRY
1649 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1651 GET_CURRENT_CONTEXT(ctx
);
1653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1654 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1661 if (ctx
->ExecuteFlag
) {
1662 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1666 /* GL_ARB_draw_buffers_blend */
1667 static void GLAPIENTRY
1668 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1669 GLenum sfactorA
, GLenum dfactorA
)
1671 GET_CURRENT_CONTEXT(ctx
);
1673 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1674 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1677 n
[2].e
= sfactorRGB
;
1678 n
[3].e
= dfactorRGB
;
1682 if (ctx
->ExecuteFlag
) {
1683 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1684 sfactorA
, dfactorA
));
1688 /* GL_ARB_draw_buffers_blend */
1689 static void GLAPIENTRY
1690 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1692 GET_CURRENT_CONTEXT(ctx
);
1694 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1695 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_I
, 3);
1701 if (ctx
->ExecuteFlag
) {
1702 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1706 /* GL_ARB_draw_buffers_blend */
1707 static void GLAPIENTRY
1708 save_BlendEquationi(GLuint buf
, GLenum mode
)
1710 GET_CURRENT_CONTEXT(ctx
);
1712 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1713 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1718 if (ctx
->ExecuteFlag
) {
1719 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1723 /* GL_ARB_draw_buffers_blend */
1724 static void GLAPIENTRY
1725 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1727 GET_CURRENT_CONTEXT(ctx
);
1729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1730 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1736 if (ctx
->ExecuteFlag
) {
1737 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1742 /* GL_ARB_draw_instanced. */
1743 static void GLAPIENTRY
1744 save_DrawArraysInstancedARB(UNUSED GLenum mode
,
1746 UNUSED GLsizei count
,
1747 UNUSED GLsizei primcount
)
1749 GET_CURRENT_CONTEXT(ctx
);
1750 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1751 "glDrawArraysInstanced() during display list compile");
1754 static void GLAPIENTRY
1755 save_DrawElementsInstancedARB(UNUSED GLenum mode
,
1756 UNUSED GLsizei count
,
1758 UNUSED
const GLvoid
*indices
,
1759 UNUSED GLsizei primcount
)
1761 GET_CURRENT_CONTEXT(ctx
);
1762 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1763 "glDrawElementsInstanced() during display list compile");
1766 static void GLAPIENTRY
1767 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode
,
1768 UNUSED GLsizei count
,
1770 UNUSED
const GLvoid
*indices
,
1771 UNUSED GLsizei primcount
,
1772 UNUSED GLint basevertex
)
1774 GET_CURRENT_CONTEXT(ctx
);
1775 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1776 "glDrawElementsInstancedBaseVertex() during display list compile");
1779 /* GL_ARB_base_instance. */
1780 static void GLAPIENTRY
1781 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode
,
1783 UNUSED GLsizei count
,
1784 UNUSED GLsizei primcount
,
1785 UNUSED GLuint baseinstance
)
1787 GET_CURRENT_CONTEXT(ctx
);
1788 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1789 "glDrawArraysInstancedBaseInstance() during display list compile");
1792 static void APIENTRY
1793 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode
,
1794 UNUSED GLsizei count
,
1796 UNUSED
const void *indices
,
1797 UNUSED GLsizei primcount
,
1798 UNUSED GLuint baseinstance
)
1800 GET_CURRENT_CONTEXT(ctx
);
1801 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1802 "glDrawElementsInstancedBaseInstance() during display list compile");
1805 static void APIENTRY
1806 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode
,
1807 UNUSED GLsizei count
,
1809 UNUSED
const void *indices
,
1810 UNUSED GLsizei primcount
,
1811 UNUSED GLint basevertex
,
1812 UNUSED GLuint baseinstance
)
1814 GET_CURRENT_CONTEXT(ctx
);
1815 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1816 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1821 * While building a display list we cache some OpenGL state.
1822 * Under some circumstances we need to invalidate that state (immediately
1823 * when we start compiling a list, or after glCallList(s)).
1826 invalidate_saved_current_state(struct gl_context
*ctx
)
1830 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1831 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1833 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1834 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1836 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1838 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1842 static void GLAPIENTRY
1843 save_CallList(GLuint list
)
1845 GET_CURRENT_CONTEXT(ctx
);
1847 SAVE_FLUSH_VERTICES(ctx
);
1849 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1854 /* After this, we don't know what state we're in. Invalidate all
1855 * cached information previously gathered:
1857 invalidate_saved_current_state( ctx
);
1859 if (ctx
->ExecuteFlag
) {
1860 _mesa_CallList(list
);
1865 static void GLAPIENTRY
1866 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1868 GET_CURRENT_CONTEXT(ctx
);
1873 SAVE_FLUSH_VERTICES(ctx
);
1877 case GL_UNSIGNED_BYTE
:
1881 case GL_UNSIGNED_SHORT
:
1889 case GL_UNSIGNED_INT
:
1898 if (num
> 0 && type_size
> 0) {
1899 /* create a copy of the array of list IDs to save in the display list */
1900 lists_copy
= memdup(lists
, num
* type_size
);
1905 n
= alloc_instruction(ctx
, OPCODE_CALL_LISTS
, 2 + POINTER_DWORDS
);
1909 save_pointer(&n
[3], lists_copy
);
1912 /* After this, we don't know what state we're in. Invalidate all
1913 * cached information previously gathered:
1915 invalidate_saved_current_state( ctx
);
1917 if (ctx
->ExecuteFlag
) {
1918 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1923 static void GLAPIENTRY
1924 save_Clear(GLbitfield mask
)
1926 GET_CURRENT_CONTEXT(ctx
);
1928 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1929 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1933 if (ctx
->ExecuteFlag
) {
1934 CALL_Clear(ctx
->Exec
, (mask
));
1939 static void GLAPIENTRY
1940 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1942 GET_CURRENT_CONTEXT(ctx
);
1944 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1945 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1948 n
[2].i
= drawbuffer
;
1950 if (buffer
== GL_COLOR
) {
1961 if (ctx
->ExecuteFlag
) {
1962 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1967 static void GLAPIENTRY
1968 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1970 GET_CURRENT_CONTEXT(ctx
);
1972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1973 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1976 n
[2].i
= drawbuffer
;
1978 if (buffer
== GL_COLOR
) {
1989 if (ctx
->ExecuteFlag
) {
1990 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1995 static void GLAPIENTRY
1996 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1998 GET_CURRENT_CONTEXT(ctx
);
2000 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2001 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
2004 n
[2].i
= drawbuffer
;
2006 if (buffer
== GL_COLOR
) {
2017 if (ctx
->ExecuteFlag
) {
2018 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
2023 static void GLAPIENTRY
2024 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
2025 GLfloat depth
, GLint stencil
)
2027 GET_CURRENT_CONTEXT(ctx
);
2029 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2030 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
2033 n
[2].i
= drawbuffer
;
2037 if (ctx
->ExecuteFlag
) {
2038 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
2043 static void GLAPIENTRY
2044 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
2046 GET_CURRENT_CONTEXT(ctx
);
2048 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2049 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
2056 if (ctx
->ExecuteFlag
) {
2057 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
2062 static void GLAPIENTRY
2063 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
2065 GET_CURRENT_CONTEXT(ctx
);
2067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2068 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
2075 if (ctx
->ExecuteFlag
) {
2076 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
2081 static void GLAPIENTRY
2082 save_ClearDepth(GLclampd depth
)
2084 GET_CURRENT_CONTEXT(ctx
);
2086 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2087 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
2089 n
[1].f
= (GLfloat
) depth
;
2091 if (ctx
->ExecuteFlag
) {
2092 CALL_ClearDepth(ctx
->Exec
, (depth
));
2097 static void GLAPIENTRY
2098 save_ClearIndex(GLfloat c
)
2100 GET_CURRENT_CONTEXT(ctx
);
2102 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2103 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
2107 if (ctx
->ExecuteFlag
) {
2108 CALL_ClearIndex(ctx
->Exec
, (c
));
2113 static void GLAPIENTRY
2114 save_ClearStencil(GLint s
)
2116 GET_CURRENT_CONTEXT(ctx
);
2118 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2119 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
2123 if (ctx
->ExecuteFlag
) {
2124 CALL_ClearStencil(ctx
->Exec
, (s
));
2129 static void GLAPIENTRY
2130 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
2132 GET_CURRENT_CONTEXT(ctx
);
2134 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2135 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
2138 n
[2].f
= (GLfloat
) equ
[0];
2139 n
[3].f
= (GLfloat
) equ
[1];
2140 n
[4].f
= (GLfloat
) equ
[2];
2141 n
[5].f
= (GLfloat
) equ
[3];
2143 if (ctx
->ExecuteFlag
) {
2144 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
2150 static void GLAPIENTRY
2151 save_ColorMask(GLboolean red
, GLboolean green
,
2152 GLboolean blue
, GLboolean alpha
)
2154 GET_CURRENT_CONTEXT(ctx
);
2156 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2157 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
2164 if (ctx
->ExecuteFlag
) {
2165 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
2170 static void GLAPIENTRY
2171 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
2172 GLboolean blue
, GLboolean alpha
)
2174 GET_CURRENT_CONTEXT(ctx
);
2176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2177 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
2185 if (ctx
->ExecuteFlag
) {
2186 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2191 static void GLAPIENTRY
2192 save_ColorMaterial(GLenum face
, GLenum mode
)
2194 GET_CURRENT_CONTEXT(ctx
);
2196 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2198 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
2203 if (ctx
->ExecuteFlag
) {
2204 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
2209 static void GLAPIENTRY
2210 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
2212 GET_CURRENT_CONTEXT(ctx
);
2214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2215 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
2219 n
[3].i
= (GLint
) width
;
2220 n
[4].i
= (GLint
) height
;
2223 if (ctx
->ExecuteFlag
) {
2224 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
2230 static void GLAPIENTRY
2231 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
2232 GLint x
, GLint y
, GLsizei width
, GLint border
)
2234 GET_CURRENT_CONTEXT(ctx
);
2236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2237 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
2241 n
[3].e
= internalformat
;
2247 if (ctx
->ExecuteFlag
) {
2248 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
2249 x
, y
, width
, border
));
2254 static void GLAPIENTRY
2255 save_CopyTexImage2D(GLenum target
, GLint level
,
2256 GLenum internalformat
,
2257 GLint x
, GLint y
, GLsizei width
,
2258 GLsizei height
, GLint border
)
2260 GET_CURRENT_CONTEXT(ctx
);
2262 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2263 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
2267 n
[3].e
= internalformat
;
2274 if (ctx
->ExecuteFlag
) {
2275 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
2276 x
, y
, width
, height
, border
));
2282 static void GLAPIENTRY
2283 save_CopyTexSubImage1D(GLenum target
, GLint level
,
2284 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
2286 GET_CURRENT_CONTEXT(ctx
);
2288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2289 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
2298 if (ctx
->ExecuteFlag
) {
2299 CALL_CopyTexSubImage1D(ctx
->Exec
,
2300 (target
, level
, xoffset
, x
, y
, width
));
2305 static void GLAPIENTRY
2306 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2307 GLint xoffset
, GLint yoffset
,
2308 GLint x
, GLint y
, GLsizei width
, GLint height
)
2310 GET_CURRENT_CONTEXT(ctx
);
2312 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2313 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2324 if (ctx
->ExecuteFlag
) {
2325 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2326 x
, y
, width
, height
));
2331 static void GLAPIENTRY
2332 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2333 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2334 GLint x
, GLint y
, GLsizei width
, GLint height
)
2336 GET_CURRENT_CONTEXT(ctx
);
2338 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2339 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2351 if (ctx
->ExecuteFlag
) {
2352 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2353 xoffset
, yoffset
, zoffset
,
2354 x
, y
, width
, height
));
2359 static void GLAPIENTRY
2360 save_CullFace(GLenum mode
)
2362 GET_CURRENT_CONTEXT(ctx
);
2364 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2365 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2369 if (ctx
->ExecuteFlag
) {
2370 CALL_CullFace(ctx
->Exec
, (mode
));
2375 static void GLAPIENTRY
2376 save_DepthFunc(GLenum func
)
2378 GET_CURRENT_CONTEXT(ctx
);
2380 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2381 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2385 if (ctx
->ExecuteFlag
) {
2386 CALL_DepthFunc(ctx
->Exec
, (func
));
2391 static void GLAPIENTRY
2392 save_DepthMask(GLboolean mask
)
2394 GET_CURRENT_CONTEXT(ctx
);
2396 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2397 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2401 if (ctx
->ExecuteFlag
) {
2402 CALL_DepthMask(ctx
->Exec
, (mask
));
2407 static void GLAPIENTRY
2408 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2410 GET_CURRENT_CONTEXT(ctx
);
2412 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2413 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2415 n
[1].f
= (GLfloat
) nearval
;
2416 n
[2].f
= (GLfloat
) farval
;
2418 if (ctx
->ExecuteFlag
) {
2419 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2424 static void GLAPIENTRY
2425 save_Disable(GLenum cap
)
2427 GET_CURRENT_CONTEXT(ctx
);
2429 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2430 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2434 if (ctx
->ExecuteFlag
) {
2435 CALL_Disable(ctx
->Exec
, (cap
));
2440 static void GLAPIENTRY
2441 save_DisableIndexed(GLuint index
, GLenum cap
)
2443 GET_CURRENT_CONTEXT(ctx
);
2445 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2446 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2451 if (ctx
->ExecuteFlag
) {
2452 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2457 static void GLAPIENTRY
2458 save_DrawBuffer(GLenum mode
)
2460 GET_CURRENT_CONTEXT(ctx
);
2462 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2463 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2467 if (ctx
->ExecuteFlag
) {
2468 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2473 static void GLAPIENTRY
2474 save_DrawPixels(GLsizei width
, GLsizei height
,
2475 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2477 GET_CURRENT_CONTEXT(ctx
);
2480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2482 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2489 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2490 pixels
, &ctx
->Unpack
));
2492 if (ctx
->ExecuteFlag
) {
2493 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2499 static void GLAPIENTRY
2500 save_Enable(GLenum cap
)
2502 GET_CURRENT_CONTEXT(ctx
);
2504 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2505 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2509 if (ctx
->ExecuteFlag
) {
2510 CALL_Enable(ctx
->Exec
, (cap
));
2516 static void GLAPIENTRY
2517 save_EnableIndexed(GLuint index
, GLenum cap
)
2519 GET_CURRENT_CONTEXT(ctx
);
2521 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2522 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2527 if (ctx
->ExecuteFlag
) {
2528 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2534 static void GLAPIENTRY
2535 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2537 GET_CURRENT_CONTEXT(ctx
);
2539 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2540 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2546 if (ctx
->ExecuteFlag
) {
2547 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2552 static void GLAPIENTRY
2553 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2555 GET_CURRENT_CONTEXT(ctx
);
2557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2558 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2566 if (ctx
->ExecuteFlag
) {
2567 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2574 static void GLAPIENTRY
2575 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2577 GET_CURRENT_CONTEXT(ctx
);
2579 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2580 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2588 if (ctx
->ExecuteFlag
) {
2589 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2594 static void GLAPIENTRY
2595 save_Fogf(GLenum pname
, GLfloat param
)
2599 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2600 save_Fogfv(pname
, parray
);
2604 static void GLAPIENTRY
2605 save_Fogiv(GLenum pname
, const GLint
*params
)
2610 case GL_FOG_DENSITY
:
2614 p
[0] = (GLfloat
) *params
;
2620 p
[0] = INT_TO_FLOAT(params
[0]);
2621 p
[1] = INT_TO_FLOAT(params
[1]);
2622 p
[2] = INT_TO_FLOAT(params
[2]);
2623 p
[3] = INT_TO_FLOAT(params
[3]);
2626 /* Error will be caught later in gl_Fogfv */
2627 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2629 save_Fogfv(pname
, p
);
2633 static void GLAPIENTRY
2634 save_Fogi(GLenum pname
, GLint param
)
2638 parray
[1] = parray
[2] = parray
[3] = 0;
2639 save_Fogiv(pname
, parray
);
2643 static void GLAPIENTRY
2644 save_FrontFace(GLenum mode
)
2646 GET_CURRENT_CONTEXT(ctx
);
2648 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2649 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2653 if (ctx
->ExecuteFlag
) {
2654 CALL_FrontFace(ctx
->Exec
, (mode
));
2659 static void GLAPIENTRY
2660 save_Frustum(GLdouble left
, GLdouble right
,
2661 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2663 GET_CURRENT_CONTEXT(ctx
);
2665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2666 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2668 n
[1].f
= (GLfloat
) left
;
2669 n
[2].f
= (GLfloat
) right
;
2670 n
[3].f
= (GLfloat
) bottom
;
2671 n
[4].f
= (GLfloat
) top
;
2672 n
[5].f
= (GLfloat
) nearval
;
2673 n
[6].f
= (GLfloat
) farval
;
2675 if (ctx
->ExecuteFlag
) {
2676 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2681 static void GLAPIENTRY
2682 save_Hint(GLenum target
, GLenum mode
)
2684 GET_CURRENT_CONTEXT(ctx
);
2686 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2687 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2692 if (ctx
->ExecuteFlag
) {
2693 CALL_Hint(ctx
->Exec
, (target
, mode
));
2698 static void GLAPIENTRY
2699 save_IndexMask(GLuint mask
)
2701 GET_CURRENT_CONTEXT(ctx
);
2703 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2704 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2708 if (ctx
->ExecuteFlag
) {
2709 CALL_IndexMask(ctx
->Exec
, (mask
));
2714 static void GLAPIENTRY
2715 save_InitNames(void)
2717 GET_CURRENT_CONTEXT(ctx
);
2718 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2719 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2720 if (ctx
->ExecuteFlag
) {
2721 CALL_InitNames(ctx
->Exec
, ());
2726 static void GLAPIENTRY
2727 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2729 GET_CURRENT_CONTEXT(ctx
);
2731 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2732 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2750 case GL_SPOT_DIRECTION
:
2753 case GL_SPOT_EXPONENT
:
2756 case GL_SPOT_CUTOFF
:
2759 case GL_CONSTANT_ATTENUATION
:
2762 case GL_LINEAR_ATTENUATION
:
2765 case GL_QUADRATIC_ATTENUATION
:
2771 for (i
= 0; i
< nParams
; i
++) {
2772 n
[3 + i
].f
= params
[i
];
2775 if (ctx
->ExecuteFlag
) {
2776 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2781 static void GLAPIENTRY
2782 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2786 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2787 save_Lightfv(light
, pname
, parray
);
2791 static void GLAPIENTRY
2792 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2799 fparam
[0] = INT_TO_FLOAT(params
[0]);
2800 fparam
[1] = INT_TO_FLOAT(params
[1]);
2801 fparam
[2] = INT_TO_FLOAT(params
[2]);
2802 fparam
[3] = INT_TO_FLOAT(params
[3]);
2805 fparam
[0] = (GLfloat
) params
[0];
2806 fparam
[1] = (GLfloat
) params
[1];
2807 fparam
[2] = (GLfloat
) params
[2];
2808 fparam
[3] = (GLfloat
) params
[3];
2810 case GL_SPOT_DIRECTION
:
2811 fparam
[0] = (GLfloat
) params
[0];
2812 fparam
[1] = (GLfloat
) params
[1];
2813 fparam
[2] = (GLfloat
) params
[2];
2815 case GL_SPOT_EXPONENT
:
2816 case GL_SPOT_CUTOFF
:
2817 case GL_CONSTANT_ATTENUATION
:
2818 case GL_LINEAR_ATTENUATION
:
2819 case GL_QUADRATIC_ATTENUATION
:
2820 fparam
[0] = (GLfloat
) params
[0];
2823 /* error will be caught later in gl_Lightfv */
2826 save_Lightfv(light
, pname
, fparam
);
2830 static void GLAPIENTRY
2831 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2835 parray
[1] = parray
[2] = parray
[3] = 0;
2836 save_Lightiv(light
, pname
, parray
);
2840 static void GLAPIENTRY
2841 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2843 GET_CURRENT_CONTEXT(ctx
);
2845 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2846 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2854 if (ctx
->ExecuteFlag
) {
2855 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2860 static void GLAPIENTRY
2861 save_LightModelf(GLenum pname
, GLfloat param
)
2865 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2866 save_LightModelfv(pname
, parray
);
2870 static void GLAPIENTRY
2871 save_LightModeliv(GLenum pname
, const GLint
*params
)
2875 case GL_LIGHT_MODEL_AMBIENT
:
2876 fparam
[0] = INT_TO_FLOAT(params
[0]);
2877 fparam
[1] = INT_TO_FLOAT(params
[1]);
2878 fparam
[2] = INT_TO_FLOAT(params
[2]);
2879 fparam
[3] = INT_TO_FLOAT(params
[3]);
2881 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2882 case GL_LIGHT_MODEL_TWO_SIDE
:
2883 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2884 fparam
[0] = (GLfloat
) params
[0];
2890 /* Error will be caught later in gl_LightModelfv */
2891 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2893 save_LightModelfv(pname
, fparam
);
2897 static void GLAPIENTRY
2898 save_LightModeli(GLenum pname
, GLint param
)
2902 parray
[1] = parray
[2] = parray
[3] = 0;
2903 save_LightModeliv(pname
, parray
);
2907 static void GLAPIENTRY
2908 save_LineStipple(GLint factor
, GLushort pattern
)
2910 GET_CURRENT_CONTEXT(ctx
);
2912 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2913 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2918 if (ctx
->ExecuteFlag
) {
2919 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2924 static void GLAPIENTRY
2925 save_LineWidth(GLfloat width
)
2927 GET_CURRENT_CONTEXT(ctx
);
2929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2930 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2934 if (ctx
->ExecuteFlag
) {
2935 CALL_LineWidth(ctx
->Exec
, (width
));
2940 static void GLAPIENTRY
2941 save_ListBase(GLuint base
)
2943 GET_CURRENT_CONTEXT(ctx
);
2945 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2946 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2950 if (ctx
->ExecuteFlag
) {
2951 CALL_ListBase(ctx
->Exec
, (base
));
2956 static void GLAPIENTRY
2957 save_LoadIdentity(void)
2959 GET_CURRENT_CONTEXT(ctx
);
2960 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2961 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2962 if (ctx
->ExecuteFlag
) {
2963 CALL_LoadIdentity(ctx
->Exec
, ());
2968 static void GLAPIENTRY
2969 save_LoadMatrixf(const GLfloat
* m
)
2971 GET_CURRENT_CONTEXT(ctx
);
2973 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2974 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2977 for (i
= 0; i
< 16; i
++) {
2981 if (ctx
->ExecuteFlag
) {
2982 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2987 static void GLAPIENTRY
2988 save_LoadMatrixd(const GLdouble
* m
)
2992 for (i
= 0; i
< 16; i
++) {
2993 f
[i
] = (GLfloat
) m
[i
];
2995 save_LoadMatrixf(f
);
2999 static void GLAPIENTRY
3000 save_LoadName(GLuint name
)
3002 GET_CURRENT_CONTEXT(ctx
);
3004 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3005 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
3009 if (ctx
->ExecuteFlag
) {
3010 CALL_LoadName(ctx
->Exec
, (name
));
3015 static void GLAPIENTRY
3016 save_LogicOp(GLenum opcode
)
3018 GET_CURRENT_CONTEXT(ctx
);
3020 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3021 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
3025 if (ctx
->ExecuteFlag
) {
3026 CALL_LogicOp(ctx
->Exec
, (opcode
));
3031 static void GLAPIENTRY
3032 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
3033 GLint order
, const GLdouble
* points
)
3035 GET_CURRENT_CONTEXT(ctx
);
3037 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3038 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
3040 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
3042 n
[2].f
= (GLfloat
) u1
;
3043 n
[3].f
= (GLfloat
) u2
;
3044 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
3046 save_pointer(&n
[6], pnts
);
3048 if (ctx
->ExecuteFlag
) {
3049 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
3053 static void GLAPIENTRY
3054 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
3055 GLint order
, const GLfloat
* points
)
3057 GET_CURRENT_CONTEXT(ctx
);
3059 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3060 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
3062 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
3066 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
3068 save_pointer(&n
[6], pnts
);
3070 if (ctx
->ExecuteFlag
) {
3071 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
3076 static void GLAPIENTRY
3077 save_Map2d(GLenum target
,
3078 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
3079 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
3080 const GLdouble
* points
)
3082 GET_CURRENT_CONTEXT(ctx
);
3084 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3085 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
3087 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
3088 vstride
, vorder
, points
);
3090 n
[2].f
= (GLfloat
) u1
;
3091 n
[3].f
= (GLfloat
) u2
;
3092 n
[4].f
= (GLfloat
) v1
;
3093 n
[5].f
= (GLfloat
) v2
;
3094 /* XXX verify these strides are correct */
3095 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
3096 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
3099 save_pointer(&n
[10], pnts
);
3101 if (ctx
->ExecuteFlag
) {
3102 CALL_Map2d(ctx
->Exec
, (target
,
3103 u1
, u2
, ustride
, uorder
,
3104 v1
, v2
, vstride
, vorder
, points
));
3109 static void GLAPIENTRY
3110 save_Map2f(GLenum target
,
3111 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
3112 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
3113 const GLfloat
* points
)
3115 GET_CURRENT_CONTEXT(ctx
);
3117 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3118 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
3120 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
3121 vstride
, vorder
, points
);
3127 /* XXX verify these strides are correct */
3128 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
3129 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
3132 save_pointer(&n
[10], pnts
);
3134 if (ctx
->ExecuteFlag
) {
3135 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
3136 v1
, v2
, vstride
, vorder
, points
));
3141 static void GLAPIENTRY
3142 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
3144 GET_CURRENT_CONTEXT(ctx
);
3146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3147 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
3153 if (ctx
->ExecuteFlag
) {
3154 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
3159 static void GLAPIENTRY
3160 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
3162 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
3166 static void GLAPIENTRY
3167 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
3168 GLint vn
, GLfloat v1
, GLfloat v2
)
3170 GET_CURRENT_CONTEXT(ctx
);
3172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3173 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
3182 if (ctx
->ExecuteFlag
) {
3183 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
3189 static void GLAPIENTRY
3190 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
3191 GLint vn
, GLdouble v1
, GLdouble v2
)
3193 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
3194 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
3198 static void GLAPIENTRY
3199 save_MatrixMode(GLenum mode
)
3201 GET_CURRENT_CONTEXT(ctx
);
3203 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3204 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
3208 if (ctx
->ExecuteFlag
) {
3209 CALL_MatrixMode(ctx
->Exec
, (mode
));
3214 static void GLAPIENTRY
3215 save_MultMatrixf(const GLfloat
* m
)
3217 GET_CURRENT_CONTEXT(ctx
);
3219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3220 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
3223 for (i
= 0; i
< 16; i
++) {
3227 if (ctx
->ExecuteFlag
) {
3228 CALL_MultMatrixf(ctx
->Exec
, (m
));
3233 static void GLAPIENTRY
3234 save_MultMatrixd(const GLdouble
* m
)
3238 for (i
= 0; i
< 16; i
++) {
3239 f
[i
] = (GLfloat
) m
[i
];
3241 save_MultMatrixf(f
);
3245 static void GLAPIENTRY
3246 save_NewList(GLuint name
, GLenum mode
)
3248 GET_CURRENT_CONTEXT(ctx
);
3249 /* It's an error to call this function while building a display list */
3250 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
3257 static void GLAPIENTRY
3258 save_Ortho(GLdouble left
, GLdouble right
,
3259 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
3261 GET_CURRENT_CONTEXT(ctx
);
3263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3264 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
3266 n
[1].f
= (GLfloat
) left
;
3267 n
[2].f
= (GLfloat
) right
;
3268 n
[3].f
= (GLfloat
) bottom
;
3269 n
[4].f
= (GLfloat
) top
;
3270 n
[5].f
= (GLfloat
) nearval
;
3271 n
[6].f
= (GLfloat
) farval
;
3273 if (ctx
->ExecuteFlag
) {
3274 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
3279 static void GLAPIENTRY
3280 save_PatchParameteri(GLenum pname
, const GLint value
)
3282 GET_CURRENT_CONTEXT(ctx
);
3284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3285 n
= alloc_instruction(ctx
, OPCODE_PATCH_PARAMETER_I
, 2);
3290 if (ctx
->ExecuteFlag
) {
3291 CALL_PatchParameteri(ctx
->Exec
, (pname
, value
));
3296 static void GLAPIENTRY
3297 save_PatchParameterfv(GLenum pname
, const GLfloat
*params
)
3299 GET_CURRENT_CONTEXT(ctx
);
3301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3303 if (pname
== GL_PATCH_DEFAULT_OUTER_LEVEL
) {
3304 n
= alloc_instruction(ctx
, OPCODE_PATCH_PARAMETER_FV_OUTER
, 5);
3306 assert(pname
== GL_PATCH_DEFAULT_INNER_LEVEL
);
3307 n
= alloc_instruction(ctx
, OPCODE_PATCH_PARAMETER_FV_INNER
, 3);
3311 if (pname
== GL_PATCH_DEFAULT_OUTER_LEVEL
) {
3321 if (ctx
->ExecuteFlag
) {
3322 CALL_PatchParameterfv(ctx
->Exec
, (pname
, params
));
3327 static void GLAPIENTRY
3328 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
3330 GET_CURRENT_CONTEXT(ctx
);
3332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3333 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
3337 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
3339 if (ctx
->ExecuteFlag
) {
3340 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
3345 static void GLAPIENTRY
3346 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
3348 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3350 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3351 for (i
= 0; i
< mapsize
; i
++) {
3352 fvalues
[i
] = (GLfloat
) values
[i
];
3356 for (i
= 0; i
< mapsize
; i
++) {
3357 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3360 save_PixelMapfv(map
, mapsize
, fvalues
);
3364 static void GLAPIENTRY
3365 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3367 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3369 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3370 for (i
= 0; i
< mapsize
; i
++) {
3371 fvalues
[i
] = (GLfloat
) values
[i
];
3375 for (i
= 0; i
< mapsize
; i
++) {
3376 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3379 save_PixelMapfv(map
, mapsize
, fvalues
);
3383 static void GLAPIENTRY
3384 save_PixelTransferf(GLenum pname
, GLfloat param
)
3386 GET_CURRENT_CONTEXT(ctx
);
3388 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3389 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3394 if (ctx
->ExecuteFlag
) {
3395 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3400 static void GLAPIENTRY
3401 save_PixelTransferi(GLenum pname
, GLint param
)
3403 save_PixelTransferf(pname
, (GLfloat
) param
);
3407 static void GLAPIENTRY
3408 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3410 GET_CURRENT_CONTEXT(ctx
);
3412 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3413 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3418 if (ctx
->ExecuteFlag
) {
3419 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3424 static void GLAPIENTRY
3425 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3427 GET_CURRENT_CONTEXT(ctx
);
3429 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3430 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3437 if (ctx
->ExecuteFlag
) {
3438 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3443 static void GLAPIENTRY
3444 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3448 parray
[1] = parray
[2] = 0.0F
;
3449 save_PointParameterfvEXT(pname
, parray
);
3452 static void GLAPIENTRY
3453 save_PointParameteriNV(GLenum pname
, GLint param
)
3456 parray
[0] = (GLfloat
) param
;
3457 parray
[1] = parray
[2] = 0.0F
;
3458 save_PointParameterfvEXT(pname
, parray
);
3461 static void GLAPIENTRY
3462 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3465 parray
[0] = (GLfloat
) param
[0];
3466 parray
[1] = parray
[2] = 0.0F
;
3467 save_PointParameterfvEXT(pname
, parray
);
3471 static void GLAPIENTRY
3472 save_PointSize(GLfloat size
)
3474 GET_CURRENT_CONTEXT(ctx
);
3476 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3477 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3481 if (ctx
->ExecuteFlag
) {
3482 CALL_PointSize(ctx
->Exec
, (size
));
3487 static void GLAPIENTRY
3488 save_PolygonMode(GLenum face
, GLenum mode
)
3490 GET_CURRENT_CONTEXT(ctx
);
3492 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3493 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3498 if (ctx
->ExecuteFlag
) {
3499 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3504 static void GLAPIENTRY
3505 save_PolygonStipple(const GLubyte
* pattern
)
3507 GET_CURRENT_CONTEXT(ctx
);
3510 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3512 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3515 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3516 pattern
, &ctx
->Unpack
));
3518 if (ctx
->ExecuteFlag
) {
3519 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3524 static void GLAPIENTRY
3525 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3527 GET_CURRENT_CONTEXT(ctx
);
3529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3530 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3535 if (ctx
->ExecuteFlag
) {
3536 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3541 static void GLAPIENTRY
3542 save_PolygonOffsetClampEXT(GLfloat factor
, GLfloat units
, GLfloat clamp
)
3544 GET_CURRENT_CONTEXT(ctx
);
3546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3547 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET_CLAMP
, 3);
3553 if (ctx
->ExecuteFlag
) {
3554 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (factor
, units
, clamp
));
3558 static void GLAPIENTRY
3559 save_PopAttrib(void)
3561 GET_CURRENT_CONTEXT(ctx
);
3562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3563 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3564 if (ctx
->ExecuteFlag
) {
3565 CALL_PopAttrib(ctx
->Exec
, ());
3570 static void GLAPIENTRY
3571 save_PopMatrix(void)
3573 GET_CURRENT_CONTEXT(ctx
);
3574 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3575 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3576 if (ctx
->ExecuteFlag
) {
3577 CALL_PopMatrix(ctx
->Exec
, ());
3582 static void GLAPIENTRY
3585 GET_CURRENT_CONTEXT(ctx
);
3586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3587 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3588 if (ctx
->ExecuteFlag
) {
3589 CALL_PopName(ctx
->Exec
, ());
3594 static void GLAPIENTRY
3595 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3596 const GLclampf
* priorities
)
3598 GET_CURRENT_CONTEXT(ctx
);
3600 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3602 for (i
= 0; i
< num
; i
++) {
3604 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3606 n
[1].ui
= textures
[i
];
3607 n
[2].f
= priorities
[i
];
3610 if (ctx
->ExecuteFlag
) {
3611 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3616 static void GLAPIENTRY
3617 save_PushAttrib(GLbitfield mask
)
3619 GET_CURRENT_CONTEXT(ctx
);
3621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3622 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3626 if (ctx
->ExecuteFlag
) {
3627 CALL_PushAttrib(ctx
->Exec
, (mask
));
3632 static void GLAPIENTRY
3633 save_PushMatrix(void)
3635 GET_CURRENT_CONTEXT(ctx
);
3636 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3637 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3638 if (ctx
->ExecuteFlag
) {
3639 CALL_PushMatrix(ctx
->Exec
, ());
3644 static void GLAPIENTRY
3645 save_PushName(GLuint name
)
3647 GET_CURRENT_CONTEXT(ctx
);
3649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3650 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3654 if (ctx
->ExecuteFlag
) {
3655 CALL_PushName(ctx
->Exec
, (name
));
3660 static void GLAPIENTRY
3661 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3663 GET_CURRENT_CONTEXT(ctx
);
3665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3666 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3673 if (ctx
->ExecuteFlag
) {
3674 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3678 static void GLAPIENTRY
3679 save_RasterPos2d(GLdouble x
, GLdouble y
)
3681 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3684 static void GLAPIENTRY
3685 save_RasterPos2f(GLfloat x
, GLfloat y
)
3687 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3690 static void GLAPIENTRY
3691 save_RasterPos2i(GLint x
, GLint y
)
3693 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3696 static void GLAPIENTRY
3697 save_RasterPos2s(GLshort x
, GLshort y
)
3699 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3702 static void GLAPIENTRY
3703 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3705 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3708 static void GLAPIENTRY
3709 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3711 save_RasterPos4f(x
, y
, z
, 1.0F
);
3714 static void GLAPIENTRY
3715 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3717 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3720 static void GLAPIENTRY
3721 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3723 save_RasterPos4f(x
, y
, z
, 1.0F
);
3726 static void GLAPIENTRY
3727 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3729 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3732 static void GLAPIENTRY
3733 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3735 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3738 static void GLAPIENTRY
3739 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3741 save_RasterPos4f(x
, y
, z
, w
);
3744 static void GLAPIENTRY
3745 save_RasterPos2dv(const GLdouble
* v
)
3747 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3750 static void GLAPIENTRY
3751 save_RasterPos2fv(const GLfloat
* v
)
3753 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3756 static void GLAPIENTRY
3757 save_RasterPos2iv(const GLint
* v
)
3759 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3762 static void GLAPIENTRY
3763 save_RasterPos2sv(const GLshort
* v
)
3765 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3768 static void GLAPIENTRY
3769 save_RasterPos3dv(const GLdouble
* v
)
3771 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3774 static void GLAPIENTRY
3775 save_RasterPos3fv(const GLfloat
* v
)
3777 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3780 static void GLAPIENTRY
3781 save_RasterPos3iv(const GLint
* v
)
3783 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3786 static void GLAPIENTRY
3787 save_RasterPos3sv(const GLshort
* v
)
3789 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3792 static void GLAPIENTRY
3793 save_RasterPos4dv(const GLdouble
* v
)
3795 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3796 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3799 static void GLAPIENTRY
3800 save_RasterPos4fv(const GLfloat
* v
)
3802 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3805 static void GLAPIENTRY
3806 save_RasterPos4iv(const GLint
* v
)
3808 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3809 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3812 static void GLAPIENTRY
3813 save_RasterPos4sv(const GLshort
* v
)
3815 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3819 static void GLAPIENTRY
3820 save_PassThrough(GLfloat token
)
3822 GET_CURRENT_CONTEXT(ctx
);
3824 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3825 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3829 if (ctx
->ExecuteFlag
) {
3830 CALL_PassThrough(ctx
->Exec
, (token
));
3835 static void GLAPIENTRY
3836 save_ReadBuffer(GLenum mode
)
3838 GET_CURRENT_CONTEXT(ctx
);
3840 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3841 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3845 if (ctx
->ExecuteFlag
) {
3846 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3851 static void GLAPIENTRY
3852 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3854 GET_CURRENT_CONTEXT(ctx
);
3856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3857 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3864 if (ctx
->ExecuteFlag
) {
3865 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3870 static void GLAPIENTRY
3871 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3873 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3877 static void GLAPIENTRY
3878 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3880 GET_CURRENT_CONTEXT(ctx
);
3882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3883 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3889 if (ctx
->ExecuteFlag
) {
3890 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3895 static void GLAPIENTRY
3896 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3898 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3902 static void GLAPIENTRY
3903 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3905 GET_CURRENT_CONTEXT(ctx
);
3907 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3908 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3915 if (ctx
->ExecuteFlag
) {
3916 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3921 static void GLAPIENTRY
3922 save_ShadeModel(GLenum mode
)
3924 GET_CURRENT_CONTEXT(ctx
);
3926 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3928 if (ctx
->ExecuteFlag
) {
3929 CALL_ShadeModel(ctx
->Exec
, (mode
));
3932 /* Don't compile this call if it's a no-op.
3933 * By avoiding this state change we have a better chance of
3934 * coalescing subsequent drawing commands into one batch.
3936 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3939 SAVE_FLUSH_VERTICES(ctx
);
3941 ctx
->ListState
.Current
.ShadeModel
= mode
;
3943 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3950 static void GLAPIENTRY
3951 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3953 GET_CURRENT_CONTEXT(ctx
);
3955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3956 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3962 if (ctx
->ExecuteFlag
) {
3963 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3968 static void GLAPIENTRY
3969 save_StencilMask(GLuint mask
)
3971 GET_CURRENT_CONTEXT(ctx
);
3973 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3974 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3978 if (ctx
->ExecuteFlag
) {
3979 CALL_StencilMask(ctx
->Exec
, (mask
));
3984 static void GLAPIENTRY
3985 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3987 GET_CURRENT_CONTEXT(ctx
);
3989 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3990 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3996 if (ctx
->ExecuteFlag
) {
3997 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
4002 static void GLAPIENTRY
4003 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
4005 GET_CURRENT_CONTEXT(ctx
);
4007 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4008 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
4015 if (ctx
->ExecuteFlag
) {
4016 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
4021 static void GLAPIENTRY
4022 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
4025 GET_CURRENT_CONTEXT(ctx
);
4027 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4029 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
4037 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
4044 if (ctx
->ExecuteFlag
) {
4045 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
4046 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
4051 static void GLAPIENTRY
4052 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
4054 GET_CURRENT_CONTEXT(ctx
);
4056 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4057 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
4062 if (ctx
->ExecuteFlag
) {
4063 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
4068 static void GLAPIENTRY
4069 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
4071 GET_CURRENT_CONTEXT(ctx
);
4073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4074 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
4081 if (ctx
->ExecuteFlag
) {
4082 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
4087 static void GLAPIENTRY
4088 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4090 GET_CURRENT_CONTEXT(ctx
);
4092 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4093 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
4097 if (pname
== GL_TEXTURE_ENV_COLOR
) {
4105 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
4108 if (ctx
->ExecuteFlag
) {
4109 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
4114 static void GLAPIENTRY
4115 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
4118 parray
[0] = (GLfloat
) param
;
4119 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4120 save_TexEnvfv(target
, pname
, parray
);
4124 static void GLAPIENTRY
4125 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
4128 p
[0] = (GLfloat
) param
;
4129 p
[1] = p
[2] = p
[3] = 0.0F
;
4130 save_TexEnvfv(target
, pname
, p
);
4134 static void GLAPIENTRY
4135 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
4138 if (pname
== GL_TEXTURE_ENV_COLOR
) {
4139 p
[0] = INT_TO_FLOAT(param
[0]);
4140 p
[1] = INT_TO_FLOAT(param
[1]);
4141 p
[2] = INT_TO_FLOAT(param
[2]);
4142 p
[3] = INT_TO_FLOAT(param
[3]);
4145 p
[0] = (GLfloat
) param
[0];
4146 p
[1] = p
[2] = p
[3] = 0.0F
;
4148 save_TexEnvfv(target
, pname
, p
);
4152 static void GLAPIENTRY
4153 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
4155 GET_CURRENT_CONTEXT(ctx
);
4157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4158 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
4167 if (ctx
->ExecuteFlag
) {
4168 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
4173 static void GLAPIENTRY
4174 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
4177 p
[0] = (GLfloat
) params
[0];
4178 p
[1] = (GLfloat
) params
[1];
4179 p
[2] = (GLfloat
) params
[2];
4180 p
[3] = (GLfloat
) params
[3];
4181 save_TexGenfv(coord
, pname
, p
);
4185 static void GLAPIENTRY
4186 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
4189 parray
[0] = (GLfloat
) param
;
4190 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4191 save_TexGenfv(coord
, pname
, parray
);
4195 static void GLAPIENTRY
4196 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
4199 p
[0] = (GLfloat
) params
[0];
4200 p
[1] = (GLfloat
) params
[1];
4201 p
[2] = (GLfloat
) params
[2];
4202 p
[3] = (GLfloat
) params
[3];
4203 save_TexGenfv(coord
, pname
, p
);
4207 static void GLAPIENTRY
4208 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
4212 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4213 save_TexGenfv(coord
, pname
, parray
);
4217 static void GLAPIENTRY
4218 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
4222 parray
[1] = parray
[2] = parray
[3] = 0;
4223 save_TexGeniv(coord
, pname
, parray
);
4227 static void GLAPIENTRY
4228 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4230 GET_CURRENT_CONTEXT(ctx
);
4232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4233 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
4242 if (ctx
->ExecuteFlag
) {
4243 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
4248 static void GLAPIENTRY
4249 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
4253 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4254 save_TexParameterfv(target
, pname
, parray
);
4258 static void GLAPIENTRY
4259 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
4262 fparam
[0] = (GLfloat
) param
;
4263 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4264 save_TexParameterfv(target
, pname
, fparam
);
4268 static void GLAPIENTRY
4269 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
4272 fparam
[0] = (GLfloat
) params
[0];
4273 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4274 save_TexParameterfv(target
, pname
, fparam
);
4278 static void GLAPIENTRY
4279 save_TexImage1D(GLenum target
,
4280 GLint level
, GLint components
,
4281 GLsizei width
, GLint border
,
4282 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4284 GET_CURRENT_CONTEXT(ctx
);
4285 if (target
== GL_PROXY_TEXTURE_1D
) {
4286 /* don't compile, execute immediately */
4287 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4288 border
, format
, type
, pixels
));
4292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4293 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
4297 n
[3].i
= components
;
4298 n
[4].i
= (GLint
) width
;
4303 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4304 pixels
, &ctx
->Unpack
));
4306 if (ctx
->ExecuteFlag
) {
4307 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4308 border
, format
, type
, pixels
));
4314 static void GLAPIENTRY
4315 save_TexImage2D(GLenum target
,
4316 GLint level
, GLint components
,
4317 GLsizei width
, GLsizei height
, GLint border
,
4318 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4320 GET_CURRENT_CONTEXT(ctx
);
4321 if (target
== GL_PROXY_TEXTURE_2D
) {
4322 /* don't compile, execute immediately */
4323 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4324 height
, border
, format
, type
, pixels
));
4328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4329 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
4333 n
[3].i
= components
;
4334 n
[4].i
= (GLint
) width
;
4335 n
[5].i
= (GLint
) height
;
4340 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4341 pixels
, &ctx
->Unpack
));
4343 if (ctx
->ExecuteFlag
) {
4344 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4345 height
, border
, format
, type
, pixels
));
4351 static void GLAPIENTRY
4352 save_TexImage3D(GLenum target
,
4353 GLint level
, GLint internalFormat
,
4354 GLsizei width
, GLsizei height
, GLsizei depth
,
4356 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4358 GET_CURRENT_CONTEXT(ctx
);
4359 if (target
== GL_PROXY_TEXTURE_3D
) {
4360 /* don't compile, execute immediately */
4361 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4362 height
, depth
, border
, format
, type
,
4367 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4368 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
4372 n
[3].i
= (GLint
) internalFormat
;
4373 n
[4].i
= (GLint
) width
;
4374 n
[5].i
= (GLint
) height
;
4375 n
[6].i
= (GLint
) depth
;
4379 save_pointer(&n
[10],
4380 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4381 pixels
, &ctx
->Unpack
));
4383 if (ctx
->ExecuteFlag
) {
4384 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4385 height
, depth
, border
, format
, type
,
4392 static void GLAPIENTRY
4393 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4394 GLsizei width
, GLenum format
, GLenum type
,
4395 const GLvoid
* pixels
)
4397 GET_CURRENT_CONTEXT(ctx
);
4400 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4402 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
4407 n
[4].i
= (GLint
) width
;
4411 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4412 pixels
, &ctx
->Unpack
));
4414 if (ctx
->ExecuteFlag
) {
4415 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4416 format
, type
, pixels
));
4421 static void GLAPIENTRY
4422 save_TexSubImage2D(GLenum target
, GLint level
,
4423 GLint xoffset
, GLint yoffset
,
4424 GLsizei width
, GLsizei height
,
4425 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4427 GET_CURRENT_CONTEXT(ctx
);
4430 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4432 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
4438 n
[5].i
= (GLint
) width
;
4439 n
[6].i
= (GLint
) height
;
4443 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4444 pixels
, &ctx
->Unpack
));
4446 if (ctx
->ExecuteFlag
) {
4447 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4448 width
, height
, format
, type
, pixels
));
4453 static void GLAPIENTRY
4454 save_TexSubImage3D(GLenum target
, GLint level
,
4455 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4456 GLsizei width
, GLsizei height
, GLsizei depth
,
4457 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4459 GET_CURRENT_CONTEXT(ctx
);
4462 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4464 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4471 n
[6].i
= (GLint
) width
;
4472 n
[7].i
= (GLint
) height
;
4473 n
[8].i
= (GLint
) depth
;
4476 save_pointer(&n
[11],
4477 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4478 pixels
, &ctx
->Unpack
));
4480 if (ctx
->ExecuteFlag
) {
4481 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4482 xoffset
, yoffset
, zoffset
,
4483 width
, height
, depth
, format
, type
,
4489 static void GLAPIENTRY
4490 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4492 GET_CURRENT_CONTEXT(ctx
);
4494 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4495 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4501 if (ctx
->ExecuteFlag
) {
4502 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4507 static void GLAPIENTRY
4508 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4510 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4515 static void GLAPIENTRY
4516 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4518 GET_CURRENT_CONTEXT(ctx
);
4520 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4521 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4525 n
[3].i
= (GLint
) width
;
4526 n
[4].i
= (GLint
) height
;
4528 if (ctx
->ExecuteFlag
) {
4529 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4534 static void GLAPIENTRY
4535 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4537 GET_CURRENT_CONTEXT(ctx
);
4539 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4540 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4547 if (ctx
->ExecuteFlag
) {
4548 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4552 static void GLAPIENTRY
4553 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4555 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4558 static void GLAPIENTRY
4559 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4561 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4564 static void GLAPIENTRY
4565 save_WindowPos2iMESA(GLint x
, GLint y
)
4567 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4570 static void GLAPIENTRY
4571 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4573 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4576 static void GLAPIENTRY
4577 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4579 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4582 static void GLAPIENTRY
4583 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4585 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4588 static void GLAPIENTRY
4589 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4591 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4594 static void GLAPIENTRY
4595 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4597 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4600 static void GLAPIENTRY
4601 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4603 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4606 static void GLAPIENTRY
4607 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4609 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4612 static void GLAPIENTRY
4613 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4615 save_WindowPos4fMESA(x
, y
, z
, w
);
4618 static void GLAPIENTRY
4619 save_WindowPos2dvMESA(const GLdouble
* v
)
4621 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4624 static void GLAPIENTRY
4625 save_WindowPos2fvMESA(const GLfloat
* v
)
4627 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4630 static void GLAPIENTRY
4631 save_WindowPos2ivMESA(const GLint
* v
)
4633 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4636 static void GLAPIENTRY
4637 save_WindowPos2svMESA(const GLshort
* v
)
4639 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4642 static void GLAPIENTRY
4643 save_WindowPos3dvMESA(const GLdouble
* v
)
4645 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4648 static void GLAPIENTRY
4649 save_WindowPos3fvMESA(const GLfloat
* v
)
4651 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4654 static void GLAPIENTRY
4655 save_WindowPos3ivMESA(const GLint
* v
)
4657 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4660 static void GLAPIENTRY
4661 save_WindowPos3svMESA(const GLshort
* v
)
4663 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4666 static void GLAPIENTRY
4667 save_WindowPos4dvMESA(const GLdouble
* v
)
4669 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4670 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4673 static void GLAPIENTRY
4674 save_WindowPos4fvMESA(const GLfloat
* v
)
4676 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4679 static void GLAPIENTRY
4680 save_WindowPos4ivMESA(const GLint
* v
)
4682 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4683 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4686 static void GLAPIENTRY
4687 save_WindowPos4svMESA(const GLshort
* v
)
4689 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4694 /* GL_ARB_multitexture */
4695 static void GLAPIENTRY
4696 save_ActiveTextureARB(GLenum target
)
4698 GET_CURRENT_CONTEXT(ctx
);
4700 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4701 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4705 if (ctx
->ExecuteFlag
) {
4706 CALL_ActiveTexture(ctx
->Exec
, (target
));
4711 /* GL_ARB_transpose_matrix */
4713 static void GLAPIENTRY
4714 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4717 _math_transposefd(tm
, m
);
4718 save_LoadMatrixf(tm
);
4722 static void GLAPIENTRY
4723 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4726 _math_transposef(tm
, m
);
4727 save_LoadMatrixf(tm
);
4731 static void GLAPIENTRY
4732 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4735 _math_transposefd(tm
, m
);
4736 save_MultMatrixf(tm
);
4740 static void GLAPIENTRY
4741 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4744 _math_transposef(tm
, m
);
4745 save_MultMatrixf(tm
);
4748 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4750 GET_CURRENT_CONTEXT(ctx
);
4756 image
= malloc(size
);
4758 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4761 memcpy(image
, data
, size
);
4767 /* GL_ARB_texture_compression */
4768 static void GLAPIENTRY
4769 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4770 GLenum internalFormat
, GLsizei width
,
4771 GLint border
, GLsizei imageSize
,
4772 const GLvoid
* data
)
4774 GET_CURRENT_CONTEXT(ctx
);
4775 if (target
== GL_PROXY_TEXTURE_1D
) {
4776 /* don't compile, execute immediately */
4777 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4778 width
, border
, imageSize
,
4783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4785 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4786 6 + POINTER_DWORDS
);
4790 n
[3].e
= internalFormat
;
4791 n
[4].i
= (GLint
) width
;
4795 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4797 if (ctx
->ExecuteFlag
) {
4798 CALL_CompressedTexImage1D(ctx
->Exec
,
4799 (target
, level
, internalFormat
, width
,
4800 border
, imageSize
, data
));
4806 static void GLAPIENTRY
4807 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4808 GLenum internalFormat
, GLsizei width
,
4809 GLsizei height
, GLint border
, GLsizei imageSize
,
4810 const GLvoid
* data
)
4812 GET_CURRENT_CONTEXT(ctx
);
4813 if (target
== GL_PROXY_TEXTURE_2D
) {
4814 /* don't compile, execute immediately */
4815 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4816 width
, height
, border
,
4821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4823 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4824 7 + POINTER_DWORDS
);
4828 n
[3].e
= internalFormat
;
4829 n
[4].i
= (GLint
) width
;
4830 n
[5].i
= (GLint
) height
;
4834 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4836 if (ctx
->ExecuteFlag
) {
4837 CALL_CompressedTexImage2D(ctx
->Exec
,
4838 (target
, level
, internalFormat
, width
,
4839 height
, border
, imageSize
, data
));
4845 static void GLAPIENTRY
4846 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4847 GLenum internalFormat
, GLsizei width
,
4848 GLsizei height
, GLsizei depth
, GLint border
,
4849 GLsizei imageSize
, const GLvoid
* data
)
4851 GET_CURRENT_CONTEXT(ctx
);
4852 if (target
== GL_PROXY_TEXTURE_3D
) {
4853 /* don't compile, execute immediately */
4854 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4855 width
, height
, depth
, border
,
4860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4862 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4863 8 + POINTER_DWORDS
);
4867 n
[3].e
= internalFormat
;
4868 n
[4].i
= (GLint
) width
;
4869 n
[5].i
= (GLint
) height
;
4870 n
[6].i
= (GLint
) depth
;
4874 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4876 if (ctx
->ExecuteFlag
) {
4877 CALL_CompressedTexImage3D(ctx
->Exec
,
4878 (target
, level
, internalFormat
, width
,
4879 height
, depth
, border
, imageSize
,
4886 static void GLAPIENTRY
4887 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4888 GLsizei width
, GLenum format
,
4889 GLsizei imageSize
, const GLvoid
* data
)
4892 GET_CURRENT_CONTEXT(ctx
);
4893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4895 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4896 6 + POINTER_DWORDS
);
4901 n
[4].i
= (GLint
) width
;
4905 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4907 if (ctx
->ExecuteFlag
) {
4908 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4909 width
, format
, imageSize
,
4915 static void GLAPIENTRY
4916 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4917 GLint yoffset
, GLsizei width
, GLsizei height
,
4918 GLenum format
, GLsizei imageSize
,
4919 const GLvoid
* data
)
4922 GET_CURRENT_CONTEXT(ctx
);
4923 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4925 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4926 8 + POINTER_DWORDS
);
4932 n
[5].i
= (GLint
) width
;
4933 n
[6].i
= (GLint
) height
;
4937 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4939 if (ctx
->ExecuteFlag
) {
4940 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4941 (target
, level
, xoffset
, yoffset
, width
,
4942 height
, format
, imageSize
, data
));
4947 static void GLAPIENTRY
4948 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4949 GLint yoffset
, GLint zoffset
, GLsizei width
,
4950 GLsizei height
, GLsizei depth
, GLenum format
,
4951 GLsizei imageSize
, const GLvoid
* data
)
4954 GET_CURRENT_CONTEXT(ctx
);
4955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4957 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4958 10 + POINTER_DWORDS
);
4965 n
[6].i
= (GLint
) width
;
4966 n
[7].i
= (GLint
) height
;
4967 n
[8].i
= (GLint
) depth
;
4969 n
[10].i
= imageSize
;
4970 save_pointer(&n
[11],
4971 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4973 if (ctx
->ExecuteFlag
) {
4974 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4975 (target
, level
, xoffset
, yoffset
,
4976 zoffset
, width
, height
, depth
, format
,
4982 /* GL_ARB_multisample */
4983 static void GLAPIENTRY
4984 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4986 GET_CURRENT_CONTEXT(ctx
);
4988 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4989 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4994 if (ctx
->ExecuteFlag
) {
4995 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
5001 * GL_ARB_vertex_program
5003 static void GLAPIENTRY
5004 save_BindProgramARB(GLenum target
, GLuint id
)
5006 GET_CURRENT_CONTEXT(ctx
);
5008 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5009 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_ARB
, 2);
5014 if (ctx
->ExecuteFlag
) {
5015 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
5019 static void GLAPIENTRY
5020 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
5021 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5023 GET_CURRENT_CONTEXT(ctx
);
5025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5026 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
5035 if (ctx
->ExecuteFlag
) {
5036 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5041 static void GLAPIENTRY
5042 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
5043 const GLfloat
*params
)
5045 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
5046 params
[2], params
[3]);
5050 static void GLAPIENTRY
5051 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
5052 const GLfloat
* params
)
5054 GET_CURRENT_CONTEXT(ctx
);
5056 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5060 const GLfloat
* p
= params
;
5062 for (i
= 0 ; i
< count
; i
++) {
5063 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
5076 if (ctx
->ExecuteFlag
) {
5077 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5082 static void GLAPIENTRY
5083 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
5084 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
5086 save_ProgramEnvParameter4fARB(target
, index
,
5088 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
5092 static void GLAPIENTRY
5093 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
5094 const GLdouble
*params
)
5096 save_ProgramEnvParameter4fARB(target
, index
,
5097 (GLfloat
) params
[0],
5098 (GLfloat
) params
[1],
5099 (GLfloat
) params
[2], (GLfloat
) params
[3]);
5103 static void GLAPIENTRY
5104 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
5105 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5107 GET_CURRENT_CONTEXT(ctx
);
5109 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5110 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5119 if (ctx
->ExecuteFlag
) {
5120 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5125 static void GLAPIENTRY
5126 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
5127 const GLfloat
*params
)
5129 GET_CURRENT_CONTEXT(ctx
);
5131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5132 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5141 if (ctx
->ExecuteFlag
) {
5142 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
5147 static void GLAPIENTRY
5148 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
5149 const GLfloat
*params
)
5151 GET_CURRENT_CONTEXT(ctx
);
5153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5157 const GLfloat
* p
= params
;
5159 for (i
= 0 ; i
< count
; i
++) {
5160 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5173 if (ctx
->ExecuteFlag
) {
5174 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5179 static void GLAPIENTRY
5180 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
5181 GLdouble x
, GLdouble y
,
5182 GLdouble z
, GLdouble w
)
5184 GET_CURRENT_CONTEXT(ctx
);
5186 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5187 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5191 n
[3].f
= (GLfloat
) x
;
5192 n
[4].f
= (GLfloat
) y
;
5193 n
[5].f
= (GLfloat
) z
;
5194 n
[6].f
= (GLfloat
) w
;
5196 if (ctx
->ExecuteFlag
) {
5197 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5202 static void GLAPIENTRY
5203 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
5204 const GLdouble
*params
)
5206 GET_CURRENT_CONTEXT(ctx
);
5208 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5209 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5213 n
[3].f
= (GLfloat
) params
[0];
5214 n
[4].f
= (GLfloat
) params
[1];
5215 n
[5].f
= (GLfloat
) params
[2];
5216 n
[6].f
= (GLfloat
) params
[3];
5218 if (ctx
->ExecuteFlag
) {
5219 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
5224 /* GL_EXT_stencil_two_side */
5225 static void GLAPIENTRY
5226 save_ActiveStencilFaceEXT(GLenum face
)
5228 GET_CURRENT_CONTEXT(ctx
);
5230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5231 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
5235 if (ctx
->ExecuteFlag
) {
5236 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
5241 /* GL_EXT_depth_bounds_test */
5242 static void GLAPIENTRY
5243 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
5245 GET_CURRENT_CONTEXT(ctx
);
5247 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5248 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
5250 n
[1].f
= (GLfloat
) zmin
;
5251 n
[2].f
= (GLfloat
) zmax
;
5253 if (ctx
->ExecuteFlag
) {
5254 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
5260 static void GLAPIENTRY
5261 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
5262 const GLvoid
* string
)
5264 GET_CURRENT_CONTEXT(ctx
);
5267 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5269 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
5271 GLubyte
*programCopy
= malloc(len
);
5273 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
5276 memcpy(programCopy
, string
, len
);
5280 save_pointer(&n
[4], programCopy
);
5282 if (ctx
->ExecuteFlag
) {
5283 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
5288 static void GLAPIENTRY
5289 save_BeginQueryARB(GLenum target
, GLuint id
)
5291 GET_CURRENT_CONTEXT(ctx
);
5293 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5294 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
5299 if (ctx
->ExecuteFlag
) {
5300 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
5304 static void GLAPIENTRY
5305 save_EndQueryARB(GLenum target
)
5307 GET_CURRENT_CONTEXT(ctx
);
5309 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5310 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
5314 if (ctx
->ExecuteFlag
) {
5315 CALL_EndQuery(ctx
->Exec
, (target
));
5319 static void GLAPIENTRY
5320 save_QueryCounter(GLuint id
, GLenum target
)
5322 GET_CURRENT_CONTEXT(ctx
);
5324 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5325 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
5330 if (ctx
->ExecuteFlag
) {
5331 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
5335 static void GLAPIENTRY
5336 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
5338 GET_CURRENT_CONTEXT(ctx
);
5340 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5341 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
5347 if (ctx
->ExecuteFlag
) {
5348 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5352 static void GLAPIENTRY
5353 save_EndQueryIndexed(GLenum target
, GLuint index
)
5355 GET_CURRENT_CONTEXT(ctx
);
5357 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5358 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5363 if (ctx
->ExecuteFlag
) {
5364 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5369 static void GLAPIENTRY
5370 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5372 GET_CURRENT_CONTEXT(ctx
);
5374 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5375 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5379 if (count
> MAX_DRAW_BUFFERS
)
5380 count
= MAX_DRAW_BUFFERS
;
5381 for (i
= 0; i
< count
; i
++) {
5382 n
[2 + i
].e
= buffers
[i
];
5385 if (ctx
->ExecuteFlag
) {
5386 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5390 static void GLAPIENTRY
5391 save_BindFragmentShaderATI(GLuint id
)
5393 GET_CURRENT_CONTEXT(ctx
);
5396 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5400 if (ctx
->ExecuteFlag
) {
5401 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5405 static void GLAPIENTRY
5406 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5408 GET_CURRENT_CONTEXT(ctx
);
5411 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5419 if (ctx
->ExecuteFlag
) {
5420 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5424 static void GLAPIENTRY
5425 save_Attr1fNV(GLenum attr
, GLfloat x
)
5427 GET_CURRENT_CONTEXT(ctx
);
5429 SAVE_FLUSH_VERTICES(ctx
);
5430 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5436 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5437 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5438 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5440 if (ctx
->ExecuteFlag
) {
5441 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5445 static void GLAPIENTRY
5446 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5448 GET_CURRENT_CONTEXT(ctx
);
5450 SAVE_FLUSH_VERTICES(ctx
);
5451 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5458 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5459 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5460 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5462 if (ctx
->ExecuteFlag
) {
5463 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5467 static void GLAPIENTRY
5468 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5470 GET_CURRENT_CONTEXT(ctx
);
5472 SAVE_FLUSH_VERTICES(ctx
);
5473 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5481 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5482 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5483 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5485 if (ctx
->ExecuteFlag
) {
5486 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5490 static void GLAPIENTRY
5491 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5493 GET_CURRENT_CONTEXT(ctx
);
5495 SAVE_FLUSH_VERTICES(ctx
);
5496 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5505 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5506 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5507 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5509 if (ctx
->ExecuteFlag
) {
5510 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5515 static void GLAPIENTRY
5516 save_Attr1fARB(GLenum attr
, GLfloat x
)
5518 GET_CURRENT_CONTEXT(ctx
);
5520 SAVE_FLUSH_VERTICES(ctx
);
5521 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5527 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5528 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5529 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5531 if (ctx
->ExecuteFlag
) {
5532 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5536 static void GLAPIENTRY
5537 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5539 GET_CURRENT_CONTEXT(ctx
);
5541 SAVE_FLUSH_VERTICES(ctx
);
5542 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5549 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5550 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5551 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5553 if (ctx
->ExecuteFlag
) {
5554 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5558 static void GLAPIENTRY
5559 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5561 GET_CURRENT_CONTEXT(ctx
);
5563 SAVE_FLUSH_VERTICES(ctx
);
5564 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5572 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5573 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5574 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5576 if (ctx
->ExecuteFlag
) {
5577 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5581 static void GLAPIENTRY
5582 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5584 GET_CURRENT_CONTEXT(ctx
);
5586 SAVE_FLUSH_VERTICES(ctx
);
5587 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5596 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5597 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5598 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5600 if (ctx
->ExecuteFlag
) {
5601 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5606 static void GLAPIENTRY
5607 save_EvalCoord1f(GLfloat x
)
5609 GET_CURRENT_CONTEXT(ctx
);
5611 SAVE_FLUSH_VERTICES(ctx
);
5612 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5616 if (ctx
->ExecuteFlag
) {
5617 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5621 static void GLAPIENTRY
5622 save_EvalCoord1fv(const GLfloat
* v
)
5624 save_EvalCoord1f(v
[0]);
5627 static void GLAPIENTRY
5628 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5630 GET_CURRENT_CONTEXT(ctx
);
5632 SAVE_FLUSH_VERTICES(ctx
);
5633 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5638 if (ctx
->ExecuteFlag
) {
5639 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5643 static void GLAPIENTRY
5644 save_EvalCoord2fv(const GLfloat
* v
)
5646 save_EvalCoord2f(v
[0], v
[1]);
5650 static void GLAPIENTRY
5651 save_EvalPoint1(GLint x
)
5653 GET_CURRENT_CONTEXT(ctx
);
5655 SAVE_FLUSH_VERTICES(ctx
);
5656 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5660 if (ctx
->ExecuteFlag
) {
5661 CALL_EvalPoint1(ctx
->Exec
, (x
));
5665 static void GLAPIENTRY
5666 save_EvalPoint2(GLint x
, GLint y
)
5668 GET_CURRENT_CONTEXT(ctx
);
5670 SAVE_FLUSH_VERTICES(ctx
);
5671 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5676 if (ctx
->ExecuteFlag
) {
5677 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5681 static void GLAPIENTRY
5682 save_Indexf(GLfloat x
)
5684 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5687 static void GLAPIENTRY
5688 save_Indexfv(const GLfloat
* v
)
5690 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5693 static void GLAPIENTRY
5694 save_EdgeFlag(GLboolean x
)
5696 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5701 * Compare 'count' elements of vectors 'a' and 'b'.
5702 * \return GL_TRUE if equal, GL_FALSE if different.
5704 static inline GLboolean
5705 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5707 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5712 * This glMaterial function is used for glMaterial calls that are outside
5713 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5715 static void GLAPIENTRY
5716 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5718 GET_CURRENT_CONTEXT(ctx
);
5726 case GL_FRONT_AND_BACK
:
5729 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5738 case GL_AMBIENT_AND_DIFFUSE
:
5744 case GL_COLOR_INDEXES
:
5748 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5752 if (ctx
->ExecuteFlag
) {
5753 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5756 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5758 /* Try to eliminate redundant statechanges. Because it is legal to
5759 * call glMaterial even inside begin/end calls, don't need to worry
5760 * about ctx->Driver.CurrentSavePrimitive here.
5762 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5763 if (bitmask
& (1 << i
)) {
5764 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5765 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5766 /* no change in material value */
5767 bitmask
&= ~(1 << i
);
5770 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5771 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5776 /* If this call has no effect, return early */
5780 SAVE_FLUSH_VERTICES(ctx
);
5782 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5786 for (i
= 0; i
< args
; i
++)
5787 n
[3 + i
].f
= param
[i
];
5791 static void GLAPIENTRY
5792 save_Begin(GLenum mode
)
5794 GET_CURRENT_CONTEXT(ctx
);
5796 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5797 /* compile this error into the display list */
5798 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5800 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5801 /* compile this error into the display list */
5802 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5805 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5807 vbo_save_NotifyBegin(ctx
, mode
);
5811 static void GLAPIENTRY
5814 GET_CURRENT_CONTEXT(ctx
);
5815 SAVE_FLUSH_VERTICES(ctx
);
5816 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5817 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5818 if (ctx
->ExecuteFlag
) {
5819 CALL_End(ctx
->Exec
, ());
5823 static void GLAPIENTRY
5824 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5826 GET_CURRENT_CONTEXT(ctx
);
5828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5829 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5836 if (ctx
->ExecuteFlag
) {
5837 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5842 static void GLAPIENTRY
5843 save_Vertex2f(GLfloat x
, GLfloat y
)
5845 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5848 static void GLAPIENTRY
5849 save_Vertex2fv(const GLfloat
* v
)
5851 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5854 static void GLAPIENTRY
5855 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5857 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5860 static void GLAPIENTRY
5861 save_Vertex3fv(const GLfloat
* v
)
5863 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5866 static void GLAPIENTRY
5867 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5869 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5872 static void GLAPIENTRY
5873 save_Vertex4fv(const GLfloat
* v
)
5875 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5878 static void GLAPIENTRY
5879 save_TexCoord1f(GLfloat x
)
5881 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5884 static void GLAPIENTRY
5885 save_TexCoord1fv(const GLfloat
* v
)
5887 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5890 static void GLAPIENTRY
5891 save_TexCoord2f(GLfloat x
, GLfloat y
)
5893 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5896 static void GLAPIENTRY
5897 save_TexCoord2fv(const GLfloat
* v
)
5899 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5902 static void GLAPIENTRY
5903 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5905 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5908 static void GLAPIENTRY
5909 save_TexCoord3fv(const GLfloat
* v
)
5911 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5914 static void GLAPIENTRY
5915 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5917 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5920 static void GLAPIENTRY
5921 save_TexCoord4fv(const GLfloat
* v
)
5923 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5926 static void GLAPIENTRY
5927 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5929 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5932 static void GLAPIENTRY
5933 save_Normal3fv(const GLfloat
* v
)
5935 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5938 static void GLAPIENTRY
5939 save_FogCoordfEXT(GLfloat x
)
5941 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5944 static void GLAPIENTRY
5945 save_FogCoordfvEXT(const GLfloat
* v
)
5947 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5950 static void GLAPIENTRY
5951 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5953 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5956 static void GLAPIENTRY
5957 save_Color3fv(const GLfloat
* v
)
5959 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5962 static void GLAPIENTRY
5963 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5965 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5968 static void GLAPIENTRY
5969 save_Color4fv(const GLfloat
* v
)
5971 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5974 static void GLAPIENTRY
5975 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5977 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5980 static void GLAPIENTRY
5981 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5983 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5987 /* Just call the respective ATTR for texcoord
5989 static void GLAPIENTRY
5990 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5992 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5993 save_Attr1fNV(attr
, x
);
5996 static void GLAPIENTRY
5997 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5999 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6000 save_Attr1fNV(attr
, v
[0]);
6003 static void GLAPIENTRY
6004 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
6006 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6007 save_Attr2fNV(attr
, x
, y
);
6010 static void GLAPIENTRY
6011 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
6013 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6014 save_Attr2fNV(attr
, v
[0], v
[1]);
6017 static void GLAPIENTRY
6018 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
6020 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6021 save_Attr3fNV(attr
, x
, y
, z
);
6024 static void GLAPIENTRY
6025 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
6027 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6028 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
6031 static void GLAPIENTRY
6032 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
6033 GLfloat z
, GLfloat w
)
6035 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6036 save_Attr4fNV(attr
, x
, y
, z
, w
);
6039 static void GLAPIENTRY
6040 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
6042 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6043 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
6048 * Record a GL_INVALID_VALUE error when an invalid vertex attribute
6054 GET_CURRENT_CONTEXT(ctx
);
6055 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
6060 static void GLAPIENTRY
6061 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
6063 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6064 save_Attr1fARB(index
, x
);
6069 static void GLAPIENTRY
6070 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
6072 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6073 save_Attr1fARB(index
, v
[0]);
6078 static void GLAPIENTRY
6079 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
6081 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6082 save_Attr2fARB(index
, x
, y
);
6087 static void GLAPIENTRY
6088 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
6090 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6091 save_Attr2fARB(index
, v
[0], v
[1]);
6096 static void GLAPIENTRY
6097 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
6099 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6100 save_Attr3fARB(index
, x
, y
, z
);
6105 static void GLAPIENTRY
6106 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
6108 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6109 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
6114 static void GLAPIENTRY
6115 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
6118 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6119 save_Attr4fARB(index
, x
, y
, z
, w
);
6124 static void GLAPIENTRY
6125 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
6127 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6128 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
6133 static void GLAPIENTRY
6134 save_PrimitiveRestartNV(void)
6136 /* Note: this is used when outside a glBegin/End pair in a display list */
6137 GET_CURRENT_CONTEXT(ctx
);
6138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6139 (void) alloc_instruction(ctx
, OPCODE_PRIMITIVE_RESTART_NV
, 0);
6140 if (ctx
->ExecuteFlag
) {
6141 CALL_PrimitiveRestartNV(ctx
->Exec
, ());
6146 static void GLAPIENTRY
6147 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
6148 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
6149 GLbitfield mask
, GLenum filter
)
6151 GET_CURRENT_CONTEXT(ctx
);
6153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6154 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
6167 if (ctx
->ExecuteFlag
) {
6168 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
6169 dstX0
, dstY0
, dstX1
, dstY1
,
6175 /** GL_EXT_provoking_vertex */
6176 static void GLAPIENTRY
6177 save_ProvokingVertexEXT(GLenum mode
)
6179 GET_CURRENT_CONTEXT(ctx
);
6181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6182 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
6186 if (ctx
->ExecuteFlag
) {
6187 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6188 _mesa_ProvokingVertex(mode
);
6193 /** GL_EXT_transform_feedback */
6194 static void GLAPIENTRY
6195 save_BeginTransformFeedback(GLenum mode
)
6197 GET_CURRENT_CONTEXT(ctx
);
6199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6200 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
6204 if (ctx
->ExecuteFlag
) {
6205 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
6210 /** GL_EXT_transform_feedback */
6211 static void GLAPIENTRY
6212 save_EndTransformFeedback(void)
6214 GET_CURRENT_CONTEXT(ctx
);
6215 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6216 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
6217 if (ctx
->ExecuteFlag
) {
6218 CALL_EndTransformFeedback(ctx
->Exec
, ());
6222 static void GLAPIENTRY
6223 save_BindTransformFeedback(GLenum target
, GLuint name
)
6225 GET_CURRENT_CONTEXT(ctx
);
6227 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6228 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
6233 if (ctx
->ExecuteFlag
) {
6234 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
6238 static void GLAPIENTRY
6239 save_PauseTransformFeedback(void)
6241 GET_CURRENT_CONTEXT(ctx
);
6242 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6243 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
6244 if (ctx
->ExecuteFlag
) {
6245 CALL_PauseTransformFeedback(ctx
->Exec
, ());
6249 static void GLAPIENTRY
6250 save_ResumeTransformFeedback(void)
6252 GET_CURRENT_CONTEXT(ctx
);
6253 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6254 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
6255 if (ctx
->ExecuteFlag
) {
6256 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
6260 static void GLAPIENTRY
6261 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
6263 GET_CURRENT_CONTEXT(ctx
);
6265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6266 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
6271 if (ctx
->ExecuteFlag
) {
6272 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
6276 static void GLAPIENTRY
6277 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
6279 GET_CURRENT_CONTEXT(ctx
);
6281 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6282 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
6288 if (ctx
->ExecuteFlag
) {
6289 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
6293 static void GLAPIENTRY
6294 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
6297 GET_CURRENT_CONTEXT(ctx
);
6299 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6300 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
6304 n
[3].si
= primcount
;
6306 if (ctx
->ExecuteFlag
) {
6307 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
6311 static void GLAPIENTRY
6312 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
6313 GLuint stream
, GLsizei primcount
)
6315 GET_CURRENT_CONTEXT(ctx
);
6317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6318 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
6323 n
[4].si
= primcount
;
6325 if (ctx
->ExecuteFlag
) {
6326 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
6331 static void GLAPIENTRY
6332 save_UseProgram(GLuint program
)
6334 GET_CURRENT_CONTEXT(ctx
);
6336 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6337 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
6341 if (ctx
->ExecuteFlag
) {
6342 CALL_UseProgram(ctx
->Exec
, (program
));
6347 static void GLAPIENTRY
6348 save_Uniform1fARB(GLint location
, GLfloat x
)
6350 GET_CURRENT_CONTEXT(ctx
);
6352 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6353 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6358 if (ctx
->ExecuteFlag
) {
6359 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6364 static void GLAPIENTRY
6365 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6367 GET_CURRENT_CONTEXT(ctx
);
6369 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6370 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6376 if (ctx
->ExecuteFlag
) {
6377 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6382 static void GLAPIENTRY
6383 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6385 GET_CURRENT_CONTEXT(ctx
);
6387 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6388 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6395 if (ctx
->ExecuteFlag
) {
6396 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6401 static void GLAPIENTRY
6402 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6404 GET_CURRENT_CONTEXT(ctx
);
6406 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6407 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6415 if (ctx
->ExecuteFlag
) {
6416 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6421 static void GLAPIENTRY
6422 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6424 GET_CURRENT_CONTEXT(ctx
);
6426 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6427 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
6431 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6433 if (ctx
->ExecuteFlag
) {
6434 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6438 static void GLAPIENTRY
6439 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6441 GET_CURRENT_CONTEXT(ctx
);
6443 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6444 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6448 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6450 if (ctx
->ExecuteFlag
) {
6451 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6455 static void GLAPIENTRY
6456 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6458 GET_CURRENT_CONTEXT(ctx
);
6460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6461 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6465 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6467 if (ctx
->ExecuteFlag
) {
6468 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6472 static void GLAPIENTRY
6473 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6475 GET_CURRENT_CONTEXT(ctx
);
6477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6478 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6482 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6484 if (ctx
->ExecuteFlag
) {
6485 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6490 static void GLAPIENTRY
6491 save_Uniform1iARB(GLint location
, GLint x
)
6493 GET_CURRENT_CONTEXT(ctx
);
6495 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6496 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6501 if (ctx
->ExecuteFlag
) {
6502 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6506 static void GLAPIENTRY
6507 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6509 GET_CURRENT_CONTEXT(ctx
);
6511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6512 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6518 if (ctx
->ExecuteFlag
) {
6519 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6523 static void GLAPIENTRY
6524 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6526 GET_CURRENT_CONTEXT(ctx
);
6528 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6529 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6536 if (ctx
->ExecuteFlag
) {
6537 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6541 static void GLAPIENTRY
6542 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6544 GET_CURRENT_CONTEXT(ctx
);
6546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6547 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6555 if (ctx
->ExecuteFlag
) {
6556 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6562 static void GLAPIENTRY
6563 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6565 GET_CURRENT_CONTEXT(ctx
);
6567 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6568 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6572 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6574 if (ctx
->ExecuteFlag
) {
6575 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6579 static void GLAPIENTRY
6580 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6582 GET_CURRENT_CONTEXT(ctx
);
6584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6585 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6589 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6591 if (ctx
->ExecuteFlag
) {
6592 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6596 static void GLAPIENTRY
6597 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6599 GET_CURRENT_CONTEXT(ctx
);
6601 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6602 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6606 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6608 if (ctx
->ExecuteFlag
) {
6609 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6613 static void GLAPIENTRY
6614 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6616 GET_CURRENT_CONTEXT(ctx
);
6618 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6619 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6623 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6625 if (ctx
->ExecuteFlag
) {
6626 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6632 static void GLAPIENTRY
6633 save_Uniform1ui(GLint location
, GLuint x
)
6635 GET_CURRENT_CONTEXT(ctx
);
6637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6638 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6643 if (ctx
->ExecuteFlag
) {
6644 CALL_Uniform1ui(ctx
->Exec
, (location
, x
));
6648 static void GLAPIENTRY
6649 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6651 GET_CURRENT_CONTEXT(ctx
);
6653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6654 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6660 if (ctx
->ExecuteFlag
) {
6661 CALL_Uniform2ui(ctx
->Exec
, (location
, x
, y
));
6665 static void GLAPIENTRY
6666 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6668 GET_CURRENT_CONTEXT(ctx
);
6670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6671 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6678 if (ctx
->ExecuteFlag
) {
6679 CALL_Uniform3ui(ctx
->Exec
, (location
, x
, y
, z
));
6683 static void GLAPIENTRY
6684 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6686 GET_CURRENT_CONTEXT(ctx
);
6688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6689 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6697 if (ctx
->ExecuteFlag
) {
6698 CALL_Uniform4ui(ctx
->Exec
, (location
, x
, y
, z
, w
));
6704 static void GLAPIENTRY
6705 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6707 GET_CURRENT_CONTEXT(ctx
);
6709 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6710 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6714 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6716 if (ctx
->ExecuteFlag
) {
6717 CALL_Uniform1uiv(ctx
->Exec
, (location
, count
, v
));
6721 static void GLAPIENTRY
6722 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6724 GET_CURRENT_CONTEXT(ctx
);
6726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6727 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6731 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6733 if (ctx
->ExecuteFlag
) {
6734 CALL_Uniform2uiv(ctx
->Exec
, (location
, count
, v
));
6738 static void GLAPIENTRY
6739 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6741 GET_CURRENT_CONTEXT(ctx
);
6743 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6744 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6748 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6750 if (ctx
->ExecuteFlag
) {
6751 CALL_Uniform3uiv(ctx
->Exec
, (location
, count
, v
));
6755 static void GLAPIENTRY
6756 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6758 GET_CURRENT_CONTEXT(ctx
);
6760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6761 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6765 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6767 if (ctx
->ExecuteFlag
) {
6768 CALL_Uniform4uiv(ctx
->Exec
, (location
, count
, v
));
6774 static void GLAPIENTRY
6775 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6778 GET_CURRENT_CONTEXT(ctx
);
6780 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6781 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6786 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6788 if (ctx
->ExecuteFlag
) {
6789 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6793 static void GLAPIENTRY
6794 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6797 GET_CURRENT_CONTEXT(ctx
);
6799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6800 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6805 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6807 if (ctx
->ExecuteFlag
) {
6808 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6812 static void GLAPIENTRY
6813 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6816 GET_CURRENT_CONTEXT(ctx
);
6818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6819 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6824 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6826 if (ctx
->ExecuteFlag
) {
6827 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6832 static void GLAPIENTRY
6833 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6836 GET_CURRENT_CONTEXT(ctx
);
6838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6839 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6844 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6846 if (ctx
->ExecuteFlag
) {
6847 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6851 static void GLAPIENTRY
6852 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6855 GET_CURRENT_CONTEXT(ctx
);
6857 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6858 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6863 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6865 if (ctx
->ExecuteFlag
) {
6866 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6871 static void GLAPIENTRY
6872 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6875 GET_CURRENT_CONTEXT(ctx
);
6877 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6878 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6883 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6885 if (ctx
->ExecuteFlag
) {
6886 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6890 static void GLAPIENTRY
6891 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6894 GET_CURRENT_CONTEXT(ctx
);
6896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6897 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6902 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6904 if (ctx
->ExecuteFlag
) {
6905 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6910 static void GLAPIENTRY
6911 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6914 GET_CURRENT_CONTEXT(ctx
);
6916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6917 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6922 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6924 if (ctx
->ExecuteFlag
) {
6925 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6929 static void GLAPIENTRY
6930 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6933 GET_CURRENT_CONTEXT(ctx
);
6935 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6936 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6941 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6943 if (ctx
->ExecuteFlag
) {
6944 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6948 static void GLAPIENTRY
6949 save_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
6951 GET_CURRENT_CONTEXT(ctx
);
6953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6954 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM_STAGES
, 3);
6960 if (ctx
->ExecuteFlag
) {
6961 CALL_UseProgramStages(ctx
->Exec
, (pipeline
, stages
, program
));
6965 static void GLAPIENTRY
6966 save_ProgramUniform1f(GLuint program
, GLint location
, GLfloat x
)
6968 GET_CURRENT_CONTEXT(ctx
);
6970 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6971 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1F
, 3);
6977 if (ctx
->ExecuteFlag
) {
6978 CALL_ProgramUniform1f(ctx
->Exec
, (program
, location
, x
));
6982 static void GLAPIENTRY
6983 save_ProgramUniform2f(GLuint program
, GLint location
, GLfloat x
, GLfloat y
)
6985 GET_CURRENT_CONTEXT(ctx
);
6987 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6988 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2F
, 4);
6995 if (ctx
->ExecuteFlag
) {
6996 CALL_ProgramUniform2f(ctx
->Exec
, (program
, location
, x
, y
));
7000 static void GLAPIENTRY
7001 save_ProgramUniform3f(GLuint program
, GLint location
,
7002 GLfloat x
, GLfloat y
, GLfloat z
)
7004 GET_CURRENT_CONTEXT(ctx
);
7006 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7007 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3F
, 5);
7015 if (ctx
->ExecuteFlag
) {
7016 CALL_ProgramUniform3f(ctx
->Exec
, (program
, location
, x
, y
, z
));
7020 static void GLAPIENTRY
7021 save_ProgramUniform4f(GLuint program
, GLint location
,
7022 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
7024 GET_CURRENT_CONTEXT(ctx
);
7026 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7027 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4F
, 6);
7036 if (ctx
->ExecuteFlag
) {
7037 CALL_ProgramUniform4f(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7041 static void GLAPIENTRY
7042 save_ProgramUniform1fv(GLuint program
, GLint location
, GLsizei count
,
7045 GET_CURRENT_CONTEXT(ctx
);
7047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7048 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1FV
, 3 + POINTER_DWORDS
);
7053 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLfloat
)));
7055 if (ctx
->ExecuteFlag
) {
7056 CALL_ProgramUniform1fv(ctx
->Exec
, (program
, location
, count
, v
));
7060 static void GLAPIENTRY
7061 save_ProgramUniform2fv(GLuint program
, GLint location
, GLsizei count
,
7064 GET_CURRENT_CONTEXT(ctx
);
7066 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7067 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2FV
, 3 + POINTER_DWORDS
);
7072 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLfloat
)));
7074 if (ctx
->ExecuteFlag
) {
7075 CALL_ProgramUniform2fv(ctx
->Exec
, (program
, location
, count
, v
));
7079 static void GLAPIENTRY
7080 save_ProgramUniform3fv(GLuint program
, GLint location
, GLsizei count
,
7083 GET_CURRENT_CONTEXT(ctx
);
7085 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7086 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3FV
, 3 + POINTER_DWORDS
);
7091 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLfloat
)));
7093 if (ctx
->ExecuteFlag
) {
7094 CALL_ProgramUniform3fv(ctx
->Exec
, (program
, location
, count
, v
));
7098 static void GLAPIENTRY
7099 save_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
7102 GET_CURRENT_CONTEXT(ctx
);
7104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7105 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4FV
, 3 + POINTER_DWORDS
);
7110 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLfloat
)));
7112 if (ctx
->ExecuteFlag
) {
7113 CALL_ProgramUniform4fv(ctx
->Exec
, (program
, location
, count
, v
));
7117 static void GLAPIENTRY
7118 save_ProgramUniform1i(GLuint program
, GLint location
, GLint x
)
7120 GET_CURRENT_CONTEXT(ctx
);
7122 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7123 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1I
, 3);
7129 if (ctx
->ExecuteFlag
) {
7130 CALL_ProgramUniform1i(ctx
->Exec
, (program
, location
, x
));
7134 static void GLAPIENTRY
7135 save_ProgramUniform2i(GLuint program
, GLint location
, GLint x
, GLint y
)
7137 GET_CURRENT_CONTEXT(ctx
);
7139 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7140 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2I
, 4);
7147 if (ctx
->ExecuteFlag
) {
7148 CALL_ProgramUniform2i(ctx
->Exec
, (program
, location
, x
, y
));
7152 static void GLAPIENTRY
7153 save_ProgramUniform3i(GLuint program
, GLint location
,
7154 GLint x
, GLint y
, GLint z
)
7156 GET_CURRENT_CONTEXT(ctx
);
7158 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7159 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3I
, 5);
7167 if (ctx
->ExecuteFlag
) {
7168 CALL_ProgramUniform3i(ctx
->Exec
, (program
, location
, x
, y
, z
));
7172 static void GLAPIENTRY
7173 save_ProgramUniform4i(GLuint program
, GLint location
,
7174 GLint x
, GLint y
, GLint z
, GLint w
)
7176 GET_CURRENT_CONTEXT(ctx
);
7178 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7179 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4I
, 6);
7188 if (ctx
->ExecuteFlag
) {
7189 CALL_ProgramUniform4i(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7193 static void GLAPIENTRY
7194 save_ProgramUniform1iv(GLuint program
, GLint location
, GLsizei count
,
7197 GET_CURRENT_CONTEXT(ctx
);
7199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7200 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1IV
, 3 + POINTER_DWORDS
);
7205 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLint
)));
7207 if (ctx
->ExecuteFlag
) {
7208 CALL_ProgramUniform1iv(ctx
->Exec
, (program
, location
, count
, v
));
7212 static void GLAPIENTRY
7213 save_ProgramUniform2iv(GLuint program
, GLint location
, GLsizei count
,
7216 GET_CURRENT_CONTEXT(ctx
);
7218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7219 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2IV
, 3 + POINTER_DWORDS
);
7224 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLint
)));
7226 if (ctx
->ExecuteFlag
) {
7227 CALL_ProgramUniform2iv(ctx
->Exec
, (program
, location
, count
, v
));
7231 static void GLAPIENTRY
7232 save_ProgramUniform3iv(GLuint program
, GLint location
, GLsizei count
,
7235 GET_CURRENT_CONTEXT(ctx
);
7237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7238 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3IV
, 3 + POINTER_DWORDS
);
7243 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLint
)));
7245 if (ctx
->ExecuteFlag
) {
7246 CALL_ProgramUniform3iv(ctx
->Exec
, (program
, location
, count
, v
));
7250 static void GLAPIENTRY
7251 save_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
7254 GET_CURRENT_CONTEXT(ctx
);
7256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7257 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4IV
, 3 + POINTER_DWORDS
);
7262 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLint
)));
7264 if (ctx
->ExecuteFlag
) {
7265 CALL_ProgramUniform4iv(ctx
->Exec
, (program
, location
, count
, v
));
7269 static void GLAPIENTRY
7270 save_ProgramUniform1ui(GLuint program
, GLint location
, GLuint x
)
7272 GET_CURRENT_CONTEXT(ctx
);
7274 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7275 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UI
, 3);
7281 if (ctx
->ExecuteFlag
) {
7282 CALL_ProgramUniform1ui(ctx
->Exec
, (program
, location
, x
));
7286 static void GLAPIENTRY
7287 save_ProgramUniform2ui(GLuint program
, GLint location
, GLuint x
, GLuint y
)
7289 GET_CURRENT_CONTEXT(ctx
);
7291 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7292 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UI
, 4);
7299 if (ctx
->ExecuteFlag
) {
7300 CALL_ProgramUniform2ui(ctx
->Exec
, (program
, location
, x
, y
));
7304 static void GLAPIENTRY
7305 save_ProgramUniform3ui(GLuint program
, GLint location
,
7306 GLuint x
, GLuint y
, GLuint z
)
7308 GET_CURRENT_CONTEXT(ctx
);
7310 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7311 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UI
, 5);
7319 if (ctx
->ExecuteFlag
) {
7320 CALL_ProgramUniform3ui(ctx
->Exec
, (program
, location
, x
, y
, z
));
7324 static void GLAPIENTRY
7325 save_ProgramUniform4ui(GLuint program
, GLint location
,
7326 GLuint x
, GLuint y
, GLuint z
, GLuint w
)
7328 GET_CURRENT_CONTEXT(ctx
);
7330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7331 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UI
, 6);
7340 if (ctx
->ExecuteFlag
) {
7341 CALL_ProgramUniform4ui(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7345 static void GLAPIENTRY
7346 save_ProgramUniform1uiv(GLuint program
, GLint location
, GLsizei count
,
7349 GET_CURRENT_CONTEXT(ctx
);
7351 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7352 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UIV
, 3 + POINTER_DWORDS
);
7357 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLuint
)));
7359 if (ctx
->ExecuteFlag
) {
7360 CALL_ProgramUniform1uiv(ctx
->Exec
, (program
, location
, count
, v
));
7364 static void GLAPIENTRY
7365 save_ProgramUniform2uiv(GLuint program
, GLint location
, GLsizei count
,
7368 GET_CURRENT_CONTEXT(ctx
);
7370 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7371 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UIV
, 3 + POINTER_DWORDS
);
7376 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLuint
)));
7378 if (ctx
->ExecuteFlag
) {
7379 CALL_ProgramUniform2uiv(ctx
->Exec
, (program
, location
, count
, v
));
7383 static void GLAPIENTRY
7384 save_ProgramUniform3uiv(GLuint program
, GLint location
, GLsizei count
,
7387 GET_CURRENT_CONTEXT(ctx
);
7389 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7390 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UIV
, 3 + POINTER_DWORDS
);
7395 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLuint
)));
7397 if (ctx
->ExecuteFlag
) {
7398 CALL_ProgramUniform3uiv(ctx
->Exec
, (program
, location
, count
, v
));
7402 static void GLAPIENTRY
7403 save_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
7406 GET_CURRENT_CONTEXT(ctx
);
7408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7409 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UIV
, 3 + POINTER_DWORDS
);
7414 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLuint
)));
7416 if (ctx
->ExecuteFlag
) {
7417 CALL_ProgramUniform4uiv(ctx
->Exec
, (program
, location
, count
, v
));
7421 static void GLAPIENTRY
7422 save_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
7423 GLboolean transpose
, const GLfloat
*v
)
7425 GET_CURRENT_CONTEXT(ctx
);
7427 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7428 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
7429 4 + POINTER_DWORDS
);
7435 save_pointer(&n
[5], memdup(v
, count
* 2 * 2 * sizeof(GLfloat
)));
7437 if (ctx
->ExecuteFlag
) {
7438 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
7439 (program
, location
, count
, transpose
, v
));
7443 static void GLAPIENTRY
7444 save_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
7445 GLboolean transpose
, const GLfloat
*v
)
7447 GET_CURRENT_CONTEXT(ctx
);
7449 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7450 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
7451 4 + POINTER_DWORDS
);
7457 save_pointer(&n
[5], memdup(v
, count
* 2 * 3 * sizeof(GLfloat
)));
7459 if (ctx
->ExecuteFlag
) {
7460 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
7461 (program
, location
, count
, transpose
, v
));
7465 static void GLAPIENTRY
7466 save_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
7467 GLboolean transpose
, const GLfloat
*v
)
7469 GET_CURRENT_CONTEXT(ctx
);
7471 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7472 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
7473 4 + POINTER_DWORDS
);
7479 save_pointer(&n
[5], memdup(v
, count
* 2 * 4 * sizeof(GLfloat
)));
7481 if (ctx
->ExecuteFlag
) {
7482 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
7483 (program
, location
, count
, transpose
, v
));
7487 static void GLAPIENTRY
7488 save_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
7489 GLboolean transpose
, const GLfloat
*v
)
7491 GET_CURRENT_CONTEXT(ctx
);
7493 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7494 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
7495 4 + POINTER_DWORDS
);
7501 save_pointer(&n
[5], memdup(v
, count
* 3 * 2 * sizeof(GLfloat
)));
7503 if (ctx
->ExecuteFlag
) {
7504 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
7505 (program
, location
, count
, transpose
, v
));
7509 static void GLAPIENTRY
7510 save_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
7511 GLboolean transpose
, const GLfloat
*v
)
7513 GET_CURRENT_CONTEXT(ctx
);
7515 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7516 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
7517 4 + POINTER_DWORDS
);
7523 save_pointer(&n
[5], memdup(v
, count
* 3 * 3 * sizeof(GLfloat
)));
7525 if (ctx
->ExecuteFlag
) {
7526 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
7527 (program
, location
, count
, transpose
, v
));
7531 static void GLAPIENTRY
7532 save_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
7533 GLboolean transpose
, const GLfloat
*v
)
7535 GET_CURRENT_CONTEXT(ctx
);
7537 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7538 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
7539 4 + POINTER_DWORDS
);
7545 save_pointer(&n
[5], memdup(v
, count
* 3 * 4 * sizeof(GLfloat
)));
7547 if (ctx
->ExecuteFlag
) {
7548 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
7549 (program
, location
, count
, transpose
, v
));
7553 static void GLAPIENTRY
7554 save_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
7555 GLboolean transpose
, const GLfloat
*v
)
7557 GET_CURRENT_CONTEXT(ctx
);
7559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7560 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
7561 4 + POINTER_DWORDS
);
7567 save_pointer(&n
[5], memdup(v
, count
* 4 * 2 * sizeof(GLfloat
)));
7569 if (ctx
->ExecuteFlag
) {
7570 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
7571 (program
, location
, count
, transpose
, v
));
7575 static void GLAPIENTRY
7576 save_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
7577 GLboolean transpose
, const GLfloat
*v
)
7579 GET_CURRENT_CONTEXT(ctx
);
7581 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7582 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
7583 4 + POINTER_DWORDS
);
7589 save_pointer(&n
[5], memdup(v
, count
* 4 * 3 * sizeof(GLfloat
)));
7591 if (ctx
->ExecuteFlag
) {
7592 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
7593 (program
, location
, count
, transpose
, v
));
7597 static void GLAPIENTRY
7598 save_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
7599 GLboolean transpose
, const GLfloat
*v
)
7601 GET_CURRENT_CONTEXT(ctx
);
7603 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7604 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
7605 4 + POINTER_DWORDS
);
7611 save_pointer(&n
[5], memdup(v
, count
* 4 * 4 * sizeof(GLfloat
)));
7613 if (ctx
->ExecuteFlag
) {
7614 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
7615 (program
, location
, count
, transpose
, v
));
7619 static void GLAPIENTRY
7620 save_ClipControl(GLenum origin
, GLenum depth
)
7622 GET_CURRENT_CONTEXT(ctx
);
7624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7625 n
= alloc_instruction(ctx
, OPCODE_CLIP_CONTROL
, 2);
7630 if (ctx
->ExecuteFlag
) {
7631 CALL_ClipControl(ctx
->Exec
, (origin
, depth
));
7635 static void GLAPIENTRY
7636 save_ClampColorARB(GLenum target
, GLenum clamp
)
7638 GET_CURRENT_CONTEXT(ctx
);
7640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7641 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
7646 if (ctx
->ExecuteFlag
) {
7647 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
7651 /** GL_EXT_texture_integer */
7652 static void GLAPIENTRY
7653 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
7655 GET_CURRENT_CONTEXT(ctx
);
7657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7658 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
7665 if (ctx
->ExecuteFlag
) {
7666 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7670 /** GL_EXT_texture_integer */
7671 static void GLAPIENTRY
7672 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
7674 GET_CURRENT_CONTEXT(ctx
);
7676 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7677 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
7684 if (ctx
->ExecuteFlag
) {
7685 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7689 /** GL_EXT_texture_integer */
7690 static void GLAPIENTRY
7691 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
7693 GET_CURRENT_CONTEXT(ctx
);
7695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7696 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
7705 if (ctx
->ExecuteFlag
) {
7706 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
7710 /** GL_EXT_texture_integer */
7711 static void GLAPIENTRY
7712 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
7714 GET_CURRENT_CONTEXT(ctx
);
7716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7717 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
7721 n
[3].ui
= params
[0];
7722 n
[4].ui
= params
[1];
7723 n
[5].ui
= params
[2];
7724 n
[6].ui
= params
[3];
7726 if (ctx
->ExecuteFlag
) {
7727 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
7731 /* GL_ARB_instanced_arrays */
7732 static void GLAPIENTRY
7733 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
7735 GET_CURRENT_CONTEXT(ctx
);
7737 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7738 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
7743 if (ctx
->ExecuteFlag
) {
7744 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
7749 /* GL_NV_texture_barrier */
7750 static void GLAPIENTRY
7751 save_TextureBarrierNV(void)
7753 GET_CURRENT_CONTEXT(ctx
);
7754 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7755 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
7756 if (ctx
->ExecuteFlag
) {
7757 CALL_TextureBarrierNV(ctx
->Exec
, ());
7762 /* GL_ARB_sampler_objects */
7763 static void GLAPIENTRY
7764 save_BindSampler(GLuint unit
, GLuint sampler
)
7767 GET_CURRENT_CONTEXT(ctx
);
7768 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7769 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
7774 if (ctx
->ExecuteFlag
) {
7775 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
7779 static void GLAPIENTRY
7780 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7783 GET_CURRENT_CONTEXT(ctx
);
7784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7785 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7790 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7796 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7799 if (ctx
->ExecuteFlag
) {
7800 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7804 static void GLAPIENTRY
7805 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7809 parray
[1] = parray
[2] = parray
[3] = 0;
7810 save_SamplerParameteriv(sampler
, pname
, parray
);
7813 static void GLAPIENTRY
7814 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7817 GET_CURRENT_CONTEXT(ctx
);
7818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7819 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7824 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7830 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7833 if (ctx
->ExecuteFlag
) {
7834 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7838 static void GLAPIENTRY
7839 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7843 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7844 save_SamplerParameterfv(sampler
, pname
, parray
);
7847 static void GLAPIENTRY
7848 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7851 GET_CURRENT_CONTEXT(ctx
);
7852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7853 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7858 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7864 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7867 if (ctx
->ExecuteFlag
) {
7868 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7872 static void GLAPIENTRY
7873 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7876 GET_CURRENT_CONTEXT(ctx
);
7877 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7878 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7882 n
[3].ui
= params
[0];
7883 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7884 n
[4].ui
= params
[1];
7885 n
[5].ui
= params
[2];
7886 n
[6].ui
= params
[3];
7889 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7892 if (ctx
->ExecuteFlag
) {
7893 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7897 static void GLAPIENTRY
7898 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7901 GET_CURRENT_CONTEXT(ctx
);
7902 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7903 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7905 union uint64_pair p
;
7908 n
[2].ui
= p
.uint32
[0];
7909 n
[3].ui
= p
.uint32
[1];
7910 save_pointer(&n
[4], sync
);
7912 if (ctx
->ExecuteFlag
) {
7913 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7918 /** GL_NV_conditional_render */
7919 static void GLAPIENTRY
7920 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7922 GET_CURRENT_CONTEXT(ctx
);
7924 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7925 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7930 if (ctx
->ExecuteFlag
) {
7931 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7935 static void GLAPIENTRY
7936 save_EndConditionalRender(void)
7938 GET_CURRENT_CONTEXT(ctx
);
7939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7940 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7941 if (ctx
->ExecuteFlag
) {
7942 CALL_EndConditionalRender(ctx
->Exec
, ());
7946 static void GLAPIENTRY
7947 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7949 GET_CURRENT_CONTEXT(ctx
);
7951 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7952 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7958 if (ctx
->ExecuteFlag
) {
7959 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7963 /** GL_EXT_window_rectangles */
7964 static void GLAPIENTRY
7965 save_WindowRectanglesEXT(GLenum mode
, GLsizei count
, const GLint
*box
)
7967 GET_CURRENT_CONTEXT(ctx
);
7969 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7970 n
= alloc_instruction(ctx
, OPCODE_WINDOW_RECTANGLES
, 2 + POINTER_DWORDS
);
7972 GLint
*box_copy
= NULL
;
7975 box_copy
= memdup(box
, sizeof(GLint
) * 4 * count
);
7978 save_pointer(&n
[3], box_copy
);
7980 if (ctx
->ExecuteFlag
) {
7981 CALL_WindowRectanglesEXT(ctx
->Exec
, (mode
, count
, box
));
7986 /** GL_NV_conservative_raster */
7987 static void GLAPIENTRY
7988 save_SubpixelPrecisionBiasNV(GLuint xbits
, GLuint ybits
)
7990 GET_CURRENT_CONTEXT(ctx
);
7992 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7993 n
= alloc_instruction(ctx
, OPCODE_SUBPIXEL_PRECISION_BIAS
, 2);
7998 if (ctx
->ExecuteFlag
) {
7999 CALL_SubpixelPrecisionBiasNV(ctx
->Exec
, (xbits
, ybits
));
8003 /** GL_NV_conservative_raster_dilate */
8004 static void GLAPIENTRY
8005 save_ConservativeRasterParameterfNV(GLenum pname
, GLfloat param
)
8007 GET_CURRENT_CONTEXT(ctx
);
8009 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
8010 n
= alloc_instruction(ctx
, OPCODE_CONSERVATIVE_RASTER_PARAMETER_F
, 2);
8015 if (ctx
->ExecuteFlag
) {
8016 CALL_ConservativeRasterParameterfNV(ctx
->Exec
, (pname
, param
));
8020 /** GL_NV_conservative_raster_pre_snap_triangles */
8021 static void GLAPIENTRY
8022 save_ConservativeRasterParameteriNV(GLenum pname
, GLint param
)
8024 GET_CURRENT_CONTEXT(ctx
);
8026 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
8027 n
= alloc_instruction(ctx
, OPCODE_CONSERVATIVE_RASTER_PARAMETER_I
, 2);
8032 if (ctx
->ExecuteFlag
) {
8033 CALL_ConservativeRasterParameteriNV(ctx
->Exec
, (pname
, param
));
8039 * Save an error-generating command into display list.
8041 * KW: Will appear in the list before the vertex buffer containing the
8042 * command that provoked the error. I don't see this as a problem.
8045 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
8048 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
8051 save_pointer(&n
[2], (void *) s
);
8052 /* note: the data/string here doesn't have to be freed in
8053 * _mesa_delete_list() since the string is never dynamically
8061 * Compile an error into current display list.
8064 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
8066 if (ctx
->CompileFlag
)
8067 save_error(ctx
, error
, s
);
8068 if (ctx
->ExecuteFlag
)
8069 _mesa_error(ctx
, error
, "%s", s
);
8074 * Test if ID names a display list.
8077 islist(struct gl_context
*ctx
, GLuint list
)
8079 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
8089 /**********************************************************************/
8090 /* Display list execution */
8091 /**********************************************************************/
8095 * Execute a display list. Note that the ListBase offset must have already
8096 * been added before calling this function. I.e. the list argument is
8097 * the absolute list number, not relative to ListBase.
8098 * \param list - display list number
8101 execute_list(struct gl_context
*ctx
, GLuint list
)
8103 struct gl_display_list
*dlist
;
8107 if (list
== 0 || !islist(ctx
, list
))
8110 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
8111 /* raise an error? */
8115 dlist
= _mesa_lookup_list(ctx
, list
);
8119 ctx
->ListState
.CallDepth
++;
8121 vbo_save_BeginCallList(ctx
, dlist
);
8127 const OpCode opcode
= n
[0].opcode
;
8129 if (is_ext_opcode(opcode
)) {
8130 n
+= ext_opcode_execute(ctx
, n
);
8135 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
8138 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8140 case OPCODE_ALPHA_FUNC
:
8141 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8143 case OPCODE_BIND_TEXTURE
:
8144 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8148 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8149 ctx
->Unpack
= ctx
->DefaultPacking
;
8150 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
8151 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
8152 get_pointer(&n
[7])));
8153 ctx
->Unpack
= save
; /* restore */
8156 case OPCODE_BLEND_COLOR
:
8157 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8159 case OPCODE_BLEND_EQUATION
:
8160 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
8162 case OPCODE_BLEND_EQUATION_SEPARATE
:
8163 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8165 case OPCODE_BLEND_FUNC_SEPARATE
:
8166 CALL_BlendFuncSeparate(ctx
->Exec
,
8167 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8170 case OPCODE_BLEND_FUNC_I
:
8171 /* GL_ARB_draw_buffers_blend */
8172 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
8174 case OPCODE_BLEND_FUNC_SEPARATE_I
:
8175 /* GL_ARB_draw_buffers_blend */
8176 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
8179 case OPCODE_BLEND_EQUATION_I
:
8180 /* GL_ARB_draw_buffers_blend */
8181 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8183 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
8184 /* GL_ARB_draw_buffers_blend */
8185 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
8186 (n
[1].ui
, n
[2].e
, n
[3].e
));
8189 case OPCODE_CALL_LIST
:
8190 /* Generated by glCallList(), don't add ListBase */
8191 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
8192 execute_list(ctx
, n
[1].ui
);
8195 case OPCODE_CALL_LISTS
:
8196 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
8197 CALL_CallLists(ctx
->Exec
, (n
[1].i
, n
[2].e
, get_pointer(&n
[3])));
8201 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
8203 case OPCODE_CLEAR_BUFFER_IV
:
8210 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8213 case OPCODE_CLEAR_BUFFER_UIV
:
8220 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8223 case OPCODE_CLEAR_BUFFER_FV
:
8230 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8233 case OPCODE_CLEAR_BUFFER_FI
:
8234 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
8236 case OPCODE_CLEAR_COLOR
:
8237 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8239 case OPCODE_CLEAR_ACCUM
:
8240 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8242 case OPCODE_CLEAR_DEPTH
:
8243 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
8245 case OPCODE_CLEAR_INDEX
:
8246 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
8248 case OPCODE_CLEAR_STENCIL
:
8249 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
8251 case OPCODE_CLIP_PLANE
:
8258 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
8261 case OPCODE_COLOR_MASK
:
8262 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
8264 case OPCODE_COLOR_MASK_INDEXED
:
8265 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
8268 case OPCODE_COLOR_MATERIAL
:
8269 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8271 case OPCODE_COPY_PIXELS
:
8272 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8273 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
8276 case OPCODE_COPY_TEX_IMAGE1D
:
8277 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
8278 n
[5].i
, n
[6].i
, n
[7].i
));
8280 case OPCODE_COPY_TEX_IMAGE2D
:
8281 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
8282 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
8284 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
8285 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8286 n
[4].i
, n
[5].i
, n
[6].i
));
8288 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
8289 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8290 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8293 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
8294 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8295 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8298 case OPCODE_CULL_FACE
:
8299 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
8301 case OPCODE_DEPTH_FUNC
:
8302 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
8304 case OPCODE_DEPTH_MASK
:
8305 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
8307 case OPCODE_DEPTH_RANGE
:
8308 CALL_DepthRange(ctx
->Exec
,
8309 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
8311 case OPCODE_DISABLE
:
8312 CALL_Disable(ctx
->Exec
, (n
[1].e
));
8314 case OPCODE_DISABLE_INDEXED
:
8315 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8317 case OPCODE_DRAW_BUFFER
:
8318 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
8320 case OPCODE_DRAW_PIXELS
:
8322 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8323 ctx
->Unpack
= ctx
->DefaultPacking
;
8324 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
8325 get_pointer(&n
[5])));
8326 ctx
->Unpack
= save
; /* restore */
8330 CALL_Enable(ctx
->Exec
, (n
[1].e
));
8332 case OPCODE_ENABLE_INDEXED
:
8333 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8335 case OPCODE_EVALMESH1
:
8336 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
8338 case OPCODE_EVALMESH2
:
8339 CALL_EvalMesh2(ctx
->Exec
,
8340 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8349 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
8352 case OPCODE_FRONT_FACE
:
8353 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
8355 case OPCODE_FRUSTUM
:
8356 CALL_Frustum(ctx
->Exec
,
8357 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8360 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8362 case OPCODE_INDEX_MASK
:
8363 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
8365 case OPCODE_INIT_NAMES
:
8366 CALL_InitNames(ctx
->Exec
, ());
8375 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
8378 case OPCODE_LIGHT_MODEL
:
8385 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
8388 case OPCODE_LINE_STIPPLE
:
8389 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
8391 case OPCODE_LINE_WIDTH
:
8392 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
8394 case OPCODE_LIST_BASE
:
8395 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
8397 case OPCODE_LOAD_IDENTITY
:
8398 CALL_LoadIdentity(ctx
->Exec
, ());
8400 case OPCODE_LOAD_MATRIX
:
8401 STATIC_ASSERT(sizeof(Node
) == sizeof(GLfloat
));
8402 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
8404 case OPCODE_LOAD_NAME
:
8405 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
8407 case OPCODE_LOGIC_OP
:
8408 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
8412 GLenum target
= n
[1].e
;
8413 GLint ustride
= _mesa_evaluator_components(target
);
8414 GLint uorder
= n
[5].i
;
8415 GLfloat u1
= n
[2].f
;
8416 GLfloat u2
= n
[3].f
;
8417 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8418 (GLfloat
*) get_pointer(&n
[6])));
8423 GLenum target
= n
[1].e
;
8424 GLfloat u1
= n
[2].f
;
8425 GLfloat u2
= n
[3].f
;
8426 GLfloat v1
= n
[4].f
;
8427 GLfloat v2
= n
[5].f
;
8428 GLint ustride
= n
[6].i
;
8429 GLint vstride
= n
[7].i
;
8430 GLint uorder
= n
[8].i
;
8431 GLint vorder
= n
[9].i
;
8432 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8433 v1
, v2
, vstride
, vorder
,
8434 (GLfloat
*) get_pointer(&n
[10])));
8437 case OPCODE_MAPGRID1
:
8438 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8440 case OPCODE_MAPGRID2
:
8441 CALL_MapGrid2f(ctx
->Exec
,
8442 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
8444 case OPCODE_MATRIX_MODE
:
8445 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
8447 case OPCODE_MULT_MATRIX
:
8448 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
8451 CALL_Ortho(ctx
->Exec
,
8452 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8454 case OPCODE_PASSTHROUGH
:
8455 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
8457 case OPCODE_PATCH_PARAMETER_I
:
8458 CALL_PatchParameteri(ctx
->Exec
, (n
[1].e
, n
[2].i
));
8460 case OPCODE_PATCH_PARAMETER_FV_INNER
:
8465 CALL_PatchParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8468 case OPCODE_PATCH_PARAMETER_FV_OUTER
:
8475 CALL_PatchParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8478 case OPCODE_PIXEL_MAP
:
8479 CALL_PixelMapfv(ctx
->Exec
,
8480 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
8482 case OPCODE_PIXEL_TRANSFER
:
8483 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8485 case OPCODE_PIXEL_ZOOM
:
8486 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8488 case OPCODE_POINT_SIZE
:
8489 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
8491 case OPCODE_POINT_PARAMETERS
:
8497 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8500 case OPCODE_POLYGON_MODE
:
8501 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8503 case OPCODE_POLYGON_STIPPLE
:
8505 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8506 ctx
->Unpack
= ctx
->DefaultPacking
;
8507 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
8508 ctx
->Unpack
= save
; /* restore */
8511 case OPCODE_POLYGON_OFFSET
:
8512 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8514 case OPCODE_POLYGON_OFFSET_CLAMP
:
8515 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8517 case OPCODE_POP_ATTRIB
:
8518 CALL_PopAttrib(ctx
->Exec
, ());
8520 case OPCODE_POP_MATRIX
:
8521 CALL_PopMatrix(ctx
->Exec
, ());
8523 case OPCODE_POP_NAME
:
8524 CALL_PopName(ctx
->Exec
, ());
8526 case OPCODE_PRIORITIZE_TEXTURE
:
8527 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
8529 case OPCODE_PUSH_ATTRIB
:
8530 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
8532 case OPCODE_PUSH_MATRIX
:
8533 CALL_PushMatrix(ctx
->Exec
, ());
8535 case OPCODE_PUSH_NAME
:
8536 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
8538 case OPCODE_RASTER_POS
:
8539 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8541 case OPCODE_READ_BUFFER
:
8542 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
8545 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8548 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8550 case OPCODE_SCISSOR
:
8551 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8553 case OPCODE_SHADE_MODEL
:
8554 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
8556 case OPCODE_PROVOKING_VERTEX
:
8557 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
8559 case OPCODE_STENCIL_FUNC
:
8560 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
8562 case OPCODE_STENCIL_MASK
:
8563 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
8565 case OPCODE_STENCIL_OP
:
8566 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
8568 case OPCODE_STENCIL_FUNC_SEPARATE
:
8569 CALL_StencilFuncSeparate(ctx
->Exec
,
8570 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
8572 case OPCODE_STENCIL_MASK_SEPARATE
:
8573 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8575 case OPCODE_STENCIL_OP_SEPARATE
:
8576 CALL_StencilOpSeparate(ctx
->Exec
,
8577 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8586 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8596 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8599 case OPCODE_TEXPARAMETER
:
8606 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8609 case OPCODE_TEX_IMAGE1D
:
8611 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8612 ctx
->Unpack
= ctx
->DefaultPacking
;
8613 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
8615 n
[3].i
, /* components */
8617 n
[5].e
, /* border */
8618 n
[6].e
, /* format */
8620 get_pointer(&n
[8])));
8621 ctx
->Unpack
= save
; /* restore */
8624 case OPCODE_TEX_IMAGE2D
:
8626 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8627 ctx
->Unpack
= ctx
->DefaultPacking
;
8628 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
8630 n
[3].i
, /* components */
8632 n
[5].i
, /* height */
8633 n
[6].e
, /* border */
8634 n
[7].e
, /* format */
8636 get_pointer(&n
[9])));
8637 ctx
->Unpack
= save
; /* restore */
8640 case OPCODE_TEX_IMAGE3D
:
8642 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8643 ctx
->Unpack
= ctx
->DefaultPacking
;
8644 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
8646 n
[3].i
, /* components */
8648 n
[5].i
, /* height */
8650 n
[7].e
, /* border */
8651 n
[8].e
, /* format */
8653 get_pointer(&n
[10])));
8654 ctx
->Unpack
= save
; /* restore */
8657 case OPCODE_TEX_SUB_IMAGE1D
:
8659 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8660 ctx
->Unpack
= ctx
->DefaultPacking
;
8661 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8663 n
[6].e
, get_pointer(&n
[7])));
8664 ctx
->Unpack
= save
; /* restore */
8667 case OPCODE_TEX_SUB_IMAGE2D
:
8669 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8670 ctx
->Unpack
= ctx
->DefaultPacking
;
8671 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8673 n
[6].i
, n
[7].e
, n
[8].e
,
8674 get_pointer(&n
[9])));
8675 ctx
->Unpack
= save
; /* restore */
8678 case OPCODE_TEX_SUB_IMAGE3D
:
8680 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8681 ctx
->Unpack
= ctx
->DefaultPacking
;
8682 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8683 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8684 n
[8].i
, n
[9].e
, n
[10].e
,
8685 get_pointer(&n
[11])));
8686 ctx
->Unpack
= save
; /* restore */
8689 case OPCODE_TRANSLATE
:
8690 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8692 case OPCODE_VIEWPORT
:
8693 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8694 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8696 case OPCODE_WINDOW_POS
:
8697 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8699 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8700 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8702 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8703 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8704 n
[4].i
, n
[5].i
, n
[6].i
,
8705 get_pointer(&n
[7])));
8707 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8708 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8709 n
[4].i
, n
[5].i
, n
[6].i
,
8710 n
[7].i
, get_pointer(&n
[8])));
8712 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8713 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8714 n
[4].i
, n
[5].i
, n
[6].i
,
8716 get_pointer(&n
[9])));
8718 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8719 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8720 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8722 get_pointer(&n
[7])));
8724 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8725 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8726 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8727 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8728 get_pointer(&n
[9])));
8730 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8731 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8732 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8733 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8735 get_pointer(&n
[11])));
8737 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8738 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8740 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8741 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8743 case OPCODE_BIND_PROGRAM_ARB
: /* GL_ARB_vertex_program */
8744 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8746 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8747 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8748 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8751 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8752 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8754 case OPCODE_DEPTH_BOUNDS_EXT
:
8755 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8757 case OPCODE_PROGRAM_STRING_ARB
:
8758 CALL_ProgramStringARB(ctx
->Exec
,
8759 (n
[1].e
, n
[2].e
, n
[3].i
,
8760 get_pointer(&n
[4])));
8762 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8763 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8767 case OPCODE_BEGIN_QUERY_ARB
:
8768 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8770 case OPCODE_END_QUERY_ARB
:
8771 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8773 case OPCODE_QUERY_COUNTER
:
8774 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8776 case OPCODE_BEGIN_QUERY_INDEXED
:
8777 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8779 case OPCODE_END_QUERY_INDEXED
:
8780 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8782 case OPCODE_DRAW_BUFFERS_ARB
:
8784 GLenum buffers
[MAX_DRAW_BUFFERS
];
8785 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8786 for (i
= 0; i
< count
; i
++)
8787 buffers
[i
] = n
[2 + i
].e
;
8788 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8791 case OPCODE_BLIT_FRAMEBUFFER
:
8792 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8793 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8796 case OPCODE_PRIMITIVE_RESTART_NV
:
8797 CALL_PrimitiveRestartNV(ctx
->Exec
, ());
8800 case OPCODE_USE_PROGRAM
:
8801 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8803 case OPCODE_UNIFORM_1F
:
8804 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8806 case OPCODE_UNIFORM_2F
:
8807 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8809 case OPCODE_UNIFORM_3F
:
8810 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8812 case OPCODE_UNIFORM_4F
:
8813 CALL_Uniform4f(ctx
->Exec
,
8814 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8816 case OPCODE_UNIFORM_1FV
:
8817 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8819 case OPCODE_UNIFORM_2FV
:
8820 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8822 case OPCODE_UNIFORM_3FV
:
8823 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8825 case OPCODE_UNIFORM_4FV
:
8826 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8828 case OPCODE_UNIFORM_1I
:
8829 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8831 case OPCODE_UNIFORM_2I
:
8832 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8834 case OPCODE_UNIFORM_3I
:
8835 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8837 case OPCODE_UNIFORM_4I
:
8838 CALL_Uniform4i(ctx
->Exec
,
8839 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8841 case OPCODE_UNIFORM_1IV
:
8842 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8844 case OPCODE_UNIFORM_2IV
:
8845 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8847 case OPCODE_UNIFORM_3IV
:
8848 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8850 case OPCODE_UNIFORM_4IV
:
8851 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8853 case OPCODE_UNIFORM_1UI
:
8854 CALL_Uniform1ui(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8856 case OPCODE_UNIFORM_2UI
:
8857 CALL_Uniform2ui(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8859 case OPCODE_UNIFORM_3UI
:
8860 CALL_Uniform3ui(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8862 case OPCODE_UNIFORM_4UI
:
8863 CALL_Uniform4ui(ctx
->Exec
,
8864 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8866 case OPCODE_UNIFORM_1UIV
:
8867 CALL_Uniform1uiv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8869 case OPCODE_UNIFORM_2UIV
:
8870 CALL_Uniform2uiv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8872 case OPCODE_UNIFORM_3UIV
:
8873 CALL_Uniform3uiv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8875 case OPCODE_UNIFORM_4UIV
:
8876 CALL_Uniform4uiv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8878 case OPCODE_UNIFORM_MATRIX22
:
8879 CALL_UniformMatrix2fv(ctx
->Exec
,
8880 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8882 case OPCODE_UNIFORM_MATRIX33
:
8883 CALL_UniformMatrix3fv(ctx
->Exec
,
8884 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8886 case OPCODE_UNIFORM_MATRIX44
:
8887 CALL_UniformMatrix4fv(ctx
->Exec
,
8888 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8890 case OPCODE_UNIFORM_MATRIX23
:
8891 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8892 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8894 case OPCODE_UNIFORM_MATRIX32
:
8895 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8896 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8898 case OPCODE_UNIFORM_MATRIX24
:
8899 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8900 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8902 case OPCODE_UNIFORM_MATRIX42
:
8903 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8904 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8906 case OPCODE_UNIFORM_MATRIX34
:
8907 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8908 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8910 case OPCODE_UNIFORM_MATRIX43
:
8911 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8912 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8915 case OPCODE_USE_PROGRAM_STAGES
:
8916 CALL_UseProgramStages(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8918 case OPCODE_PROGRAM_UNIFORM_1F
:
8919 CALL_ProgramUniform1f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
));
8921 case OPCODE_PROGRAM_UNIFORM_2F
:
8922 CALL_ProgramUniform2f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
, n
[4].f
));
8924 case OPCODE_PROGRAM_UNIFORM_3F
:
8925 CALL_ProgramUniform3f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8926 n
[3].f
, n
[4].f
, n
[5].f
));
8928 case OPCODE_PROGRAM_UNIFORM_4F
:
8929 CALL_ProgramUniform4f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8930 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8932 case OPCODE_PROGRAM_UNIFORM_1FV
:
8933 CALL_ProgramUniform1fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8934 get_pointer(&n
[4])));
8936 case OPCODE_PROGRAM_UNIFORM_2FV
:
8937 CALL_ProgramUniform2fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8938 get_pointer(&n
[4])));
8940 case OPCODE_PROGRAM_UNIFORM_3FV
:
8941 CALL_ProgramUniform3fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8942 get_pointer(&n
[4])));
8944 case OPCODE_PROGRAM_UNIFORM_4FV
:
8945 CALL_ProgramUniform4fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8946 get_pointer(&n
[4])));
8948 case OPCODE_PROGRAM_UNIFORM_1I
:
8949 CALL_ProgramUniform1i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
));
8951 case OPCODE_PROGRAM_UNIFORM_2I
:
8952 CALL_ProgramUniform2i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].i
));
8954 case OPCODE_PROGRAM_UNIFORM_3I
:
8955 CALL_ProgramUniform3i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8956 n
[3].i
, n
[4].i
, n
[5].i
));
8958 case OPCODE_PROGRAM_UNIFORM_4I
:
8959 CALL_ProgramUniform4i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8960 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
));
8962 case OPCODE_PROGRAM_UNIFORM_1IV
:
8963 CALL_ProgramUniform1iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8964 get_pointer(&n
[4])));
8966 case OPCODE_PROGRAM_UNIFORM_2IV
:
8967 CALL_ProgramUniform2iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8968 get_pointer(&n
[4])));
8970 case OPCODE_PROGRAM_UNIFORM_3IV
:
8971 CALL_ProgramUniform3iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8972 get_pointer(&n
[4])));
8974 case OPCODE_PROGRAM_UNIFORM_4IV
:
8975 CALL_ProgramUniform4iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8976 get_pointer(&n
[4])));
8978 case OPCODE_PROGRAM_UNIFORM_1UI
:
8979 CALL_ProgramUniform1ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].ui
));
8981 case OPCODE_PROGRAM_UNIFORM_2UI
:
8982 CALL_ProgramUniform2ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8985 case OPCODE_PROGRAM_UNIFORM_3UI
:
8986 CALL_ProgramUniform3ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8987 n
[3].ui
, n
[4].ui
, n
[5].ui
));
8989 case OPCODE_PROGRAM_UNIFORM_4UI
:
8990 CALL_ProgramUniform4ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8992 n
[4].ui
, n
[5].ui
, n
[6].ui
));
8994 case OPCODE_PROGRAM_UNIFORM_1UIV
:
8995 CALL_ProgramUniform1uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8996 get_pointer(&n
[4])));
8998 case OPCODE_PROGRAM_UNIFORM_2UIV
:
8999 CALL_ProgramUniform2uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
9000 get_pointer(&n
[4])));
9002 case OPCODE_PROGRAM_UNIFORM_3UIV
:
9003 CALL_ProgramUniform3uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
9004 get_pointer(&n
[4])));
9006 case OPCODE_PROGRAM_UNIFORM_4UIV
:
9007 CALL_ProgramUniform4uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
9008 get_pointer(&n
[4])));
9010 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
9011 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
9012 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
9013 get_pointer(&n
[5])));
9015 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
9016 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
9017 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
9018 get_pointer(&n
[5])));
9020 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
9021 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
9022 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
9023 get_pointer(&n
[5])));
9025 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
9026 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
9027 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
9028 get_pointer(&n
[5])));
9030 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
9031 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
9032 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
9033 get_pointer(&n
[5])));
9035 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
9036 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
9037 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
9038 get_pointer(&n
[5])));
9040 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
9041 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
9042 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
9043 get_pointer(&n
[5])));
9045 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
9046 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
9047 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
9048 get_pointer(&n
[5])));
9050 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
9051 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
9052 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
9053 get_pointer(&n
[5])));
9056 case OPCODE_CLIP_CONTROL
:
9057 CALL_ClipControl(ctx
->Exec
, (n
[1].e
, n
[2].e
));
9060 case OPCODE_CLAMP_COLOR
:
9061 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
9064 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
9065 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
9067 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
9068 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (n
[1].ui
, &n
[2].f
));
9070 case OPCODE_ATTR_1F_NV
:
9071 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
9073 case OPCODE_ATTR_2F_NV
:
9074 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
9076 case OPCODE_ATTR_3F_NV
:
9077 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
9079 case OPCODE_ATTR_4F_NV
:
9080 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
9082 case OPCODE_ATTR_1F_ARB
:
9083 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
9085 case OPCODE_ATTR_2F_ARB
:
9086 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
9088 case OPCODE_ATTR_3F_ARB
:
9089 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
9091 case OPCODE_ATTR_4F_ARB
:
9092 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
9094 case OPCODE_MATERIAL
:
9095 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
9098 CALL_Begin(ctx
->Exec
, (n
[1].e
));
9101 CALL_End(ctx
->Exec
, ());
9104 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
9106 case OPCODE_EVAL_C1
:
9107 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
9109 case OPCODE_EVAL_C2
:
9110 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
9112 case OPCODE_EVAL_P1
:
9113 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
9115 case OPCODE_EVAL_P2
:
9116 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
9119 /* GL_EXT_texture_integer */
9120 case OPCODE_CLEARCOLOR_I
:
9121 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
9123 case OPCODE_CLEARCOLOR_UI
:
9124 CALL_ClearColorIuiEXT(ctx
->Exec
,
9125 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
9127 case OPCODE_TEXPARAMETER_I
:
9134 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
9137 case OPCODE_TEXPARAMETER_UI
:
9140 params
[0] = n
[3].ui
;
9141 params
[1] = n
[4].ui
;
9142 params
[2] = n
[5].ui
;
9143 params
[3] = n
[6].ui
;
9144 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
9148 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
9149 /* GL_ARB_instanced_arrays */
9150 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
9153 case OPCODE_TEXTURE_BARRIER_NV
:
9154 CALL_TextureBarrierNV(ctx
->Exec
, ());
9157 /* GL_EXT/ARB_transform_feedback */
9158 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
9159 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
9161 case OPCODE_END_TRANSFORM_FEEDBACK
:
9162 CALL_EndTransformFeedback(ctx
->Exec
, ());
9164 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
9165 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
9167 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
9168 CALL_PauseTransformFeedback(ctx
->Exec
, ());
9170 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
9171 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
9173 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
9174 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
9176 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
9177 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
9178 (n
[1].e
, n
[2].ui
, n
[3].ui
));
9180 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
9181 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
9182 (n
[1].e
, n
[2].ui
, n
[3].si
));
9184 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
9185 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
9186 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
9190 case OPCODE_BIND_SAMPLER
:
9191 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
9193 case OPCODE_SAMPLER_PARAMETERIV
:
9200 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9203 case OPCODE_SAMPLER_PARAMETERFV
:
9210 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9213 case OPCODE_SAMPLER_PARAMETERIIV
:
9220 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9223 case OPCODE_SAMPLER_PARAMETERUIV
:
9226 params
[0] = n
[3].ui
;
9227 params
[1] = n
[4].ui
;
9228 params
[2] = n
[5].ui
;
9229 params
[3] = n
[6].ui
;
9230 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9235 case OPCODE_WAIT_SYNC
:
9237 union uint64_pair p
;
9238 p
.uint32
[0] = n
[2].ui
;
9239 p
.uint32
[1] = n
[3].ui
;
9240 CALL_WaitSync(ctx
->Exec
,
9241 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
9245 /* GL_NV_conditional_render */
9246 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
9247 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
9249 case OPCODE_END_CONDITIONAL_RENDER
:
9250 CALL_EndConditionalRender(ctx
->Exec
, ());
9253 case OPCODE_UNIFORM_BLOCK_BINDING
:
9254 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
9257 /* GL_EXT_window_rectangles */
9258 case OPCODE_WINDOW_RECTANGLES
:
9259 CALL_WindowRectanglesEXT(
9260 ctx
->Exec
, (n
[1].e
, n
[2].si
, get_pointer(&n
[3])));
9263 /* GL_NV_conservative_raster */
9264 case OPCODE_SUBPIXEL_PRECISION_BIAS
:
9265 CALL_SubpixelPrecisionBiasNV(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
9268 /* GL_NV_conservative_raster_dilate */
9269 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_F
:
9270 CALL_ConservativeRasterParameterfNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
9273 /* GL_NV_conservative_raster_pre_snap_triangles */
9274 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_I
:
9275 CALL_ConservativeRasterParameteriNV(ctx
->Exec
, (n
[1].e
, n
[2].i
));
9278 case OPCODE_CONTINUE
:
9279 n
= (Node
*) get_pointer(&n
[1]);
9284 case OPCODE_END_OF_LIST
:
9290 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
9292 _mesa_problem(ctx
, "%s", msg
);
9297 /* increment n to point to next compiled command */
9298 if (opcode
!= OPCODE_CONTINUE
) {
9299 assert(InstSize
[opcode
] > 0);
9300 n
+= InstSize
[opcode
];
9305 vbo_save_EndCallList(ctx
);
9307 ctx
->ListState
.CallDepth
--;
9312 /**********************************************************************/
9314 /**********************************************************************/
9317 * Test if a display list number is valid.
9319 GLboolean GLAPIENTRY
9320 _mesa_IsList(GLuint list
)
9322 GET_CURRENT_CONTEXT(ctx
);
9323 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9324 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
9325 return islist(ctx
, list
);
9330 * Delete a sequence of consecutive display lists.
9333 _mesa_DeleteLists(GLuint list
, GLsizei range
)
9335 GET_CURRENT_CONTEXT(ctx
);
9337 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9338 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9341 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
9346 /* We may be deleting a set of bitmap lists. See if there's a
9347 * bitmap atlas to free.
9349 struct gl_bitmap_atlas
*atlas
= lookup_bitmap_atlas(ctx
, list
);
9351 _mesa_delete_bitmap_atlas(ctx
, atlas
);
9352 _mesa_HashRemove(ctx
->Shared
->BitmapAtlas
, list
);
9356 for (i
= list
; i
< list
+ range
; i
++) {
9357 destroy_list(ctx
, i
);
9363 * Return a display list number, n, such that lists n through n+range-1
9367 _mesa_GenLists(GLsizei range
)
9369 GET_CURRENT_CONTEXT(ctx
);
9371 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9372 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
9375 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
9383 * Make this an atomic operation
9385 _mesa_HashLockMutex(ctx
->Shared
->DisplayList
);
9387 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
9389 /* reserve the list IDs by with empty/dummy lists */
9391 for (i
= 0; i
< range
; i
++) {
9392 _mesa_HashInsertLocked(ctx
->Shared
->DisplayList
, base
+ i
,
9393 make_list(base
+ i
, 1));
9397 if (USE_BITMAP_ATLAS
&&
9399 ctx
->Driver
.DrawAtlasBitmaps
) {
9400 /* "range > 16" is a rough heuristic to guess when glGenLists might be
9401 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
9402 * Create the empty atlas now.
9404 struct gl_bitmap_atlas
*atlas
= lookup_bitmap_atlas(ctx
, base
);
9406 atlas
= alloc_bitmap_atlas(ctx
, base
);
9409 /* Atlas _should_ be new/empty now, but clobbering is OK */
9410 assert(atlas
->numBitmaps
== 0);
9411 atlas
->numBitmaps
= range
;
9415 _mesa_HashUnlockMutex(ctx
->Shared
->DisplayList
);
9422 * Begin a new display list.
9425 _mesa_NewList(GLuint name
, GLenum mode
)
9427 GET_CURRENT_CONTEXT(ctx
);
9429 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
9430 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9432 if (MESA_VERBOSE
& VERBOSE_API
)
9433 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
9434 _mesa_enum_to_string(mode
));
9437 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
9441 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
9442 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
9446 if (ctx
->ListState
.CurrentList
) {
9447 /* already compiling a display list */
9448 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
9452 ctx
->CompileFlag
= GL_TRUE
;
9453 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
9455 /* Reset accumulated list state */
9456 invalidate_saved_current_state( ctx
);
9458 /* Allocate new display list */
9459 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
9460 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
9461 ctx
->ListState
.CurrentPos
= 0;
9463 vbo_save_NewList(ctx
, name
, mode
);
9465 ctx
->CurrentServerDispatch
= ctx
->Save
;
9466 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9467 if (ctx
->MarshalExec
== NULL
) {
9468 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9474 * End definition of current display list.
9479 GET_CURRENT_CONTEXT(ctx
);
9480 SAVE_FLUSH_VERTICES(ctx
);
9481 FLUSH_VERTICES(ctx
, 0);
9483 if (MESA_VERBOSE
& VERBOSE_API
)
9484 _mesa_debug(ctx
, "glEndList\n");
9486 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
9487 _mesa_error(ctx
, GL_INVALID_OPERATION
,
9488 "glEndList() called inside glBegin/End");
9491 /* Check that a list is under construction */
9492 if (!ctx
->ListState
.CurrentList
) {
9493 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
9497 /* Call before emitting END_OF_LIST, in case the driver wants to
9498 * emit opcodes itself.
9500 vbo_save_EndList(ctx
);
9502 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
9506 /* Destroy old list, if any */
9507 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
9509 /* Install the new list */
9510 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
9511 ctx
->ListState
.CurrentList
->Name
,
9512 ctx
->ListState
.CurrentList
);
9515 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
9516 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
9518 ctx
->ListState
.CurrentList
= NULL
;
9519 ctx
->ListState
.CurrentBlock
= NULL
;
9520 ctx
->ListState
.CurrentPos
= 0;
9521 ctx
->ExecuteFlag
= GL_TRUE
;
9522 ctx
->CompileFlag
= GL_FALSE
;
9524 ctx
->CurrentServerDispatch
= ctx
->Exec
;
9525 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9526 if (ctx
->MarshalExec
== NULL
) {
9527 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9533 _mesa_CallList(GLuint list
)
9535 GLboolean save_compile_flag
;
9536 GET_CURRENT_CONTEXT(ctx
);
9537 FLUSH_CURRENT(ctx
, 0);
9539 if (MESA_VERBOSE
& VERBOSE_API
)
9540 _mesa_debug(ctx
, "glCallList %d\n", list
);
9543 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
9548 mesa_print_display_list( list
);
9550 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9551 * execute the display list, and restore the CompileFlag.
9553 save_compile_flag
= ctx
->CompileFlag
;
9554 if (save_compile_flag
) {
9555 ctx
->CompileFlag
= GL_FALSE
;
9558 execute_list(ctx
, list
);
9559 ctx
->CompileFlag
= save_compile_flag
;
9561 /* also restore API function pointers to point to "save" versions */
9562 if (save_compile_flag
) {
9563 ctx
->CurrentServerDispatch
= ctx
->Save
;
9564 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9565 if (ctx
->MarshalExec
== NULL
) {
9566 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9573 * Try to execute a glCallLists() command where the display lists contain
9574 * glBitmap commands with a texture atlas.
9575 * \return true for success, false otherwise
9578 render_bitmap_atlas(struct gl_context
*ctx
, GLsizei n
, GLenum type
,
9581 struct gl_bitmap_atlas
*atlas
;
9584 if (!USE_BITMAP_ATLAS
||
9585 !ctx
->Current
.RasterPosValid
||
9586 ctx
->List
.ListBase
== 0 ||
9587 type
!= GL_UNSIGNED_BYTE
||
9588 !ctx
->Driver
.DrawAtlasBitmaps
) {
9593 atlas
= lookup_bitmap_atlas(ctx
, ctx
->List
.ListBase
);
9596 /* Even if glGenLists wasn't called, we can still try to create
9599 atlas
= alloc_bitmap_atlas(ctx
, ctx
->List
.ListBase
);
9602 if (atlas
&& !atlas
->complete
&& !atlas
->incomplete
) {
9603 /* Try to build the bitmap atlas now.
9604 * If the atlas was created in glGenLists, we'll have recorded the
9605 * number of lists (bitmaps). Otherwise, take a guess at 256.
9607 if (atlas
->numBitmaps
== 0)
9608 atlas
->numBitmaps
= 256;
9609 build_bitmap_atlas(ctx
, atlas
, ctx
->List
.ListBase
);
9612 if (!atlas
|| !atlas
->complete
) {
9616 /* check that all display list IDs are in the atlas */
9617 for (i
= 0; i
< n
; i
++) {
9618 const GLubyte
*ids
= (const GLubyte
*) lists
;
9620 if (ids
[i
] >= atlas
->numBitmaps
) {
9625 ctx
->Driver
.DrawAtlasBitmaps(ctx
, atlas
, n
, (const GLubyte
*) lists
);
9632 * Execute glCallLists: call multiple display lists.
9635 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
9637 GET_CURRENT_CONTEXT(ctx
);
9639 GLboolean save_compile_flag
;
9641 if (MESA_VERBOSE
& VERBOSE_API
)
9642 _mesa_debug(ctx
, "glCallLists %d\n", n
);
9646 case GL_UNSIGNED_BYTE
:
9648 case GL_UNSIGNED_SHORT
:
9650 case GL_UNSIGNED_INT
:
9658 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
9663 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallLists(n < 0)");
9665 } else if (n
== 0 || lists
== NULL
) {
9670 if (render_bitmap_atlas(ctx
, n
, type
, lists
)) {
9674 /* Save the CompileFlag status, turn it off, execute display list,
9675 * and restore the CompileFlag.
9677 save_compile_flag
= ctx
->CompileFlag
;
9678 ctx
->CompileFlag
= GL_FALSE
;
9680 for (i
= 0; i
< n
; i
++) {
9681 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
9682 execute_list(ctx
, list
);
9685 ctx
->CompileFlag
= save_compile_flag
;
9687 /* also restore API function pointers to point to "save" versions */
9688 if (save_compile_flag
) {
9689 ctx
->CurrentServerDispatch
= ctx
->Save
;
9690 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9691 if (ctx
->MarshalExec
== NULL
) {
9692 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9699 * Set the offset added to list numbers in glCallLists.
9702 _mesa_ListBase(GLuint base
)
9704 GET_CURRENT_CONTEXT(ctx
);
9705 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9706 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9707 ctx
->List
.ListBase
= base
;
9711 * Setup the given dispatch table to point to Mesa's display list
9712 * building functions.
9714 * This does not include any of the tnl functions - they are
9715 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9719 _mesa_initialize_save_table(const struct gl_context
*ctx
)
9721 struct _glapi_table
*table
= ctx
->Save
;
9722 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
9724 /* Initially populate the dispatch table with the contents of the
9725 * normal-execution dispatch table. This lets us skip populating functions
9726 * that should be called directly instead of compiled into display lists.
9728 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
9730 _mesa_loopback_init_api_table(ctx
, table
);
9733 vbo_initialize_save_dispatch(ctx
, table
);
9736 SET_Accum(table
, save_Accum
);
9737 SET_AlphaFunc(table
, save_AlphaFunc
);
9738 SET_Bitmap(table
, save_Bitmap
);
9739 SET_BlendFunc(table
, save_BlendFunc
);
9740 SET_CallList(table
, save_CallList
);
9741 SET_CallLists(table
, save_CallLists
);
9742 SET_Clear(table
, save_Clear
);
9743 SET_ClearAccum(table
, save_ClearAccum
);
9744 SET_ClearColor(table
, save_ClearColor
);
9745 SET_ClearDepth(table
, save_ClearDepth
);
9746 SET_ClearIndex(table
, save_ClearIndex
);
9747 SET_ClearStencil(table
, save_ClearStencil
);
9748 SET_ClipPlane(table
, save_ClipPlane
);
9749 SET_ColorMask(table
, save_ColorMask
);
9750 SET_ColorMaski(table
, save_ColorMaskIndexed
);
9751 SET_ColorMaterial(table
, save_ColorMaterial
);
9752 SET_CopyPixels(table
, save_CopyPixels
);
9753 SET_CullFace(table
, save_CullFace
);
9754 SET_DepthFunc(table
, save_DepthFunc
);
9755 SET_DepthMask(table
, save_DepthMask
);
9756 SET_DepthRange(table
, save_DepthRange
);
9757 SET_Disable(table
, save_Disable
);
9758 SET_Disablei(table
, save_DisableIndexed
);
9759 SET_DrawBuffer(table
, save_DrawBuffer
);
9760 SET_DrawPixels(table
, save_DrawPixels
);
9761 SET_Enable(table
, save_Enable
);
9762 SET_Enablei(table
, save_EnableIndexed
);
9763 SET_EvalMesh1(table
, save_EvalMesh1
);
9764 SET_EvalMesh2(table
, save_EvalMesh2
);
9765 SET_Fogf(table
, save_Fogf
);
9766 SET_Fogfv(table
, save_Fogfv
);
9767 SET_Fogi(table
, save_Fogi
);
9768 SET_Fogiv(table
, save_Fogiv
);
9769 SET_FrontFace(table
, save_FrontFace
);
9770 SET_Frustum(table
, save_Frustum
);
9771 SET_Hint(table
, save_Hint
);
9772 SET_IndexMask(table
, save_IndexMask
);
9773 SET_InitNames(table
, save_InitNames
);
9774 SET_LightModelf(table
, save_LightModelf
);
9775 SET_LightModelfv(table
, save_LightModelfv
);
9776 SET_LightModeli(table
, save_LightModeli
);
9777 SET_LightModeliv(table
, save_LightModeliv
);
9778 SET_Lightf(table
, save_Lightf
);
9779 SET_Lightfv(table
, save_Lightfv
);
9780 SET_Lighti(table
, save_Lighti
);
9781 SET_Lightiv(table
, save_Lightiv
);
9782 SET_LineStipple(table
, save_LineStipple
);
9783 SET_LineWidth(table
, save_LineWidth
);
9784 SET_ListBase(table
, save_ListBase
);
9785 SET_LoadIdentity(table
, save_LoadIdentity
);
9786 SET_LoadMatrixd(table
, save_LoadMatrixd
);
9787 SET_LoadMatrixf(table
, save_LoadMatrixf
);
9788 SET_LoadName(table
, save_LoadName
);
9789 SET_LogicOp(table
, save_LogicOp
);
9790 SET_Map1d(table
, save_Map1d
);
9791 SET_Map1f(table
, save_Map1f
);
9792 SET_Map2d(table
, save_Map2d
);
9793 SET_Map2f(table
, save_Map2f
);
9794 SET_MapGrid1d(table
, save_MapGrid1d
);
9795 SET_MapGrid1f(table
, save_MapGrid1f
);
9796 SET_MapGrid2d(table
, save_MapGrid2d
);
9797 SET_MapGrid2f(table
, save_MapGrid2f
);
9798 SET_MatrixMode(table
, save_MatrixMode
);
9799 SET_MultMatrixd(table
, save_MultMatrixd
);
9800 SET_MultMatrixf(table
, save_MultMatrixf
);
9801 SET_NewList(table
, save_NewList
);
9802 SET_Ortho(table
, save_Ortho
);
9803 SET_PassThrough(table
, save_PassThrough
);
9804 SET_PixelMapfv(table
, save_PixelMapfv
);
9805 SET_PixelMapuiv(table
, save_PixelMapuiv
);
9806 SET_PixelMapusv(table
, save_PixelMapusv
);
9807 SET_PixelTransferf(table
, save_PixelTransferf
);
9808 SET_PixelTransferi(table
, save_PixelTransferi
);
9809 SET_PixelZoom(table
, save_PixelZoom
);
9810 SET_PointSize(table
, save_PointSize
);
9811 SET_PolygonMode(table
, save_PolygonMode
);
9812 SET_PolygonOffset(table
, save_PolygonOffset
);
9813 SET_PolygonStipple(table
, save_PolygonStipple
);
9814 SET_PopAttrib(table
, save_PopAttrib
);
9815 SET_PopMatrix(table
, save_PopMatrix
);
9816 SET_PopName(table
, save_PopName
);
9817 SET_PushAttrib(table
, save_PushAttrib
);
9818 SET_PushMatrix(table
, save_PushMatrix
);
9819 SET_PushName(table
, save_PushName
);
9820 SET_RasterPos2d(table
, save_RasterPos2d
);
9821 SET_RasterPos2dv(table
, save_RasterPos2dv
);
9822 SET_RasterPos2f(table
, save_RasterPos2f
);
9823 SET_RasterPos2fv(table
, save_RasterPos2fv
);
9824 SET_RasterPos2i(table
, save_RasterPos2i
);
9825 SET_RasterPos2iv(table
, save_RasterPos2iv
);
9826 SET_RasterPos2s(table
, save_RasterPos2s
);
9827 SET_RasterPos2sv(table
, save_RasterPos2sv
);
9828 SET_RasterPos3d(table
, save_RasterPos3d
);
9829 SET_RasterPos3dv(table
, save_RasterPos3dv
);
9830 SET_RasterPos3f(table
, save_RasterPos3f
);
9831 SET_RasterPos3fv(table
, save_RasterPos3fv
);
9832 SET_RasterPos3i(table
, save_RasterPos3i
);
9833 SET_RasterPos3iv(table
, save_RasterPos3iv
);
9834 SET_RasterPos3s(table
, save_RasterPos3s
);
9835 SET_RasterPos3sv(table
, save_RasterPos3sv
);
9836 SET_RasterPos4d(table
, save_RasterPos4d
);
9837 SET_RasterPos4dv(table
, save_RasterPos4dv
);
9838 SET_RasterPos4f(table
, save_RasterPos4f
);
9839 SET_RasterPos4fv(table
, save_RasterPos4fv
);
9840 SET_RasterPos4i(table
, save_RasterPos4i
);
9841 SET_RasterPos4iv(table
, save_RasterPos4iv
);
9842 SET_RasterPos4s(table
, save_RasterPos4s
);
9843 SET_RasterPos4sv(table
, save_RasterPos4sv
);
9844 SET_ReadBuffer(table
, save_ReadBuffer
);
9845 SET_Rectf(table
, save_Rectf
);
9846 SET_Rotated(table
, save_Rotated
);
9847 SET_Rotatef(table
, save_Rotatef
);
9848 SET_Scaled(table
, save_Scaled
);
9849 SET_Scalef(table
, save_Scalef
);
9850 SET_Scissor(table
, save_Scissor
);
9851 SET_ShadeModel(table
, save_ShadeModel
);
9852 SET_StencilFunc(table
, save_StencilFunc
);
9853 SET_StencilMask(table
, save_StencilMask
);
9854 SET_StencilOp(table
, save_StencilOp
);
9855 SET_TexEnvf(table
, save_TexEnvf
);
9856 SET_TexEnvfv(table
, save_TexEnvfv
);
9857 SET_TexEnvi(table
, save_TexEnvi
);
9858 SET_TexEnviv(table
, save_TexEnviv
);
9859 SET_TexGend(table
, save_TexGend
);
9860 SET_TexGendv(table
, save_TexGendv
);
9861 SET_TexGenf(table
, save_TexGenf
);
9862 SET_TexGenfv(table
, save_TexGenfv
);
9863 SET_TexGeni(table
, save_TexGeni
);
9864 SET_TexGeniv(table
, save_TexGeniv
);
9865 SET_TexImage1D(table
, save_TexImage1D
);
9866 SET_TexImage2D(table
, save_TexImage2D
);
9867 SET_TexParameterf(table
, save_TexParameterf
);
9868 SET_TexParameterfv(table
, save_TexParameterfv
);
9869 SET_TexParameteri(table
, save_TexParameteri
);
9870 SET_TexParameteriv(table
, save_TexParameteriv
);
9871 SET_Translated(table
, save_Translated
);
9872 SET_Translatef(table
, save_Translatef
);
9873 SET_Viewport(table
, save_Viewport
);
9876 SET_BindTexture(table
, save_BindTexture
);
9877 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
9878 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
9879 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
9880 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
9881 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
9882 SET_TexSubImage1D(table
, save_TexSubImage1D
);
9883 SET_TexSubImage2D(table
, save_TexSubImage2D
);
9886 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
9887 SET_TexImage3D(table
, save_TexImage3D
);
9888 SET_TexSubImage3D(table
, save_TexSubImage3D
);
9891 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
9892 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
9893 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
9895 /* ATI_separate_stencil */
9896 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
9898 /* GL_ARB_imaging */
9899 /* Not all are supported */
9900 SET_BlendColor(table
, save_BlendColor
);
9901 SET_BlendEquation(table
, save_BlendEquation
);
9903 /* 2. GL_EXT_blend_color */
9905 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9908 /* 6. GL_EXT_texture3d */
9910 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9911 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9912 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9915 /* 37. GL_EXT_blend_minmax */
9917 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9920 /* 54. GL_EXT_point_parameters */
9921 SET_PointParameterf(table
, save_PointParameterfEXT
);
9922 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9924 /* 91. GL_ARB_tessellation_shader */
9925 SET_PatchParameteri(table
, save_PatchParameteri
);
9926 SET_PatchParameterfv(table
, save_PatchParameterfv
);
9928 /* 173. GL_EXT_blend_func_separate */
9929 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9931 /* 197. GL_MESA_window_pos */
9932 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9933 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9934 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9935 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9936 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9937 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9938 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9939 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9940 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9941 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9942 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9943 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9944 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9945 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9946 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9947 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9948 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9949 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9950 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9951 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9952 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9953 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9954 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9955 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9957 /* 245. GL_ATI_fragment_shader */
9958 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9959 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9961 /* 262. GL_NV_point_sprite */
9962 SET_PointParameteri(table
, save_PointParameteriNV
);
9963 SET_PointParameteriv(table
, save_PointParameterivNV
);
9965 /* 268. GL_EXT_stencil_two_side */
9966 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9968 /* ???. GL_EXT_depth_bounds_test */
9969 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9971 /* ARB 1. GL_ARB_multitexture */
9972 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9974 /* ARB 3. GL_ARB_transpose_matrix */
9975 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9976 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9977 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9978 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9980 /* ARB 5. GL_ARB_multisample */
9981 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9983 /* ARB 12. GL_ARB_texture_compression */
9984 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9985 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9986 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9987 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9988 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9989 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9991 /* ARB 14. GL_ARB_point_parameters */
9992 /* aliased with EXT_point_parameters functions */
9994 /* ARB 25. GL_ARB_window_pos */
9995 /* aliased with MESA_window_pos functions */
9997 /* ARB 26. GL_ARB_vertex_program */
9998 /* ARB 27. GL_ARB_fragment_program */
9999 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
10000 SET_ProgramStringARB(table
, save_ProgramStringARB
);
10001 SET_BindProgramARB(table
, save_BindProgramARB
);
10002 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
10003 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
10004 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
10005 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
10006 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
10007 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
10008 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
10009 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
10011 SET_BeginQuery(table
, save_BeginQueryARB
);
10012 SET_EndQuery(table
, save_EndQueryARB
);
10013 SET_QueryCounter(table
, save_QueryCounter
);
10015 SET_DrawBuffers(table
, save_DrawBuffersARB
);
10017 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
10019 SET_UseProgram(table
, save_UseProgram
);
10020 SET_Uniform1f(table
, save_Uniform1fARB
);
10021 SET_Uniform2f(table
, save_Uniform2fARB
);
10022 SET_Uniform3f(table
, save_Uniform3fARB
);
10023 SET_Uniform4f(table
, save_Uniform4fARB
);
10024 SET_Uniform1fv(table
, save_Uniform1fvARB
);
10025 SET_Uniform2fv(table
, save_Uniform2fvARB
);
10026 SET_Uniform3fv(table
, save_Uniform3fvARB
);
10027 SET_Uniform4fv(table
, save_Uniform4fvARB
);
10028 SET_Uniform1i(table
, save_Uniform1iARB
);
10029 SET_Uniform2i(table
, save_Uniform2iARB
);
10030 SET_Uniform3i(table
, save_Uniform3iARB
);
10031 SET_Uniform4i(table
, save_Uniform4iARB
);
10032 SET_Uniform1iv(table
, save_Uniform1ivARB
);
10033 SET_Uniform2iv(table
, save_Uniform2ivARB
);
10034 SET_Uniform3iv(table
, save_Uniform3ivARB
);
10035 SET_Uniform4iv(table
, save_Uniform4ivARB
);
10036 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
10037 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
10038 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
10039 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
10040 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
10041 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
10042 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
10043 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
10044 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
10046 /* 299. GL_EXT_blend_equation_separate */
10047 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
10049 /* GL_EXT_gpu_program_parameters */
10050 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
10051 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
10053 /* 364. GL_EXT_provoking_vertex */
10054 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
10056 /* GL_EXT_texture_integer */
10057 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
10058 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
10059 SET_TexParameterIiv(table
, save_TexParameterIiv
);
10060 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
10062 /* GL_ARB_clip_control */
10063 SET_ClipControl(table
, save_ClipControl
);
10065 /* GL_ARB_color_buffer_float */
10066 SET_ClampColor(table
, save_ClampColorARB
);
10069 SET_ClearBufferiv(table
, save_ClearBufferiv
);
10070 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
10071 SET_ClearBufferfv(table
, save_ClearBufferfv
);
10072 SET_ClearBufferfi(table
, save_ClearBufferfi
);
10073 SET_Uniform1ui(table
, save_Uniform1ui
);
10074 SET_Uniform2ui(table
, save_Uniform2ui
);
10075 SET_Uniform3ui(table
, save_Uniform3ui
);
10076 SET_Uniform4ui(table
, save_Uniform4ui
);
10077 SET_Uniform1uiv(table
, save_Uniform1uiv
);
10078 SET_Uniform2uiv(table
, save_Uniform2uiv
);
10079 SET_Uniform3uiv(table
, save_Uniform3uiv
);
10080 SET_Uniform4uiv(table
, save_Uniform4uiv
);
10083 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
10084 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
10085 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
10086 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
10087 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
10088 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
10089 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
10090 SET_DrawTransformFeedbackInstanced(table
,
10091 save_DrawTransformFeedbackInstanced
);
10092 SET_DrawTransformFeedbackStreamInstanced(table
,
10093 save_DrawTransformFeedbackStreamInstanced
);
10094 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
10095 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
10097 /* GL_ARB_instanced_arrays */
10098 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
10100 /* GL_NV_texture_barrier */
10101 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
10103 SET_BindSampler(table
, save_BindSampler
);
10104 SET_SamplerParameteri(table
, save_SamplerParameteri
);
10105 SET_SamplerParameterf(table
, save_SamplerParameterf
);
10106 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
10107 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
10108 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
10109 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
10111 /* GL_ARB_draw_buffer_blend */
10112 SET_BlendFunciARB(table
, save_BlendFunci
);
10113 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
10114 SET_BlendEquationiARB(table
, save_BlendEquationi
);
10115 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
10117 /* GL_NV_conditional_render */
10118 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
10119 SET_EndConditionalRender(table
, save_EndConditionalRender
);
10122 SET_WaitSync(table
, save_WaitSync
);
10124 /* GL_ARB_uniform_buffer_object */
10125 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
10127 /* GL_ARB_draw_instanced */
10128 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
10129 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
10131 /* GL_ARB_draw_elements_base_vertex */
10132 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
10134 /* GL_ARB_base_instance */
10135 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
10136 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
10137 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
10139 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
10140 SET_UseProgramStages(table
, save_UseProgramStages
);
10141 SET_ProgramUniform1f(table
, save_ProgramUniform1f
);
10142 SET_ProgramUniform2f(table
, save_ProgramUniform2f
);
10143 SET_ProgramUniform3f(table
, save_ProgramUniform3f
);
10144 SET_ProgramUniform4f(table
, save_ProgramUniform4f
);
10145 SET_ProgramUniform1fv(table
, save_ProgramUniform1fv
);
10146 SET_ProgramUniform2fv(table
, save_ProgramUniform2fv
);
10147 SET_ProgramUniform3fv(table
, save_ProgramUniform3fv
);
10148 SET_ProgramUniform4fv(table
, save_ProgramUniform4fv
);
10149 SET_ProgramUniform1i(table
, save_ProgramUniform1i
);
10150 SET_ProgramUniform2i(table
, save_ProgramUniform2i
);
10151 SET_ProgramUniform3i(table
, save_ProgramUniform3i
);
10152 SET_ProgramUniform4i(table
, save_ProgramUniform4i
);
10153 SET_ProgramUniform1iv(table
, save_ProgramUniform1iv
);
10154 SET_ProgramUniform2iv(table
, save_ProgramUniform2iv
);
10155 SET_ProgramUniform3iv(table
, save_ProgramUniform3iv
);
10156 SET_ProgramUniform4iv(table
, save_ProgramUniform4iv
);
10157 SET_ProgramUniform1ui(table
, save_ProgramUniform1ui
);
10158 SET_ProgramUniform2ui(table
, save_ProgramUniform2ui
);
10159 SET_ProgramUniform3ui(table
, save_ProgramUniform3ui
);
10160 SET_ProgramUniform4ui(table
, save_ProgramUniform4ui
);
10161 SET_ProgramUniform1uiv(table
, save_ProgramUniform1uiv
);
10162 SET_ProgramUniform2uiv(table
, save_ProgramUniform2uiv
);
10163 SET_ProgramUniform3uiv(table
, save_ProgramUniform3uiv
);
10164 SET_ProgramUniform4uiv(table
, save_ProgramUniform4uiv
);
10165 SET_ProgramUniformMatrix2fv(table
, save_ProgramUniformMatrix2fv
);
10166 SET_ProgramUniformMatrix3fv(table
, save_ProgramUniformMatrix3fv
);
10167 SET_ProgramUniformMatrix4fv(table
, save_ProgramUniformMatrix4fv
);
10168 SET_ProgramUniformMatrix2x3fv(table
, save_ProgramUniformMatrix2x3fv
);
10169 SET_ProgramUniformMatrix3x2fv(table
, save_ProgramUniformMatrix3x2fv
);
10170 SET_ProgramUniformMatrix2x4fv(table
, save_ProgramUniformMatrix2x4fv
);
10171 SET_ProgramUniformMatrix4x2fv(table
, save_ProgramUniformMatrix4x2fv
);
10172 SET_ProgramUniformMatrix3x4fv(table
, save_ProgramUniformMatrix3x4fv
);
10173 SET_ProgramUniformMatrix4x3fv(table
, save_ProgramUniformMatrix4x3fv
);
10175 /* GL_{ARB,EXT}_polygon_offset_clamp */
10176 SET_PolygonOffsetClampEXT(table
, save_PolygonOffsetClampEXT
);
10178 /* GL_EXT_window_rectangles */
10179 SET_WindowRectanglesEXT(table
, save_WindowRectanglesEXT
);
10181 /* GL_NV_conservative_raster */
10182 SET_SubpixelPrecisionBiasNV(table
, save_SubpixelPrecisionBiasNV
);
10184 /* GL_NV_conservative_raster_dilate */
10185 SET_ConservativeRasterParameterfNV(table
, save_ConservativeRasterParameterfNV
);
10187 /* GL_NV_conservative_raster_pre_snap_triangles */
10188 SET_ConservativeRasterParameteriNV(table
, save_ConservativeRasterParameteriNV
);
10193 static const char *
10194 enum_string(GLenum k
)
10196 return _mesa_enum_to_string(k
);
10201 * Print the commands in a display list. For debugging only.
10202 * TODO: many commands aren't handled yet.
10203 * \param fname filename to write display list to. If null, use stdout.
10205 static void GLAPIENTRY
10206 print_list(struct gl_context
*ctx
, GLuint list
, const char *fname
)
10208 struct gl_display_list
*dlist
;
10214 f
= fopen(fname
, "w");
10219 if (!islist(ctx
, list
)) {
10220 fprintf(f
, "%u is not a display list ID\n", list
);
10224 dlist
= _mesa_lookup_list(ctx
, list
);
10231 fprintf(f
, "START-LIST %u, address %p\n", list
, (void *) n
);
10233 done
= n
? GL_FALSE
: GL_TRUE
;
10235 const OpCode opcode
= n
[0].opcode
;
10237 if (is_ext_opcode(opcode
)) {
10238 n
+= ext_opcode_print(ctx
, n
, f
);
10243 fprintf(f
, "Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
10245 case OPCODE_ACTIVE_TEXTURE
:
10246 fprintf(f
, "ActiveTexture(%s)\n", enum_string(n
[1].e
));
10248 case OPCODE_BITMAP
:
10249 fprintf(f
, "Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
10250 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
10251 get_pointer(&n
[7]));
10253 case OPCODE_BLEND_COLOR
:
10254 fprintf(f
, "BlendColor %f, %f, %f, %f\n",
10255 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10257 case OPCODE_BLEND_EQUATION
:
10258 fprintf(f
, "BlendEquation %s\n",
10259 enum_string(n
[1].e
));
10261 case OPCODE_BLEND_EQUATION_SEPARATE
:
10262 fprintf(f
, "BlendEquationSeparate %s, %s\n",
10263 enum_string(n
[1].e
),
10264 enum_string(n
[2].e
));
10266 case OPCODE_BLEND_FUNC_SEPARATE
:
10267 fprintf(f
, "BlendFuncSeparate %s, %s, %s, %s\n",
10268 enum_string(n
[1].e
),
10269 enum_string(n
[2].e
),
10270 enum_string(n
[3].e
),
10271 enum_string(n
[4].e
));
10273 case OPCODE_BLEND_EQUATION_I
:
10274 fprintf(f
, "BlendEquationi %u, %s\n",
10275 n
[1].ui
, enum_string(n
[2].e
));
10277 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
10278 fprintf(f
, "BlendEquationSeparatei %u, %s, %s\n",
10279 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
10281 case OPCODE_BLEND_FUNC_I
:
10282 fprintf(f
, "BlendFunci %u, %s, %s\n",
10283 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
10285 case OPCODE_BLEND_FUNC_SEPARATE_I
:
10286 fprintf(f
, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
10288 enum_string(n
[2].e
),
10289 enum_string(n
[3].e
),
10290 enum_string(n
[4].e
),
10291 enum_string(n
[5].e
));
10293 case OPCODE_CALL_LIST
:
10294 fprintf(f
, "CallList %d\n", (int) n
[1].ui
);
10296 case OPCODE_CALL_LISTS
:
10297 fprintf(f
, "CallLists %d, %s\n", n
[1].i
, enum_string(n
[1].e
));
10299 case OPCODE_DISABLE
:
10300 fprintf(f
, "Disable %s\n", enum_string(n
[1].e
));
10302 case OPCODE_ENABLE
:
10303 fprintf(f
, "Enable %s\n", enum_string(n
[1].e
));
10305 case OPCODE_FRUSTUM
:
10306 fprintf(f
, "Frustum %g %g %g %g %g %g\n",
10307 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10309 case OPCODE_LINE_STIPPLE
:
10310 fprintf(f
, "LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
10312 case OPCODE_LINE_WIDTH
:
10313 fprintf(f
, "LineWidth %f\n", n
[1].f
);
10315 case OPCODE_LOAD_IDENTITY
:
10316 fprintf(f
, "LoadIdentity\n");
10318 case OPCODE_LOAD_MATRIX
:
10319 fprintf(f
, "LoadMatrix\n");
10320 fprintf(f
, " %8f %8f %8f %8f\n",
10321 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
10322 fprintf(f
, " %8f %8f %8f %8f\n",
10323 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
10324 fprintf(f
, " %8f %8f %8f %8f\n",
10325 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
10326 fprintf(f
, " %8f %8f %8f %8f\n",
10327 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
10329 case OPCODE_MULT_MATRIX
:
10330 fprintf(f
, "MultMatrix (or Rotate)\n");
10331 fprintf(f
, " %8f %8f %8f %8f\n",
10332 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
10333 fprintf(f
, " %8f %8f %8f %8f\n",
10334 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
10335 fprintf(f
, " %8f %8f %8f %8f\n",
10336 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
10337 fprintf(f
, " %8f %8f %8f %8f\n",
10338 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
10341 fprintf(f
, "Ortho %g %g %g %g %g %g\n",
10342 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10344 case OPCODE_POINT_SIZE
:
10345 fprintf(f
, "PointSize %f\n", n
[1].f
);
10347 case OPCODE_POP_ATTRIB
:
10348 fprintf(f
, "PopAttrib\n");
10350 case OPCODE_POP_MATRIX
:
10351 fprintf(f
, "PopMatrix\n");
10353 case OPCODE_POP_NAME
:
10354 fprintf(f
, "PopName\n");
10356 case OPCODE_PUSH_ATTRIB
:
10357 fprintf(f
, "PushAttrib %x\n", n
[1].bf
);
10359 case OPCODE_PUSH_MATRIX
:
10360 fprintf(f
, "PushMatrix\n");
10362 case OPCODE_PUSH_NAME
:
10363 fprintf(f
, "PushName %d\n", (int) n
[1].ui
);
10365 case OPCODE_RASTER_POS
:
10366 fprintf(f
, "RasterPos %g %g %g %g\n",
10367 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10369 case OPCODE_ROTATE
:
10370 fprintf(f
, "Rotate %g %g %g %g\n",
10371 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10374 fprintf(f
, "Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
10376 case OPCODE_TRANSLATE
:
10377 fprintf(f
, "Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
10379 case OPCODE_BIND_TEXTURE
:
10380 fprintf(f
, "BindTexture %s %d\n",
10381 _mesa_enum_to_string(n
[1].ui
), n
[2].ui
);
10383 case OPCODE_SHADE_MODEL
:
10384 fprintf(f
, "ShadeModel %s\n", _mesa_enum_to_string(n
[1].ui
));
10387 fprintf(f
, "Map1 %s %.3f %.3f %d %d\n",
10388 _mesa_enum_to_string(n
[1].ui
),
10389 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
10392 fprintf(f
, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
10393 _mesa_enum_to_string(n
[1].ui
),
10394 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
10395 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
10397 case OPCODE_MAPGRID1
:
10398 fprintf(f
, "MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
10400 case OPCODE_MAPGRID2
:
10401 fprintf(f
, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
10402 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
10404 case OPCODE_EVALMESH1
:
10405 fprintf(f
, "EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
10407 case OPCODE_EVALMESH2
:
10408 fprintf(f
, "EvalMesh2 %d %d %d %d\n",
10409 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
10412 case OPCODE_ATTR_1F_NV
:
10413 fprintf(f
, "ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
10415 case OPCODE_ATTR_2F_NV
:
10416 fprintf(f
, "ATTR_2F_NV attr %d: %f %f\n",
10417 n
[1].i
, n
[2].f
, n
[3].f
);
10419 case OPCODE_ATTR_3F_NV
:
10420 fprintf(f
, "ATTR_3F_NV attr %d: %f %f %f\n",
10421 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
10423 case OPCODE_ATTR_4F_NV
:
10424 fprintf(f
, "ATTR_4F_NV attr %d: %f %f %f %f\n",
10425 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
10427 case OPCODE_ATTR_1F_ARB
:
10428 fprintf(f
, "ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
10430 case OPCODE_ATTR_2F_ARB
:
10431 fprintf(f
, "ATTR_2F_ARB attr %d: %f %f\n",
10432 n
[1].i
, n
[2].f
, n
[3].f
);
10434 case OPCODE_ATTR_3F_ARB
:
10435 fprintf(f
, "ATTR_3F_ARB attr %d: %f %f %f\n",
10436 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
10438 case OPCODE_ATTR_4F_ARB
:
10439 fprintf(f
, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
10440 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
10443 case OPCODE_MATERIAL
:
10444 fprintf(f
, "MATERIAL %x %x: %f %f %f %f\n",
10445 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10448 fprintf(f
, "BEGIN %x\n", n
[1].i
);
10451 fprintf(f
, "END\n");
10454 fprintf(f
, "RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
10457 case OPCODE_EVAL_C1
:
10458 fprintf(f
, "EVAL_C1 %f\n", n
[1].f
);
10460 case OPCODE_EVAL_C2
:
10461 fprintf(f
, "EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
10463 case OPCODE_EVAL_P1
:
10464 fprintf(f
, "EVAL_P1 %d\n", n
[1].i
);
10466 case OPCODE_EVAL_P2
:
10467 fprintf(f
, "EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
10470 case OPCODE_PROVOKING_VERTEX
:
10471 fprintf(f
, "ProvokingVertex %s\n",
10472 _mesa_enum_to_string(n
[1].ui
));
10476 * meta opcodes/commands
10479 fprintf(f
, "Error: %s %s\n", enum_string(n
[1].e
),
10480 (const char *) get_pointer(&n
[2]));
10482 case OPCODE_CONTINUE
:
10483 fprintf(f
, "DISPLAY-LIST-CONTINUE\n");
10484 n
= (Node
*) get_pointer(&n
[1]);
10487 fprintf(f
, "NOP\n");
10489 case OPCODE_END_OF_LIST
:
10490 fprintf(f
, "END-LIST %u\n", list
);
10494 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
10496 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
10497 opcode
, (void *) n
);
10501 fprintf(f
, "command %d, %u operands\n", opcode
,
10505 /* increment n to point to next compiled command */
10506 if (opcode
!= OPCODE_CONTINUE
) {
10507 assert(InstSize
[opcode
] > 0);
10508 n
+= InstSize
[opcode
];
10522 * Clients may call this function to help debug display list problems.
10523 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
10524 * changed, or break in the future without notice.
10527 mesa_print_display_list(GLuint list
)
10529 GET_CURRENT_CONTEXT(ctx
);
10530 print_list(ctx
, list
, NULL
);
10534 /**********************************************************************/
10535 /***** Initialization *****/
10536 /**********************************************************************/
10539 save_vtxfmt_init(GLvertexformat
* vfmt
)
10541 vfmt
->ArrayElement
= _ae_ArrayElement
;
10543 vfmt
->Begin
= save_Begin
;
10545 vfmt
->CallList
= save_CallList
;
10546 vfmt
->CallLists
= save_CallLists
;
10548 vfmt
->Color3f
= save_Color3f
;
10549 vfmt
->Color3fv
= save_Color3fv
;
10550 vfmt
->Color4f
= save_Color4f
;
10551 vfmt
->Color4fv
= save_Color4fv
;
10552 vfmt
->EdgeFlag
= save_EdgeFlag
;
10553 vfmt
->End
= save_End
;
10555 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
10556 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
10557 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
10558 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
10559 vfmt
->EvalPoint1
= save_EvalPoint1
;
10560 vfmt
->EvalPoint2
= save_EvalPoint2
;
10562 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
10563 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
10564 vfmt
->Indexf
= save_Indexf
;
10565 vfmt
->Indexfv
= save_Indexfv
;
10566 vfmt
->Materialfv
= save_Materialfv
;
10567 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
10568 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
10569 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
10570 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
10571 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
10572 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
10573 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
10574 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
10575 vfmt
->Normal3f
= save_Normal3f
;
10576 vfmt
->Normal3fv
= save_Normal3fv
;
10577 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
10578 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
10579 vfmt
->TexCoord1f
= save_TexCoord1f
;
10580 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
10581 vfmt
->TexCoord2f
= save_TexCoord2f
;
10582 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
10583 vfmt
->TexCoord3f
= save_TexCoord3f
;
10584 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
10585 vfmt
->TexCoord4f
= save_TexCoord4f
;
10586 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
10587 vfmt
->Vertex2f
= save_Vertex2f
;
10588 vfmt
->Vertex2fv
= save_Vertex2fv
;
10589 vfmt
->Vertex3f
= save_Vertex3f
;
10590 vfmt
->Vertex3fv
= save_Vertex3fv
;
10591 vfmt
->Vertex4f
= save_Vertex4f
;
10592 vfmt
->Vertex4fv
= save_Vertex4fv
;
10593 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
10594 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
10595 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
10596 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
10597 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
10598 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
10599 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
10600 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
10602 vfmt
->PrimitiveRestartNV
= save_PrimitiveRestartNV
;
10607 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
10608 const GLvertexformat
*vfmt
)
10610 SET_CallList(disp
, vfmt
->CallList
);
10611 SET_CallLists(disp
, vfmt
->CallLists
);
10616 * Initialize display list state for given context.
10619 _mesa_init_display_list(struct gl_context
*ctx
)
10621 static GLboolean tableInitialized
= GL_FALSE
;
10623 /* zero-out the instruction size table, just once */
10624 if (!tableInitialized
) {
10625 memset(InstSize
, 0, sizeof(InstSize
));
10626 tableInitialized
= GL_TRUE
;
10629 /* extension info */
10630 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
10633 ctx
->ListState
.CallDepth
= 0;
10634 ctx
->ExecuteFlag
= GL_TRUE
;
10635 ctx
->CompileFlag
= GL_FALSE
;
10636 ctx
->ListState
.CurrentBlock
= NULL
;
10637 ctx
->ListState
.CurrentPos
= 0;
10639 /* Display List group */
10640 ctx
->List
.ListBase
= 0;
10642 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
10644 InstSize
[OPCODE_NOP
] = 1;
10649 _mesa_free_display_list_data(struct gl_context
*ctx
)
10651 free(ctx
->ListExt
);
10652 ctx
->ListExt
= NULL
;