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 "api_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
,
329 /* GL_ARB_shader_objects */
347 OPCODE_UNIFORM_MATRIX22
,
348 OPCODE_UNIFORM_MATRIX33
,
349 OPCODE_UNIFORM_MATRIX44
,
350 OPCODE_UNIFORM_MATRIX23
,
351 OPCODE_UNIFORM_MATRIX32
,
352 OPCODE_UNIFORM_MATRIX24
,
353 OPCODE_UNIFORM_MATRIX42
,
354 OPCODE_UNIFORM_MATRIX34
,
355 OPCODE_UNIFORM_MATRIX43
,
367 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
368 OPCODE_USE_PROGRAM_STAGES
,
369 OPCODE_PROGRAM_UNIFORM_1F
,
370 OPCODE_PROGRAM_UNIFORM_2F
,
371 OPCODE_PROGRAM_UNIFORM_3F
,
372 OPCODE_PROGRAM_UNIFORM_4F
,
373 OPCODE_PROGRAM_UNIFORM_1FV
,
374 OPCODE_PROGRAM_UNIFORM_2FV
,
375 OPCODE_PROGRAM_UNIFORM_3FV
,
376 OPCODE_PROGRAM_UNIFORM_4FV
,
377 OPCODE_PROGRAM_UNIFORM_1I
,
378 OPCODE_PROGRAM_UNIFORM_2I
,
379 OPCODE_PROGRAM_UNIFORM_3I
,
380 OPCODE_PROGRAM_UNIFORM_4I
,
381 OPCODE_PROGRAM_UNIFORM_1IV
,
382 OPCODE_PROGRAM_UNIFORM_2IV
,
383 OPCODE_PROGRAM_UNIFORM_3IV
,
384 OPCODE_PROGRAM_UNIFORM_4IV
,
385 OPCODE_PROGRAM_UNIFORM_1UI
,
386 OPCODE_PROGRAM_UNIFORM_2UI
,
387 OPCODE_PROGRAM_UNIFORM_3UI
,
388 OPCODE_PROGRAM_UNIFORM_4UI
,
389 OPCODE_PROGRAM_UNIFORM_1UIV
,
390 OPCODE_PROGRAM_UNIFORM_2UIV
,
391 OPCODE_PROGRAM_UNIFORM_3UIV
,
392 OPCODE_PROGRAM_UNIFORM_4UIV
,
393 OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
394 OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
395 OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
396 OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
397 OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
398 OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
399 OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
400 OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
401 OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
403 /* GL_ARB_clip_control */
406 /* GL_ARB_color_buffer_float */
409 /* GL_EXT_framebuffer_blit */
410 OPCODE_BLIT_FRAMEBUFFER
,
412 /* Vertex attributes -- fallback for when optimized display
413 * list build isn't active.
432 /* GL_EXT_provoking_vertex */
433 OPCODE_PROVOKING_VERTEX
,
435 /* GL_EXT_transform_feedback */
436 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
437 OPCODE_END_TRANSFORM_FEEDBACK
,
438 OPCODE_BIND_TRANSFORM_FEEDBACK
,
439 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
440 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
441 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
443 /* GL_EXT_texture_integer */
445 OPCODE_CLEARCOLOR_UI
,
446 OPCODE_TEXPARAMETER_I
,
447 OPCODE_TEXPARAMETER_UI
,
449 /* GL_ARB_instanced_arrays */
450 OPCODE_VERTEX_ATTRIB_DIVISOR
,
452 /* GL_NV_texture_barrier */
453 OPCODE_TEXTURE_BARRIER_NV
,
455 /* GL_ARB_sampler_object */
457 OPCODE_SAMPLER_PARAMETERIV
,
458 OPCODE_SAMPLER_PARAMETERFV
,
459 OPCODE_SAMPLER_PARAMETERIIV
,
460 OPCODE_SAMPLER_PARAMETERUIV
,
465 /* GL_NV_conditional_render */
466 OPCODE_BEGIN_CONDITIONAL_RENDER
,
467 OPCODE_END_CONDITIONAL_RENDER
,
469 /* ARB_timer_query */
470 OPCODE_QUERY_COUNTER
,
472 /* ARB_transform_feedback3 */
473 OPCODE_BEGIN_QUERY_INDEXED
,
474 OPCODE_END_QUERY_INDEXED
,
475 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
477 /* ARB_transform_feedback_instanced */
478 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
479 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
481 /* ARB_uniform_buffer_object */
482 OPCODE_UNIFORM_BLOCK_BINDING
,
484 /* EXT_polygon_offset_clamp */
485 OPCODE_POLYGON_OFFSET_CLAMP
,
487 /* EXT_window_rectangles */
488 OPCODE_WINDOW_RECTANGLES
,
490 /* The following three are meta instructions */
491 OPCODE_ERROR
, /* raise compiled-in error */
493 OPCODE_NOP
, /* No-op (used for 8-byte alignment */
503 * Display list instructions are stored as sequences of "nodes". Nodes
504 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
505 * are linked together with a pointer.
507 * Each instruction in the display list is stored as a sequence of
508 * contiguous nodes in memory.
509 * Each node is the union of a variety of data types.
511 * Note, all of these members should be 4 bytes in size or less for the
512 * sake of compact display lists. We store 8-byte pointers in a pair of
513 * these nodes using the save/get_pointer() functions below.
531 typedef union gl_dlist_node Node
;
534 /** How many 4-byte dwords to store a pointer */
535 #define POINTER_DWORDS (sizeof(void *) / 4)
537 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
538 * space for display lists. The following types and functions are
539 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
544 GLuint dwords
[POINTER_DWORDS
];
549 * Save a 4 or 8-byte pointer at dest (and dest+1).
552 save_pointer(Node
*dest
, void *src
)
557 STATIC_ASSERT(POINTER_DWORDS
== 1 || POINTER_DWORDS
== 2);
558 STATIC_ASSERT(sizeof(Node
) == 4);
562 for (i
= 0; i
< POINTER_DWORDS
; i
++)
563 dest
[i
].ui
= p
.dwords
[i
];
568 * Retrieve a 4 or 8-byte pointer from node (node+1).
571 get_pointer(const Node
*node
)
576 for (i
= 0; i
< POINTER_DWORDS
; i
++)
577 p
.dwords
[i
] = node
[i
].ui
;
584 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
595 * How many nodes to allocate at a time. Note that bulk vertex data
596 * from glBegin/glVertex/glEnd primitives will typically wind up in
597 * a VBO, and not directly in the display list itself.
599 #define BLOCK_SIZE 256
604 * Number of nodes of storage needed for each instruction.
605 * Sizes for dynamically allocated opcodes are stored in the context struct.
607 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
610 void mesa_print_display_list(GLuint list
);
614 * Does the given display list only contain a single glBitmap call?
617 is_bitmap_list(const struct gl_display_list
*dlist
)
619 const Node
*n
= dlist
->Head
;
620 if (n
[0].opcode
== OPCODE_BITMAP
) {
621 n
+= InstSize
[OPCODE_BITMAP
];
622 if (n
[0].opcode
== OPCODE_END_OF_LIST
)
630 * Is the given display list an empty list?
633 is_empty_list(const struct gl_display_list
*dlist
)
635 const Node
*n
= dlist
->Head
;
636 return n
[0].opcode
== OPCODE_END_OF_LIST
;
641 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
644 _mesa_delete_bitmap_atlas(struct gl_context
*ctx
, struct gl_bitmap_atlas
*atlas
)
647 ctx
->Driver
.DeleteTexture(ctx
, atlas
->texObj
);
654 * Lookup a gl_bitmap_atlas by listBase ID.
656 static struct gl_bitmap_atlas
*
657 lookup_bitmap_atlas(struct gl_context
*ctx
, GLuint listBase
)
659 struct gl_bitmap_atlas
*atlas
;
661 assert(listBase
> 0);
662 atlas
= _mesa_HashLookup(ctx
->Shared
->BitmapAtlas
, listBase
);
668 * Create new bitmap atlas and insert into hash table.
670 static struct gl_bitmap_atlas
*
671 alloc_bitmap_atlas(struct gl_context
*ctx
, GLuint listBase
)
673 struct gl_bitmap_atlas
*atlas
;
675 assert(listBase
> 0);
676 assert(_mesa_HashLookup(ctx
->Shared
->BitmapAtlas
, listBase
) == NULL
);
678 atlas
= calloc(1, sizeof(*atlas
));
680 _mesa_HashInsert(ctx
->Shared
->BitmapAtlas
, listBase
, atlas
);
688 * Try to build a bitmap atlas. This involves examining a sequence of
689 * display lists which contain glBitmap commands and putting the bitmap
690 * images into a texture map (the atlas).
691 * If we succeed, gl_bitmap_atlas::complete will be set to true.
692 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
695 build_bitmap_atlas(struct gl_context
*ctx
, struct gl_bitmap_atlas
*atlas
,
698 unsigned i
, row_height
= 0, xpos
= 0, ypos
= 0;
703 assert(!atlas
->complete
);
704 assert(atlas
->numBitmaps
> 0);
706 /* We use a rectangle texture (non-normalized coords) for the atlas */
707 assert(ctx
->Extensions
.NV_texture_rectangle
);
708 assert(ctx
->Const
.MaxTextureRectSize
>= 1024);
710 atlas
->texWidth
= 1024;
711 atlas
->texHeight
= 0; /* determined below */
713 atlas
->glyphs
= malloc(atlas
->numBitmaps
* sizeof(atlas
->glyphs
[0]));
714 if (!atlas
->glyphs
) {
716 atlas
->incomplete
= true;
720 /* Loop over the display lists. They should all contain a single glBitmap
721 * call. If not, bail out. Also, compute the position and sizes of each
722 * bitmap in the atlas to determine the texture atlas size.
724 for (i
= 0; i
< atlas
->numBitmaps
; i
++) {
725 const struct gl_display_list
*list
= _mesa_lookup_list(ctx
, listBase
+ i
);
727 struct gl_bitmap_glyph
*g
= &atlas
->glyphs
[i
];
728 unsigned bitmap_width
, bitmap_height
;
729 float bitmap_xmove
, bitmap_ymove
, bitmap_xorig
, bitmap_yorig
;
731 if (!list
|| is_empty_list(list
)) {
733 atlas
->numBitmaps
= i
;
737 if (!is_bitmap_list(list
)) {
738 /* This list does not contain exactly one glBitmap command. Give up. */
739 atlas
->incomplete
= true;
743 /* get bitmap info from the display list command */
745 assert(n
[0].opcode
== OPCODE_BITMAP
);
746 bitmap_width
= n
[1].i
;
747 bitmap_height
= n
[2].i
;
748 bitmap_xorig
= n
[3].f
;
749 bitmap_yorig
= n
[4].f
;
750 bitmap_xmove
= n
[5].f
;
751 bitmap_ymove
= n
[6].f
;
753 if (xpos
+ bitmap_width
> atlas
->texWidth
) {
754 /* advance to the next row of the texture */
760 /* save the bitmap's position in the atlas */
764 g
->h
= bitmap_height
;
765 g
->xorig
= bitmap_xorig
;
766 g
->yorig
= bitmap_yorig
;
767 g
->xmove
= bitmap_xmove
;
768 g
->ymove
= bitmap_ymove
;
770 xpos
+= bitmap_width
;
772 /* keep track of tallest bitmap in the row */
773 row_height
= MAX2(row_height
, bitmap_height
);
776 /* Now we know the texture height */
777 atlas
->texHeight
= ypos
+ row_height
;
779 if (atlas
->texHeight
== 0) {
780 /* no glyphs found, give up */
783 else if (atlas
->texHeight
> ctx
->Const
.MaxTextureRectSize
) {
784 /* too large, give up */
788 /* Create atlas texture (texture ID is irrelevant) */
789 atlas
->texObj
= ctx
->Driver
.NewTextureObject(ctx
, 999, GL_TEXTURE_RECTANGLE
);
790 if (!atlas
->texObj
) {
794 atlas
->texObj
->Sampler
.MinFilter
= GL_NEAREST
;
795 atlas
->texObj
->Sampler
.MagFilter
= GL_NEAREST
;
796 atlas
->texObj
->MaxLevel
= 0;
797 atlas
->texObj
->Immutable
= GL_TRUE
;
799 atlas
->texImage
= _mesa_get_tex_image(ctx
, atlas
->texObj
,
800 GL_TEXTURE_RECTANGLE
, 0);
801 if (!atlas
->texImage
) {
805 _mesa_init_teximage_fields(ctx
, atlas
->texImage
,
806 atlas
->texWidth
, atlas
->texHeight
, 1, 0,
807 GL_ALPHA
, MESA_FORMAT_A_UNORM8
);
809 /* alloc image storage */
810 if (!ctx
->Driver
.AllocTextureImageBuffer(ctx
, atlas
->texImage
)) {
814 /* map teximage, load with bitmap glyphs */
815 ctx
->Driver
.MapTextureImage(ctx
, atlas
->texImage
, 0,
816 0, 0, atlas
->texWidth
, atlas
->texHeight
,
817 GL_MAP_WRITE_BIT
, &map
, &map_stride
);
822 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
823 memset(map
, 0xff, map_stride
* atlas
->texHeight
);
825 for (i
= 0; i
< atlas
->numBitmaps
; i
++) {
826 const struct gl_display_list
*list
= _mesa_lookup_list(ctx
, listBase
+ i
);
827 const Node
*n
= list
->Head
;
829 assert(n
[0].opcode
== OPCODE_BITMAP
||
830 n
[0].opcode
== OPCODE_END_OF_LIST
);
832 if (n
[0].opcode
== OPCODE_BITMAP
) {
833 unsigned bitmap_width
= n
[1].i
;
834 unsigned bitmap_height
= n
[2].i
;
835 unsigned xpos
= atlas
->glyphs
[i
].x
;
836 unsigned ypos
= atlas
->glyphs
[i
].y
;
837 const void *bitmap_image
= get_pointer(&n
[7]);
839 assert(atlas
->glyphs
[i
].w
== bitmap_width
);
840 assert(atlas
->glyphs
[i
].h
== bitmap_height
);
842 /* put the bitmap image into the texture image */
843 _mesa_expand_bitmap(bitmap_width
, bitmap_height
,
844 &ctx
->DefaultPacking
, bitmap_image
,
845 map
+ map_stride
* ypos
+ xpos
, /* dest addr */
850 ctx
->Driver
.UnmapTextureImage(ctx
, atlas
->texImage
, 0);
852 atlas
->complete
= true;
857 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Display list bitmap atlas");
860 ctx
->Driver
.DeleteTexture(ctx
, atlas
->texObj
);
863 atlas
->glyphs
= NULL
;
864 atlas
->incomplete
= true;
869 * Allocate a gl_display_list object with an initial block of storage.
870 * \param count how many display list nodes/tokens to allocate
872 static struct gl_display_list
*
873 make_list(GLuint name
, GLuint count
)
875 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
877 dlist
->Head
= malloc(sizeof(Node
) * count
);
878 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
884 * Lookup function to just encapsulate casting.
886 struct gl_display_list
*
887 _mesa_lookup_list(struct gl_context
*ctx
, GLuint list
)
889 return (struct gl_display_list
*)
890 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
894 /** Is the given opcode an extension code? */
895 static inline GLboolean
896 is_ext_opcode(OpCode opcode
)
898 return (opcode
>= OPCODE_EXT_0
);
902 /** Destroy an extended opcode instruction */
904 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
906 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
908 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
909 step
= ctx
->ListExt
->Opcode
[i
].Size
;
914 /** Execute an extended opcode instruction */
916 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
918 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
920 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
921 step
= ctx
->ListExt
->Opcode
[i
].Size
;
926 /** Print an extended opcode instruction */
928 ext_opcode_print(struct gl_context
*ctx
, Node
*node
, FILE *f
)
930 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
932 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1], f
);
933 step
= ctx
->ListExt
->Opcode
[i
].Size
;
939 * Delete the named display list, but don't remove from hash table.
940 * \param dlist - display list pointer
943 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
948 n
= block
= dlist
->Head
;
950 done
= block
? GL_FALSE
: GL_TRUE
;
952 const OpCode opcode
= n
[0].opcode
;
954 /* check for extension opcodes first */
955 if (is_ext_opcode(opcode
)) {
956 n
+= ext_opcode_destroy(ctx
, n
);
960 /* for some commands, we need to free malloc'd memory */
962 free(get_pointer(&n
[6]));
963 n
+= InstSize
[n
[0].opcode
];
966 free(get_pointer(&n
[10]));
967 n
+= InstSize
[n
[0].opcode
];
969 case OPCODE_CALL_LISTS
:
970 free(get_pointer(&n
[3]));
971 n
+= InstSize
[n
[0].opcode
];
973 case OPCODE_DRAW_PIXELS
:
974 free(get_pointer(&n
[5]));
975 n
+= InstSize
[n
[0].opcode
];
978 free(get_pointer(&n
[7]));
979 n
+= InstSize
[n
[0].opcode
];
981 case OPCODE_POLYGON_STIPPLE
:
982 free(get_pointer(&n
[1]));
983 n
+= InstSize
[n
[0].opcode
];
985 case OPCODE_TEX_IMAGE1D
:
986 free(get_pointer(&n
[8]));
987 n
+= InstSize
[n
[0].opcode
];
989 case OPCODE_TEX_IMAGE2D
:
990 free(get_pointer(&n
[9]));
991 n
+= InstSize
[n
[0].opcode
];
993 case OPCODE_TEX_IMAGE3D
:
994 free(get_pointer(&n
[10]));
995 n
+= InstSize
[n
[0].opcode
];
997 case OPCODE_TEX_SUB_IMAGE1D
:
998 free(get_pointer(&n
[7]));
999 n
+= InstSize
[n
[0].opcode
];
1001 case OPCODE_TEX_SUB_IMAGE2D
:
1002 free(get_pointer(&n
[9]));
1003 n
+= InstSize
[n
[0].opcode
];
1005 case OPCODE_TEX_SUB_IMAGE3D
:
1006 free(get_pointer(&n
[11]));
1007 n
+= InstSize
[n
[0].opcode
];
1009 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
1010 free(get_pointer(&n
[7]));
1011 n
+= InstSize
[n
[0].opcode
];
1013 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
1014 free(get_pointer(&n
[8]));
1015 n
+= InstSize
[n
[0].opcode
];
1017 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
1018 free(get_pointer(&n
[9]));
1019 n
+= InstSize
[n
[0].opcode
];
1021 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
1022 free(get_pointer(&n
[7]));
1023 n
+= InstSize
[n
[0].opcode
];
1025 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
1026 free(get_pointer(&n
[9]));
1027 n
+= InstSize
[n
[0].opcode
];
1029 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
1030 free(get_pointer(&n
[11]));
1031 n
+= InstSize
[n
[0].opcode
];
1033 case OPCODE_PROGRAM_STRING_ARB
:
1034 free(get_pointer(&n
[4])); /* program string */
1035 n
+= InstSize
[n
[0].opcode
];
1037 case OPCODE_UNIFORM_1FV
:
1038 case OPCODE_UNIFORM_2FV
:
1039 case OPCODE_UNIFORM_3FV
:
1040 case OPCODE_UNIFORM_4FV
:
1041 case OPCODE_UNIFORM_1IV
:
1042 case OPCODE_UNIFORM_2IV
:
1043 case OPCODE_UNIFORM_3IV
:
1044 case OPCODE_UNIFORM_4IV
:
1045 case OPCODE_UNIFORM_1UIV
:
1046 case OPCODE_UNIFORM_2UIV
:
1047 case OPCODE_UNIFORM_3UIV
:
1048 case OPCODE_UNIFORM_4UIV
:
1049 free(get_pointer(&n
[3]));
1050 n
+= InstSize
[n
[0].opcode
];
1052 case OPCODE_UNIFORM_MATRIX22
:
1053 case OPCODE_UNIFORM_MATRIX33
:
1054 case OPCODE_UNIFORM_MATRIX44
:
1055 case OPCODE_UNIFORM_MATRIX24
:
1056 case OPCODE_UNIFORM_MATRIX42
:
1057 case OPCODE_UNIFORM_MATRIX23
:
1058 case OPCODE_UNIFORM_MATRIX32
:
1059 case OPCODE_UNIFORM_MATRIX34
:
1060 case OPCODE_UNIFORM_MATRIX43
:
1061 free(get_pointer(&n
[4]));
1062 n
+= InstSize
[n
[0].opcode
];
1064 case OPCODE_PROGRAM_UNIFORM_1FV
:
1065 case OPCODE_PROGRAM_UNIFORM_2FV
:
1066 case OPCODE_PROGRAM_UNIFORM_3FV
:
1067 case OPCODE_PROGRAM_UNIFORM_4FV
:
1068 case OPCODE_PROGRAM_UNIFORM_1IV
:
1069 case OPCODE_PROGRAM_UNIFORM_2IV
:
1070 case OPCODE_PROGRAM_UNIFORM_3IV
:
1071 case OPCODE_PROGRAM_UNIFORM_4IV
:
1072 case OPCODE_PROGRAM_UNIFORM_1UIV
:
1073 case OPCODE_PROGRAM_UNIFORM_2UIV
:
1074 case OPCODE_PROGRAM_UNIFORM_3UIV
:
1075 case OPCODE_PROGRAM_UNIFORM_4UIV
:
1076 free(get_pointer(&n
[4]));
1077 n
+= InstSize
[n
[0].opcode
];
1079 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
1080 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
1081 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
1082 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
1083 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
1084 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
1085 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
1086 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
1087 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
1088 free(get_pointer(&n
[5]));
1089 n
+= InstSize
[n
[0].opcode
];
1091 case OPCODE_PIXEL_MAP
:
1092 free(get_pointer(&n
[3]));
1093 n
+= InstSize
[n
[0].opcode
];
1095 case OPCODE_WINDOW_RECTANGLES
:
1096 free(get_pointer(&n
[3]));
1097 n
+= InstSize
[n
[0].opcode
];
1099 case OPCODE_CONTINUE
:
1100 n
= (Node
*) get_pointer(&n
[1]);
1104 case OPCODE_END_OF_LIST
:
1109 /* Most frequent case */
1110 n
+= InstSize
[n
[0].opcode
];
1122 * Called by _mesa_HashWalk() to check if a display list which is being
1123 * deleted belongs to a bitmap texture atlas.
1126 check_atlas_for_deleted_list(GLuint atlas_id
, void *data
, void *userData
)
1128 struct gl_bitmap_atlas
*atlas
= (struct gl_bitmap_atlas
*) data
;
1129 GLuint list_id
= *((GLuint
*) userData
); /* the list being deleted */
1131 /* See if the list_id falls in the range contained in this texture atlas */
1132 if (atlas
->complete
&&
1133 list_id
>= atlas_id
&&
1134 list_id
< atlas_id
+ atlas
->numBitmaps
) {
1135 /* Mark the atlas as incomplete so it doesn't get used. But don't
1136 * delete it yet since we don't want to try to recreate it in the next
1139 atlas
->complete
= false;
1140 atlas
->incomplete
= true;
1146 * Destroy a display list and remove from hash table.
1147 * \param list - display list number
1150 destroy_list(struct gl_context
*ctx
, GLuint list
)
1152 struct gl_display_list
*dlist
;
1157 dlist
= _mesa_lookup_list(ctx
, list
);
1161 if (is_bitmap_list(dlist
)) {
1162 /* If we're destroying a simple glBitmap display list, there's a
1163 * chance that we're destroying a bitmap image that's in a texture
1164 * atlas. Examine all atlases to see if that's the case. There's
1165 * usually few (if any) atlases so this isn't expensive.
1167 _mesa_HashWalk(ctx
->Shared
->BitmapAtlas
,
1168 check_atlas_for_deleted_list
, &list
);
1171 _mesa_delete_list(ctx
, dlist
);
1172 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
1177 * Translate the nth element of list from <type> to GLint.
1180 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
1192 bptr
= (GLbyte
*) list
;
1193 return (GLint
) bptr
[n
];
1194 case GL_UNSIGNED_BYTE
:
1195 ubptr
= (GLubyte
*) list
;
1196 return (GLint
) ubptr
[n
];
1198 sptr
= (GLshort
*) list
;
1199 return (GLint
) sptr
[n
];
1200 case GL_UNSIGNED_SHORT
:
1201 usptr
= (GLushort
*) list
;
1202 return (GLint
) usptr
[n
];
1204 iptr
= (GLint
*) list
;
1206 case GL_UNSIGNED_INT
:
1207 uiptr
= (GLuint
*) list
;
1208 return (GLint
) uiptr
[n
];
1210 fptr
= (GLfloat
*) list
;
1211 return (GLint
) floorf(fptr
[n
]);
1213 ubptr
= ((GLubyte
*) list
) + 2 * n
;
1214 return (GLint
) ubptr
[0] * 256
1217 ubptr
= ((GLubyte
*) list
) + 3 * n
;
1218 return (GLint
) ubptr
[0] * 65536
1219 + (GLint
) ubptr
[1] * 256
1222 ubptr
= ((GLubyte
*) list
) + 4 * n
;
1223 return (GLint
) ubptr
[0] * 16777216
1224 + (GLint
) ubptr
[1] * 65536
1225 + (GLint
) ubptr
[2] * 256
1234 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1235 * If width < 0 or height < 0 or format or type are invalid we'll just
1236 * return NULL. We will not generate an error since OpenGL command
1237 * arguments aren't error-checked until the command is actually executed
1238 * (not when they're compiled).
1239 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1242 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
1243 GLsizei width
, GLsizei height
, GLsizei depth
,
1244 GLenum format
, GLenum type
, const GLvoid
* pixels
,
1245 const struct gl_pixelstore_attrib
*unpack
)
1247 if (width
<= 0 || height
<= 0) {
1251 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
1252 /* bad format and/or type */
1256 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
1260 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
1261 format
, type
, pixels
, unpack
);
1262 if (pixels
&& !image
) {
1263 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1267 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
1268 depth
, format
, type
, INT_MAX
, pixels
)) {
1269 const GLubyte
*map
, *src
;
1273 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
1274 GL_MAP_READ_BIT
, unpack
->BufferObj
,
1277 /* unable to map src buffer! */
1278 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
1282 src
= ADD_POINTERS(map
, pixels
);
1283 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
1284 format
, type
, src
, unpack
);
1286 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
, MAP_INTERNAL
);
1289 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1295 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
1300 /** Return copy of memory */
1302 memdup(const void *src
, GLsizei bytes
)
1304 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
1306 memcpy(b
, src
, bytes
);
1312 * Allocate space for a display list instruction (opcode + payload space).
1313 * \param opcode the instruction opcode (OPCODE_* value)
1314 * \param bytes instruction payload size (not counting opcode)
1315 * \param align8 does the payload need to be 8-byte aligned?
1316 * This is only relevant in 64-bit environments.
1317 * \return pointer to allocated memory (the payload will be at pointer+1)
1320 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
, bool align8
)
1322 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
1323 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
1327 if (opcode
< OPCODE_EXT_0
) {
1328 if (InstSize
[opcode
] == 0) {
1329 /* save instruction size now */
1330 InstSize
[opcode
] = numNodes
;
1333 /* make sure instruction size agrees */
1334 assert(numNodes
== InstSize
[opcode
]);
1338 if (sizeof(void *) > sizeof(Node
) && align8
1339 && ctx
->ListState
.CurrentPos
% 2 == 0) {
1340 /* The opcode would get placed at node[0] and the payload would start
1341 * at node[1]. But the payload needs to be at an even offset (8-byte
1350 if (ctx
->ListState
.CurrentPos
+ nopNode
+ numNodes
+ contNodes
1352 /* This block is full. Allocate a new block and chain to it */
1354 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1355 n
[0].opcode
= OPCODE_CONTINUE
;
1356 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
1358 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
1362 /* a fresh block should be 8-byte aligned on 64-bit systems */
1363 assert(((GLintptr
) newblock
) % sizeof(void *) == 0);
1365 save_pointer(&n
[1], newblock
);
1366 ctx
->ListState
.CurrentBlock
= newblock
;
1367 ctx
->ListState
.CurrentPos
= 0;
1369 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1370 * we have to insert a NOP so that the payload of the real opcode lands
1371 * on an even location:
1372 * node[0] = OPCODE_NOP
1373 * node[1] = OPCODE_x;
1374 * node[2] = start of payload
1376 nopNode
= sizeof(void *) > sizeof(Node
) && align8
;
1379 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1381 assert(ctx
->ListState
.CurrentPos
% 2 == 0); /* even value */
1382 n
[0].opcode
= OPCODE_NOP
;
1384 /* The "real" opcode will now be at an odd location and the payload
1385 * will be at an even location.
1388 ctx
->ListState
.CurrentPos
+= nopNode
+ numNodes
;
1390 n
[0].opcode
= opcode
;
1398 * Allocate space for a display list instruction. Used by callers outside
1399 * this file for things like VBO vertex data.
1401 * \param opcode the instruction opcode (OPCODE_* value)
1402 * \param bytes instruction size in bytes, not counting opcode.
1403 * \return pointer to the usable data area (not including the internal
1407 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1409 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, false);
1411 return n
+ 1; /* return pointer to payload area, after opcode */
1418 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1419 * aligned in 64-bit environments, 4-byte aligned otherwise.
1422 _mesa_dlist_alloc_aligned(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1424 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, true);
1426 return n
+ 1; /* return pointer to payload area, after opcode */
1433 * This function allows modules and drivers to get their own opcodes
1434 * for extending display list functionality.
1435 * \param ctx the rendering context
1436 * \param size number of bytes for storing the new display list command
1437 * \param execute function to execute the new display list command
1438 * \param destroy function to destroy the new display list command
1439 * \param print function to print the new display list command
1440 * \return the new opcode number or -1 if error
1443 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1445 void (*execute
) (struct gl_context
*, void *),
1446 void (*destroy
) (struct gl_context
*, void *),
1447 void (*print
) (struct gl_context
*, void *, FILE *))
1449 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1450 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1451 ctx
->ListExt
->Opcode
[i
].Size
=
1452 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1453 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1454 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1455 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1456 return i
+ OPCODE_EXT_0
;
1463 * Allocate space for a display list instruction. The space is basically
1464 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1465 * function parameter, node[2] is the second parameter, etc.
1467 * \param opcode one of OPCODE_x
1468 * \param nparams number of function parameters
1469 * \return pointer to start of instruction space
1471 static inline Node
*
1472 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1474 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
), false);
1479 * Called by EndList to try to reduce memory used for the list.
1482 trim_list(struct gl_context
*ctx
)
1484 /* If the list we're ending only has one allocated block of nodes/tokens
1485 * and its size isn't a full block size, realloc the block to use less
1486 * memory. This is important for apps that create many small display
1487 * lists and apps that use glXUseXFont (many lists each containing one
1489 * Note: we currently only trim display lists that allocated one block
1490 * of tokens. That hits the short list case which is what we're mainly
1491 * concerned with. Trimming longer lists would involve traversing the
1492 * linked list of blocks.
1494 struct gl_dlist_state
*list
= &ctx
->ListState
;
1496 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1497 (list
->CurrentPos
< BLOCK_SIZE
)) {
1498 /* There's only one block and it's not full, so realloc */
1499 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1500 list
->CurrentList
->Head
=
1501 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1502 if (!list
->CurrentBlock
) {
1503 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1511 * Display List compilation functions
1513 static void GLAPIENTRY
1514 save_Accum(GLenum op
, GLfloat value
)
1516 GET_CURRENT_CONTEXT(ctx
);
1518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1519 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1524 if (ctx
->ExecuteFlag
) {
1525 CALL_Accum(ctx
->Exec
, (op
, value
));
1530 static void GLAPIENTRY
1531 save_AlphaFunc(GLenum func
, GLclampf ref
)
1533 GET_CURRENT_CONTEXT(ctx
);
1535 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1536 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1539 n
[2].f
= (GLfloat
) ref
;
1541 if (ctx
->ExecuteFlag
) {
1542 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1547 static void GLAPIENTRY
1548 save_BindTexture(GLenum target
, GLuint texture
)
1550 GET_CURRENT_CONTEXT(ctx
);
1552 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1553 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1558 if (ctx
->ExecuteFlag
) {
1559 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1564 static void GLAPIENTRY
1565 save_Bitmap(GLsizei width
, GLsizei height
,
1566 GLfloat xorig
, GLfloat yorig
,
1567 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1569 GET_CURRENT_CONTEXT(ctx
);
1571 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1572 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1574 n
[1].i
= (GLint
) width
;
1575 n
[2].i
= (GLint
) height
;
1581 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1582 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1584 if (ctx
->ExecuteFlag
) {
1585 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1586 xorig
, yorig
, xmove
, ymove
, pixels
));
1591 static void GLAPIENTRY
1592 save_BlendEquation(GLenum mode
)
1594 GET_CURRENT_CONTEXT(ctx
);
1596 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1597 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1601 if (ctx
->ExecuteFlag
) {
1602 CALL_BlendEquation(ctx
->Exec
, (mode
));
1607 static void GLAPIENTRY
1608 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1610 GET_CURRENT_CONTEXT(ctx
);
1612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1613 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1618 if (ctx
->ExecuteFlag
) {
1619 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1624 static void GLAPIENTRY
1625 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1626 GLenum sfactorA
, GLenum dfactorA
)
1628 GET_CURRENT_CONTEXT(ctx
);
1630 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1631 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1633 n
[1].e
= sfactorRGB
;
1634 n
[2].e
= dfactorRGB
;
1638 if (ctx
->ExecuteFlag
) {
1639 CALL_BlendFuncSeparate(ctx
->Exec
,
1640 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1645 static void GLAPIENTRY
1646 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1648 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1652 static void GLAPIENTRY
1653 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1655 GET_CURRENT_CONTEXT(ctx
);
1657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1658 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1665 if (ctx
->ExecuteFlag
) {
1666 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1670 /* GL_ARB_draw_buffers_blend */
1671 static void GLAPIENTRY
1672 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1673 GLenum sfactorA
, GLenum dfactorA
)
1675 GET_CURRENT_CONTEXT(ctx
);
1677 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1678 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1681 n
[2].e
= sfactorRGB
;
1682 n
[3].e
= dfactorRGB
;
1686 if (ctx
->ExecuteFlag
) {
1687 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1688 sfactorA
, dfactorA
));
1692 /* GL_ARB_draw_buffers_blend */
1693 static void GLAPIENTRY
1694 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1696 GET_CURRENT_CONTEXT(ctx
);
1698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1699 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_I
, 3);
1705 if (ctx
->ExecuteFlag
) {
1706 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1710 /* GL_ARB_draw_buffers_blend */
1711 static void GLAPIENTRY
1712 save_BlendEquationi(GLuint buf
, GLenum mode
)
1714 GET_CURRENT_CONTEXT(ctx
);
1716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1717 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1722 if (ctx
->ExecuteFlag
) {
1723 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1727 /* GL_ARB_draw_buffers_blend */
1728 static void GLAPIENTRY
1729 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1731 GET_CURRENT_CONTEXT(ctx
);
1733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1734 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1740 if (ctx
->ExecuteFlag
) {
1741 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1746 /* GL_ARB_draw_instanced. */
1747 static void GLAPIENTRY
1748 save_DrawArraysInstancedARB(UNUSED GLenum mode
,
1750 UNUSED GLsizei count
,
1751 UNUSED GLsizei primcount
)
1753 GET_CURRENT_CONTEXT(ctx
);
1754 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1755 "glDrawArraysInstanced() during display list compile");
1758 static void GLAPIENTRY
1759 save_DrawElementsInstancedARB(UNUSED GLenum mode
,
1760 UNUSED GLsizei count
,
1762 UNUSED
const GLvoid
*indices
,
1763 UNUSED GLsizei primcount
)
1765 GET_CURRENT_CONTEXT(ctx
);
1766 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1767 "glDrawElementsInstanced() during display list compile");
1770 static void GLAPIENTRY
1771 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode
,
1772 UNUSED GLsizei count
,
1774 UNUSED
const GLvoid
*indices
,
1775 UNUSED GLsizei primcount
,
1776 UNUSED GLint basevertex
)
1778 GET_CURRENT_CONTEXT(ctx
);
1779 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1780 "glDrawElementsInstancedBaseVertex() during display list compile");
1783 /* GL_ARB_base_instance. */
1784 static void GLAPIENTRY
1785 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode
,
1787 UNUSED GLsizei count
,
1788 UNUSED GLsizei primcount
,
1789 UNUSED GLuint baseinstance
)
1791 GET_CURRENT_CONTEXT(ctx
);
1792 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1793 "glDrawArraysInstancedBaseInstance() during display list compile");
1796 static void APIENTRY
1797 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode
,
1798 UNUSED GLsizei count
,
1800 UNUSED
const void *indices
,
1801 UNUSED GLsizei primcount
,
1802 UNUSED GLuint baseinstance
)
1804 GET_CURRENT_CONTEXT(ctx
);
1805 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1806 "glDrawElementsInstancedBaseInstance() during display list compile");
1809 static void APIENTRY
1810 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode
,
1811 UNUSED GLsizei count
,
1813 UNUSED
const void *indices
,
1814 UNUSED GLsizei primcount
,
1815 UNUSED GLint basevertex
,
1816 UNUSED GLuint baseinstance
)
1818 GET_CURRENT_CONTEXT(ctx
);
1819 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1820 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1825 * While building a display list we cache some OpenGL state.
1826 * Under some circumstances we need to invalidate that state (immediately
1827 * when we start compiling a list, or after glCallList(s)).
1830 invalidate_saved_current_state(struct gl_context
*ctx
)
1834 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1835 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1837 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1838 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1840 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1842 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1846 static void GLAPIENTRY
1847 save_CallList(GLuint list
)
1849 GET_CURRENT_CONTEXT(ctx
);
1851 SAVE_FLUSH_VERTICES(ctx
);
1853 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1858 /* After this, we don't know what state we're in. Invalidate all
1859 * cached information previously gathered:
1861 invalidate_saved_current_state( ctx
);
1863 if (ctx
->ExecuteFlag
) {
1864 _mesa_CallList(list
);
1869 static void GLAPIENTRY
1870 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1872 GET_CURRENT_CONTEXT(ctx
);
1877 SAVE_FLUSH_VERTICES(ctx
);
1881 case GL_UNSIGNED_BYTE
:
1885 case GL_UNSIGNED_SHORT
:
1893 case GL_UNSIGNED_INT
:
1902 if (num
> 0 && type_size
> 0) {
1903 /* create a copy of the array of list IDs to save in the display list */
1904 lists_copy
= memdup(lists
, num
* type_size
);
1909 n
= alloc_instruction(ctx
, OPCODE_CALL_LISTS
, 2 + POINTER_DWORDS
);
1913 save_pointer(&n
[3], lists_copy
);
1916 /* After this, we don't know what state we're in. Invalidate all
1917 * cached information previously gathered:
1919 invalidate_saved_current_state( ctx
);
1921 if (ctx
->ExecuteFlag
) {
1922 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1927 static void GLAPIENTRY
1928 save_Clear(GLbitfield mask
)
1930 GET_CURRENT_CONTEXT(ctx
);
1932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1933 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1937 if (ctx
->ExecuteFlag
) {
1938 CALL_Clear(ctx
->Exec
, (mask
));
1943 static void GLAPIENTRY
1944 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1946 GET_CURRENT_CONTEXT(ctx
);
1948 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1949 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1952 n
[2].i
= drawbuffer
;
1954 if (buffer
== GL_COLOR
) {
1965 if (ctx
->ExecuteFlag
) {
1966 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1971 static void GLAPIENTRY
1972 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1974 GET_CURRENT_CONTEXT(ctx
);
1976 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1977 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1980 n
[2].i
= drawbuffer
;
1982 if (buffer
== GL_COLOR
) {
1993 if (ctx
->ExecuteFlag
) {
1994 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1999 static void GLAPIENTRY
2000 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
2002 GET_CURRENT_CONTEXT(ctx
);
2004 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2005 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
2008 n
[2].i
= drawbuffer
;
2010 if (buffer
== GL_COLOR
) {
2021 if (ctx
->ExecuteFlag
) {
2022 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
2027 static void GLAPIENTRY
2028 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
2029 GLfloat depth
, GLint stencil
)
2031 GET_CURRENT_CONTEXT(ctx
);
2033 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2034 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
2037 n
[2].i
= drawbuffer
;
2041 if (ctx
->ExecuteFlag
) {
2042 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
2047 static void GLAPIENTRY
2048 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
2050 GET_CURRENT_CONTEXT(ctx
);
2052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2053 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
2060 if (ctx
->ExecuteFlag
) {
2061 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
2066 static void GLAPIENTRY
2067 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
2069 GET_CURRENT_CONTEXT(ctx
);
2071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2072 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
2079 if (ctx
->ExecuteFlag
) {
2080 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
2085 static void GLAPIENTRY
2086 save_ClearDepth(GLclampd depth
)
2088 GET_CURRENT_CONTEXT(ctx
);
2090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2091 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
2093 n
[1].f
= (GLfloat
) depth
;
2095 if (ctx
->ExecuteFlag
) {
2096 CALL_ClearDepth(ctx
->Exec
, (depth
));
2101 static void GLAPIENTRY
2102 save_ClearIndex(GLfloat c
)
2104 GET_CURRENT_CONTEXT(ctx
);
2106 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2107 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
2111 if (ctx
->ExecuteFlag
) {
2112 CALL_ClearIndex(ctx
->Exec
, (c
));
2117 static void GLAPIENTRY
2118 save_ClearStencil(GLint s
)
2120 GET_CURRENT_CONTEXT(ctx
);
2122 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2123 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
2127 if (ctx
->ExecuteFlag
) {
2128 CALL_ClearStencil(ctx
->Exec
, (s
));
2133 static void GLAPIENTRY
2134 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
2136 GET_CURRENT_CONTEXT(ctx
);
2138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2139 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
2142 n
[2].f
= (GLfloat
) equ
[0];
2143 n
[3].f
= (GLfloat
) equ
[1];
2144 n
[4].f
= (GLfloat
) equ
[2];
2145 n
[5].f
= (GLfloat
) equ
[3];
2147 if (ctx
->ExecuteFlag
) {
2148 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
2154 static void GLAPIENTRY
2155 save_ColorMask(GLboolean red
, GLboolean green
,
2156 GLboolean blue
, GLboolean alpha
)
2158 GET_CURRENT_CONTEXT(ctx
);
2160 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2161 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
2168 if (ctx
->ExecuteFlag
) {
2169 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
2174 static void GLAPIENTRY
2175 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
2176 GLboolean blue
, GLboolean alpha
)
2178 GET_CURRENT_CONTEXT(ctx
);
2180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2181 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
2189 if (ctx
->ExecuteFlag
) {
2190 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2195 static void GLAPIENTRY
2196 save_ColorMaterial(GLenum face
, GLenum mode
)
2198 GET_CURRENT_CONTEXT(ctx
);
2200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2202 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
2207 if (ctx
->ExecuteFlag
) {
2208 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
2213 static void GLAPIENTRY
2214 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
2216 GET_CURRENT_CONTEXT(ctx
);
2218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2219 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
2223 n
[3].i
= (GLint
) width
;
2224 n
[4].i
= (GLint
) height
;
2227 if (ctx
->ExecuteFlag
) {
2228 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
2234 static void GLAPIENTRY
2235 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
2236 GLint x
, GLint y
, GLsizei width
, GLint border
)
2238 GET_CURRENT_CONTEXT(ctx
);
2240 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2241 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
2245 n
[3].e
= internalformat
;
2251 if (ctx
->ExecuteFlag
) {
2252 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
2253 x
, y
, width
, border
));
2258 static void GLAPIENTRY
2259 save_CopyTexImage2D(GLenum target
, GLint level
,
2260 GLenum internalformat
,
2261 GLint x
, GLint y
, GLsizei width
,
2262 GLsizei height
, GLint border
)
2264 GET_CURRENT_CONTEXT(ctx
);
2266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2267 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
2271 n
[3].e
= internalformat
;
2278 if (ctx
->ExecuteFlag
) {
2279 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
2280 x
, y
, width
, height
, border
));
2286 static void GLAPIENTRY
2287 save_CopyTexSubImage1D(GLenum target
, GLint level
,
2288 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
2290 GET_CURRENT_CONTEXT(ctx
);
2292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2293 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
2302 if (ctx
->ExecuteFlag
) {
2303 CALL_CopyTexSubImage1D(ctx
->Exec
,
2304 (target
, level
, xoffset
, x
, y
, width
));
2309 static void GLAPIENTRY
2310 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2311 GLint xoffset
, GLint yoffset
,
2312 GLint x
, GLint y
, GLsizei width
, GLint height
)
2314 GET_CURRENT_CONTEXT(ctx
);
2316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2317 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2328 if (ctx
->ExecuteFlag
) {
2329 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2330 x
, y
, width
, height
));
2335 static void GLAPIENTRY
2336 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2337 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2338 GLint x
, GLint y
, GLsizei width
, GLint height
)
2340 GET_CURRENT_CONTEXT(ctx
);
2342 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2343 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2355 if (ctx
->ExecuteFlag
) {
2356 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2357 xoffset
, yoffset
, zoffset
,
2358 x
, y
, width
, height
));
2363 static void GLAPIENTRY
2364 save_CullFace(GLenum mode
)
2366 GET_CURRENT_CONTEXT(ctx
);
2368 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2369 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2373 if (ctx
->ExecuteFlag
) {
2374 CALL_CullFace(ctx
->Exec
, (mode
));
2379 static void GLAPIENTRY
2380 save_DepthFunc(GLenum func
)
2382 GET_CURRENT_CONTEXT(ctx
);
2384 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2385 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2389 if (ctx
->ExecuteFlag
) {
2390 CALL_DepthFunc(ctx
->Exec
, (func
));
2395 static void GLAPIENTRY
2396 save_DepthMask(GLboolean mask
)
2398 GET_CURRENT_CONTEXT(ctx
);
2400 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2401 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2405 if (ctx
->ExecuteFlag
) {
2406 CALL_DepthMask(ctx
->Exec
, (mask
));
2411 static void GLAPIENTRY
2412 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2414 GET_CURRENT_CONTEXT(ctx
);
2416 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2417 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2419 n
[1].f
= (GLfloat
) nearval
;
2420 n
[2].f
= (GLfloat
) farval
;
2422 if (ctx
->ExecuteFlag
) {
2423 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2428 static void GLAPIENTRY
2429 save_Disable(GLenum cap
)
2431 GET_CURRENT_CONTEXT(ctx
);
2433 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2434 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2438 if (ctx
->ExecuteFlag
) {
2439 CALL_Disable(ctx
->Exec
, (cap
));
2444 static void GLAPIENTRY
2445 save_DisableIndexed(GLuint index
, GLenum cap
)
2447 GET_CURRENT_CONTEXT(ctx
);
2449 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2450 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2455 if (ctx
->ExecuteFlag
) {
2456 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2461 static void GLAPIENTRY
2462 save_DrawBuffer(GLenum mode
)
2464 GET_CURRENT_CONTEXT(ctx
);
2466 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2467 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2471 if (ctx
->ExecuteFlag
) {
2472 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2477 static void GLAPIENTRY
2478 save_DrawPixels(GLsizei width
, GLsizei height
,
2479 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2481 GET_CURRENT_CONTEXT(ctx
);
2484 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2486 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2493 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2494 pixels
, &ctx
->Unpack
));
2496 if (ctx
->ExecuteFlag
) {
2497 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2503 static void GLAPIENTRY
2504 save_Enable(GLenum cap
)
2506 GET_CURRENT_CONTEXT(ctx
);
2508 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2509 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2513 if (ctx
->ExecuteFlag
) {
2514 CALL_Enable(ctx
->Exec
, (cap
));
2520 static void GLAPIENTRY
2521 save_EnableIndexed(GLuint index
, GLenum cap
)
2523 GET_CURRENT_CONTEXT(ctx
);
2525 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2526 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2531 if (ctx
->ExecuteFlag
) {
2532 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2538 static void GLAPIENTRY
2539 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2541 GET_CURRENT_CONTEXT(ctx
);
2543 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2544 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2550 if (ctx
->ExecuteFlag
) {
2551 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2556 static void GLAPIENTRY
2557 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2559 GET_CURRENT_CONTEXT(ctx
);
2561 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2562 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2570 if (ctx
->ExecuteFlag
) {
2571 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2578 static void GLAPIENTRY
2579 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2581 GET_CURRENT_CONTEXT(ctx
);
2583 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2584 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2592 if (ctx
->ExecuteFlag
) {
2593 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2598 static void GLAPIENTRY
2599 save_Fogf(GLenum pname
, GLfloat param
)
2603 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2604 save_Fogfv(pname
, parray
);
2608 static void GLAPIENTRY
2609 save_Fogiv(GLenum pname
, const GLint
*params
)
2614 case GL_FOG_DENSITY
:
2618 p
[0] = (GLfloat
) *params
;
2624 p
[0] = INT_TO_FLOAT(params
[0]);
2625 p
[1] = INT_TO_FLOAT(params
[1]);
2626 p
[2] = INT_TO_FLOAT(params
[2]);
2627 p
[3] = INT_TO_FLOAT(params
[3]);
2630 /* Error will be caught later in gl_Fogfv */
2631 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2633 save_Fogfv(pname
, p
);
2637 static void GLAPIENTRY
2638 save_Fogi(GLenum pname
, GLint param
)
2642 parray
[1] = parray
[2] = parray
[3] = 0;
2643 save_Fogiv(pname
, parray
);
2647 static void GLAPIENTRY
2648 save_FrontFace(GLenum mode
)
2650 GET_CURRENT_CONTEXT(ctx
);
2652 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2653 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2657 if (ctx
->ExecuteFlag
) {
2658 CALL_FrontFace(ctx
->Exec
, (mode
));
2663 static void GLAPIENTRY
2664 save_Frustum(GLdouble left
, GLdouble right
,
2665 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2667 GET_CURRENT_CONTEXT(ctx
);
2669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2670 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2672 n
[1].f
= (GLfloat
) left
;
2673 n
[2].f
= (GLfloat
) right
;
2674 n
[3].f
= (GLfloat
) bottom
;
2675 n
[4].f
= (GLfloat
) top
;
2676 n
[5].f
= (GLfloat
) nearval
;
2677 n
[6].f
= (GLfloat
) farval
;
2679 if (ctx
->ExecuteFlag
) {
2680 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2685 static void GLAPIENTRY
2686 save_Hint(GLenum target
, GLenum mode
)
2688 GET_CURRENT_CONTEXT(ctx
);
2690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2691 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2696 if (ctx
->ExecuteFlag
) {
2697 CALL_Hint(ctx
->Exec
, (target
, mode
));
2702 static void GLAPIENTRY
2703 save_IndexMask(GLuint mask
)
2705 GET_CURRENT_CONTEXT(ctx
);
2707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2708 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2712 if (ctx
->ExecuteFlag
) {
2713 CALL_IndexMask(ctx
->Exec
, (mask
));
2718 static void GLAPIENTRY
2719 save_InitNames(void)
2721 GET_CURRENT_CONTEXT(ctx
);
2722 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2723 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2724 if (ctx
->ExecuteFlag
) {
2725 CALL_InitNames(ctx
->Exec
, ());
2730 static void GLAPIENTRY
2731 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2733 GET_CURRENT_CONTEXT(ctx
);
2735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2736 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2754 case GL_SPOT_DIRECTION
:
2757 case GL_SPOT_EXPONENT
:
2760 case GL_SPOT_CUTOFF
:
2763 case GL_CONSTANT_ATTENUATION
:
2766 case GL_LINEAR_ATTENUATION
:
2769 case GL_QUADRATIC_ATTENUATION
:
2775 for (i
= 0; i
< nParams
; i
++) {
2776 n
[3 + i
].f
= params
[i
];
2779 if (ctx
->ExecuteFlag
) {
2780 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2785 static void GLAPIENTRY
2786 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2790 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2791 save_Lightfv(light
, pname
, parray
);
2795 static void GLAPIENTRY
2796 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2803 fparam
[0] = INT_TO_FLOAT(params
[0]);
2804 fparam
[1] = INT_TO_FLOAT(params
[1]);
2805 fparam
[2] = INT_TO_FLOAT(params
[2]);
2806 fparam
[3] = INT_TO_FLOAT(params
[3]);
2809 fparam
[0] = (GLfloat
) params
[0];
2810 fparam
[1] = (GLfloat
) params
[1];
2811 fparam
[2] = (GLfloat
) params
[2];
2812 fparam
[3] = (GLfloat
) params
[3];
2814 case GL_SPOT_DIRECTION
:
2815 fparam
[0] = (GLfloat
) params
[0];
2816 fparam
[1] = (GLfloat
) params
[1];
2817 fparam
[2] = (GLfloat
) params
[2];
2819 case GL_SPOT_EXPONENT
:
2820 case GL_SPOT_CUTOFF
:
2821 case GL_CONSTANT_ATTENUATION
:
2822 case GL_LINEAR_ATTENUATION
:
2823 case GL_QUADRATIC_ATTENUATION
:
2824 fparam
[0] = (GLfloat
) params
[0];
2827 /* error will be caught later in gl_Lightfv */
2830 save_Lightfv(light
, pname
, fparam
);
2834 static void GLAPIENTRY
2835 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2839 parray
[1] = parray
[2] = parray
[3] = 0;
2840 save_Lightiv(light
, pname
, parray
);
2844 static void GLAPIENTRY
2845 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2847 GET_CURRENT_CONTEXT(ctx
);
2849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2850 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2858 if (ctx
->ExecuteFlag
) {
2859 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2864 static void GLAPIENTRY
2865 save_LightModelf(GLenum pname
, GLfloat param
)
2869 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2870 save_LightModelfv(pname
, parray
);
2874 static void GLAPIENTRY
2875 save_LightModeliv(GLenum pname
, const GLint
*params
)
2879 case GL_LIGHT_MODEL_AMBIENT
:
2880 fparam
[0] = INT_TO_FLOAT(params
[0]);
2881 fparam
[1] = INT_TO_FLOAT(params
[1]);
2882 fparam
[2] = INT_TO_FLOAT(params
[2]);
2883 fparam
[3] = INT_TO_FLOAT(params
[3]);
2885 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2886 case GL_LIGHT_MODEL_TWO_SIDE
:
2887 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2888 fparam
[0] = (GLfloat
) params
[0];
2894 /* Error will be caught later in gl_LightModelfv */
2895 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2897 save_LightModelfv(pname
, fparam
);
2901 static void GLAPIENTRY
2902 save_LightModeli(GLenum pname
, GLint param
)
2906 parray
[1] = parray
[2] = parray
[3] = 0;
2907 save_LightModeliv(pname
, parray
);
2911 static void GLAPIENTRY
2912 save_LineStipple(GLint factor
, GLushort pattern
)
2914 GET_CURRENT_CONTEXT(ctx
);
2916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2917 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2922 if (ctx
->ExecuteFlag
) {
2923 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2928 static void GLAPIENTRY
2929 save_LineWidth(GLfloat width
)
2931 GET_CURRENT_CONTEXT(ctx
);
2933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2934 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2938 if (ctx
->ExecuteFlag
) {
2939 CALL_LineWidth(ctx
->Exec
, (width
));
2944 static void GLAPIENTRY
2945 save_ListBase(GLuint base
)
2947 GET_CURRENT_CONTEXT(ctx
);
2949 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2950 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2954 if (ctx
->ExecuteFlag
) {
2955 CALL_ListBase(ctx
->Exec
, (base
));
2960 static void GLAPIENTRY
2961 save_LoadIdentity(void)
2963 GET_CURRENT_CONTEXT(ctx
);
2964 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2965 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2966 if (ctx
->ExecuteFlag
) {
2967 CALL_LoadIdentity(ctx
->Exec
, ());
2972 static void GLAPIENTRY
2973 save_LoadMatrixf(const GLfloat
* m
)
2975 GET_CURRENT_CONTEXT(ctx
);
2977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2978 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2981 for (i
= 0; i
< 16; i
++) {
2985 if (ctx
->ExecuteFlag
) {
2986 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2991 static void GLAPIENTRY
2992 save_LoadMatrixd(const GLdouble
* m
)
2996 for (i
= 0; i
< 16; i
++) {
2997 f
[i
] = (GLfloat
) m
[i
];
2999 save_LoadMatrixf(f
);
3003 static void GLAPIENTRY
3004 save_LoadName(GLuint name
)
3006 GET_CURRENT_CONTEXT(ctx
);
3008 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3009 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
3013 if (ctx
->ExecuteFlag
) {
3014 CALL_LoadName(ctx
->Exec
, (name
));
3019 static void GLAPIENTRY
3020 save_LogicOp(GLenum opcode
)
3022 GET_CURRENT_CONTEXT(ctx
);
3024 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3025 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
3029 if (ctx
->ExecuteFlag
) {
3030 CALL_LogicOp(ctx
->Exec
, (opcode
));
3035 static void GLAPIENTRY
3036 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
3037 GLint order
, const GLdouble
* points
)
3039 GET_CURRENT_CONTEXT(ctx
);
3041 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3042 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
3044 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
3046 n
[2].f
= (GLfloat
) u1
;
3047 n
[3].f
= (GLfloat
) u2
;
3048 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
3050 save_pointer(&n
[6], pnts
);
3052 if (ctx
->ExecuteFlag
) {
3053 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
3057 static void GLAPIENTRY
3058 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
3059 GLint order
, const GLfloat
* points
)
3061 GET_CURRENT_CONTEXT(ctx
);
3063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3064 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
3066 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
3070 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
3072 save_pointer(&n
[6], pnts
);
3074 if (ctx
->ExecuteFlag
) {
3075 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
3080 static void GLAPIENTRY
3081 save_Map2d(GLenum target
,
3082 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
3083 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
3084 const GLdouble
* points
)
3086 GET_CURRENT_CONTEXT(ctx
);
3088 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3089 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
3091 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
3092 vstride
, vorder
, points
);
3094 n
[2].f
= (GLfloat
) u1
;
3095 n
[3].f
= (GLfloat
) u2
;
3096 n
[4].f
= (GLfloat
) v1
;
3097 n
[5].f
= (GLfloat
) v2
;
3098 /* XXX verify these strides are correct */
3099 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
3100 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
3103 save_pointer(&n
[10], pnts
);
3105 if (ctx
->ExecuteFlag
) {
3106 CALL_Map2d(ctx
->Exec
, (target
,
3107 u1
, u2
, ustride
, uorder
,
3108 v1
, v2
, vstride
, vorder
, points
));
3113 static void GLAPIENTRY
3114 save_Map2f(GLenum target
,
3115 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
3116 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
3117 const GLfloat
* points
)
3119 GET_CURRENT_CONTEXT(ctx
);
3121 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3122 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
3124 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
3125 vstride
, vorder
, points
);
3131 /* XXX verify these strides are correct */
3132 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
3133 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
3136 save_pointer(&n
[10], pnts
);
3138 if (ctx
->ExecuteFlag
) {
3139 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
3140 v1
, v2
, vstride
, vorder
, points
));
3145 static void GLAPIENTRY
3146 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
3148 GET_CURRENT_CONTEXT(ctx
);
3150 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3151 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
3157 if (ctx
->ExecuteFlag
) {
3158 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
3163 static void GLAPIENTRY
3164 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
3166 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
3170 static void GLAPIENTRY
3171 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
3172 GLint vn
, GLfloat v1
, GLfloat v2
)
3174 GET_CURRENT_CONTEXT(ctx
);
3176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3177 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
3186 if (ctx
->ExecuteFlag
) {
3187 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
3193 static void GLAPIENTRY
3194 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
3195 GLint vn
, GLdouble v1
, GLdouble v2
)
3197 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
3198 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
3202 static void GLAPIENTRY
3203 save_MatrixMode(GLenum mode
)
3205 GET_CURRENT_CONTEXT(ctx
);
3207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3208 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
3212 if (ctx
->ExecuteFlag
) {
3213 CALL_MatrixMode(ctx
->Exec
, (mode
));
3218 static void GLAPIENTRY
3219 save_MultMatrixf(const GLfloat
* m
)
3221 GET_CURRENT_CONTEXT(ctx
);
3223 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3224 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
3227 for (i
= 0; i
< 16; i
++) {
3231 if (ctx
->ExecuteFlag
) {
3232 CALL_MultMatrixf(ctx
->Exec
, (m
));
3237 static void GLAPIENTRY
3238 save_MultMatrixd(const GLdouble
* m
)
3242 for (i
= 0; i
< 16; i
++) {
3243 f
[i
] = (GLfloat
) m
[i
];
3245 save_MultMatrixf(f
);
3249 static void GLAPIENTRY
3250 save_NewList(GLuint name
, GLenum mode
)
3252 GET_CURRENT_CONTEXT(ctx
);
3253 /* It's an error to call this function while building a display list */
3254 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
3261 static void GLAPIENTRY
3262 save_Ortho(GLdouble left
, GLdouble right
,
3263 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
3265 GET_CURRENT_CONTEXT(ctx
);
3267 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3268 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
3270 n
[1].f
= (GLfloat
) left
;
3271 n
[2].f
= (GLfloat
) right
;
3272 n
[3].f
= (GLfloat
) bottom
;
3273 n
[4].f
= (GLfloat
) top
;
3274 n
[5].f
= (GLfloat
) nearval
;
3275 n
[6].f
= (GLfloat
) farval
;
3277 if (ctx
->ExecuteFlag
) {
3278 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
3283 static void GLAPIENTRY
3284 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
3286 GET_CURRENT_CONTEXT(ctx
);
3288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3289 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
3293 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
3295 if (ctx
->ExecuteFlag
) {
3296 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
3301 static void GLAPIENTRY
3302 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
3304 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3306 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3307 for (i
= 0; i
< mapsize
; i
++) {
3308 fvalues
[i
] = (GLfloat
) values
[i
];
3312 for (i
= 0; i
< mapsize
; i
++) {
3313 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3316 save_PixelMapfv(map
, mapsize
, fvalues
);
3320 static void GLAPIENTRY
3321 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3323 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3325 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3326 for (i
= 0; i
< mapsize
; i
++) {
3327 fvalues
[i
] = (GLfloat
) values
[i
];
3331 for (i
= 0; i
< mapsize
; i
++) {
3332 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3335 save_PixelMapfv(map
, mapsize
, fvalues
);
3339 static void GLAPIENTRY
3340 save_PixelTransferf(GLenum pname
, GLfloat param
)
3342 GET_CURRENT_CONTEXT(ctx
);
3344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3345 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3350 if (ctx
->ExecuteFlag
) {
3351 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3356 static void GLAPIENTRY
3357 save_PixelTransferi(GLenum pname
, GLint param
)
3359 save_PixelTransferf(pname
, (GLfloat
) param
);
3363 static void GLAPIENTRY
3364 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3366 GET_CURRENT_CONTEXT(ctx
);
3368 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3369 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3374 if (ctx
->ExecuteFlag
) {
3375 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3380 static void GLAPIENTRY
3381 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3383 GET_CURRENT_CONTEXT(ctx
);
3385 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3386 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3393 if (ctx
->ExecuteFlag
) {
3394 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3399 static void GLAPIENTRY
3400 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3404 parray
[1] = parray
[2] = 0.0F
;
3405 save_PointParameterfvEXT(pname
, parray
);
3408 static void GLAPIENTRY
3409 save_PointParameteriNV(GLenum pname
, GLint param
)
3412 parray
[0] = (GLfloat
) param
;
3413 parray
[1] = parray
[2] = 0.0F
;
3414 save_PointParameterfvEXT(pname
, parray
);
3417 static void GLAPIENTRY
3418 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3421 parray
[0] = (GLfloat
) param
[0];
3422 parray
[1] = parray
[2] = 0.0F
;
3423 save_PointParameterfvEXT(pname
, parray
);
3427 static void GLAPIENTRY
3428 save_PointSize(GLfloat size
)
3430 GET_CURRENT_CONTEXT(ctx
);
3432 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3433 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3437 if (ctx
->ExecuteFlag
) {
3438 CALL_PointSize(ctx
->Exec
, (size
));
3443 static void GLAPIENTRY
3444 save_PolygonMode(GLenum face
, GLenum mode
)
3446 GET_CURRENT_CONTEXT(ctx
);
3448 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3449 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3454 if (ctx
->ExecuteFlag
) {
3455 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3460 static void GLAPIENTRY
3461 save_PolygonStipple(const GLubyte
* pattern
)
3463 GET_CURRENT_CONTEXT(ctx
);
3466 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3468 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3471 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3472 pattern
, &ctx
->Unpack
));
3474 if (ctx
->ExecuteFlag
) {
3475 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3480 static void GLAPIENTRY
3481 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3483 GET_CURRENT_CONTEXT(ctx
);
3485 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3486 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3491 if (ctx
->ExecuteFlag
) {
3492 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3497 static void GLAPIENTRY
3498 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3500 GET_CURRENT_CONTEXT(ctx
);
3501 /* XXX mult by DepthMaxF here??? */
3502 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3505 static void GLAPIENTRY
3506 save_PolygonOffsetClampEXT(GLfloat factor
, GLfloat units
, GLfloat clamp
)
3508 GET_CURRENT_CONTEXT(ctx
);
3510 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3511 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET_CLAMP
, 3);
3517 if (ctx
->ExecuteFlag
) {
3518 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (factor
, units
, clamp
));
3522 static void GLAPIENTRY
3523 save_PopAttrib(void)
3525 GET_CURRENT_CONTEXT(ctx
);
3526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3527 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3528 if (ctx
->ExecuteFlag
) {
3529 CALL_PopAttrib(ctx
->Exec
, ());
3534 static void GLAPIENTRY
3535 save_PopMatrix(void)
3537 GET_CURRENT_CONTEXT(ctx
);
3538 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3539 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3540 if (ctx
->ExecuteFlag
) {
3541 CALL_PopMatrix(ctx
->Exec
, ());
3546 static void GLAPIENTRY
3549 GET_CURRENT_CONTEXT(ctx
);
3550 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3551 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3552 if (ctx
->ExecuteFlag
) {
3553 CALL_PopName(ctx
->Exec
, ());
3558 static void GLAPIENTRY
3559 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3560 const GLclampf
* priorities
)
3562 GET_CURRENT_CONTEXT(ctx
);
3564 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3566 for (i
= 0; i
< num
; i
++) {
3568 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3570 n
[1].ui
= textures
[i
];
3571 n
[2].f
= priorities
[i
];
3574 if (ctx
->ExecuteFlag
) {
3575 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3580 static void GLAPIENTRY
3581 save_PushAttrib(GLbitfield mask
)
3583 GET_CURRENT_CONTEXT(ctx
);
3585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3586 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3590 if (ctx
->ExecuteFlag
) {
3591 CALL_PushAttrib(ctx
->Exec
, (mask
));
3596 static void GLAPIENTRY
3597 save_PushMatrix(void)
3599 GET_CURRENT_CONTEXT(ctx
);
3600 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3601 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3602 if (ctx
->ExecuteFlag
) {
3603 CALL_PushMatrix(ctx
->Exec
, ());
3608 static void GLAPIENTRY
3609 save_PushName(GLuint name
)
3611 GET_CURRENT_CONTEXT(ctx
);
3613 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3614 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3618 if (ctx
->ExecuteFlag
) {
3619 CALL_PushName(ctx
->Exec
, (name
));
3624 static void GLAPIENTRY
3625 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3627 GET_CURRENT_CONTEXT(ctx
);
3629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3630 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3637 if (ctx
->ExecuteFlag
) {
3638 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3642 static void GLAPIENTRY
3643 save_RasterPos2d(GLdouble x
, GLdouble y
)
3645 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3648 static void GLAPIENTRY
3649 save_RasterPos2f(GLfloat x
, GLfloat y
)
3651 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3654 static void GLAPIENTRY
3655 save_RasterPos2i(GLint x
, GLint y
)
3657 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3660 static void GLAPIENTRY
3661 save_RasterPos2s(GLshort x
, GLshort y
)
3663 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3666 static void GLAPIENTRY
3667 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3669 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3672 static void GLAPIENTRY
3673 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3675 save_RasterPos4f(x
, y
, z
, 1.0F
);
3678 static void GLAPIENTRY
3679 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3681 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3684 static void GLAPIENTRY
3685 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3687 save_RasterPos4f(x
, y
, z
, 1.0F
);
3690 static void GLAPIENTRY
3691 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3693 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3696 static void GLAPIENTRY
3697 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3699 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3702 static void GLAPIENTRY
3703 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3705 save_RasterPos4f(x
, y
, z
, w
);
3708 static void GLAPIENTRY
3709 save_RasterPos2dv(const GLdouble
* v
)
3711 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3714 static void GLAPIENTRY
3715 save_RasterPos2fv(const GLfloat
* v
)
3717 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3720 static void GLAPIENTRY
3721 save_RasterPos2iv(const GLint
* v
)
3723 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3726 static void GLAPIENTRY
3727 save_RasterPos2sv(const GLshort
* v
)
3729 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3732 static void GLAPIENTRY
3733 save_RasterPos3dv(const GLdouble
* v
)
3735 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3738 static void GLAPIENTRY
3739 save_RasterPos3fv(const GLfloat
* v
)
3741 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3744 static void GLAPIENTRY
3745 save_RasterPos3iv(const GLint
* v
)
3747 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3750 static void GLAPIENTRY
3751 save_RasterPos3sv(const GLshort
* v
)
3753 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3756 static void GLAPIENTRY
3757 save_RasterPos4dv(const GLdouble
* v
)
3759 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3760 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3763 static void GLAPIENTRY
3764 save_RasterPos4fv(const GLfloat
* v
)
3766 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3769 static void GLAPIENTRY
3770 save_RasterPos4iv(const GLint
* v
)
3772 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3773 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3776 static void GLAPIENTRY
3777 save_RasterPos4sv(const GLshort
* v
)
3779 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3783 static void GLAPIENTRY
3784 save_PassThrough(GLfloat token
)
3786 GET_CURRENT_CONTEXT(ctx
);
3788 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3789 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3793 if (ctx
->ExecuteFlag
) {
3794 CALL_PassThrough(ctx
->Exec
, (token
));
3799 static void GLAPIENTRY
3800 save_ReadBuffer(GLenum mode
)
3802 GET_CURRENT_CONTEXT(ctx
);
3804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3805 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3809 if (ctx
->ExecuteFlag
) {
3810 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3815 static void GLAPIENTRY
3816 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3818 GET_CURRENT_CONTEXT(ctx
);
3820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3821 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3828 if (ctx
->ExecuteFlag
) {
3829 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3834 static void GLAPIENTRY
3835 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3837 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3841 static void GLAPIENTRY
3842 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3844 GET_CURRENT_CONTEXT(ctx
);
3846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3847 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3853 if (ctx
->ExecuteFlag
) {
3854 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3859 static void GLAPIENTRY
3860 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3862 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3866 static void GLAPIENTRY
3867 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3869 GET_CURRENT_CONTEXT(ctx
);
3871 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3872 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3879 if (ctx
->ExecuteFlag
) {
3880 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3885 static void GLAPIENTRY
3886 save_ShadeModel(GLenum mode
)
3888 GET_CURRENT_CONTEXT(ctx
);
3890 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3892 if (ctx
->ExecuteFlag
) {
3893 CALL_ShadeModel(ctx
->Exec
, (mode
));
3896 /* Don't compile this call if it's a no-op.
3897 * By avoiding this state change we have a better chance of
3898 * coalescing subsequent drawing commands into one batch.
3900 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3903 SAVE_FLUSH_VERTICES(ctx
);
3905 ctx
->ListState
.Current
.ShadeModel
= mode
;
3907 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3914 static void GLAPIENTRY
3915 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3917 GET_CURRENT_CONTEXT(ctx
);
3919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3920 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3926 if (ctx
->ExecuteFlag
) {
3927 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3932 static void GLAPIENTRY
3933 save_StencilMask(GLuint mask
)
3935 GET_CURRENT_CONTEXT(ctx
);
3937 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3938 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3942 if (ctx
->ExecuteFlag
) {
3943 CALL_StencilMask(ctx
->Exec
, (mask
));
3948 static void GLAPIENTRY
3949 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3951 GET_CURRENT_CONTEXT(ctx
);
3953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3954 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3960 if (ctx
->ExecuteFlag
) {
3961 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3966 static void GLAPIENTRY
3967 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3969 GET_CURRENT_CONTEXT(ctx
);
3971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3972 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3979 if (ctx
->ExecuteFlag
) {
3980 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3985 static void GLAPIENTRY
3986 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3989 GET_CURRENT_CONTEXT(ctx
);
3991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3993 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
4001 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
4008 if (ctx
->ExecuteFlag
) {
4009 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
4010 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
4015 static void GLAPIENTRY
4016 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
4018 GET_CURRENT_CONTEXT(ctx
);
4020 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4021 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
4026 if (ctx
->ExecuteFlag
) {
4027 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
4032 static void GLAPIENTRY
4033 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
4035 GET_CURRENT_CONTEXT(ctx
);
4037 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4038 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
4045 if (ctx
->ExecuteFlag
) {
4046 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
4051 static void GLAPIENTRY
4052 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4054 GET_CURRENT_CONTEXT(ctx
);
4056 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4057 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
4061 if (pname
== GL_TEXTURE_ENV_COLOR
) {
4069 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
4072 if (ctx
->ExecuteFlag
) {
4073 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
4078 static void GLAPIENTRY
4079 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
4082 parray
[0] = (GLfloat
) param
;
4083 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4084 save_TexEnvfv(target
, pname
, parray
);
4088 static void GLAPIENTRY
4089 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
4092 p
[0] = (GLfloat
) param
;
4093 p
[1] = p
[2] = p
[3] = 0.0F
;
4094 save_TexEnvfv(target
, pname
, p
);
4098 static void GLAPIENTRY
4099 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
4102 if (pname
== GL_TEXTURE_ENV_COLOR
) {
4103 p
[0] = INT_TO_FLOAT(param
[0]);
4104 p
[1] = INT_TO_FLOAT(param
[1]);
4105 p
[2] = INT_TO_FLOAT(param
[2]);
4106 p
[3] = INT_TO_FLOAT(param
[3]);
4109 p
[0] = (GLfloat
) param
[0];
4110 p
[1] = p
[2] = p
[3] = 0.0F
;
4112 save_TexEnvfv(target
, pname
, p
);
4116 static void GLAPIENTRY
4117 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
4119 GET_CURRENT_CONTEXT(ctx
);
4121 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4122 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
4131 if (ctx
->ExecuteFlag
) {
4132 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
4137 static void GLAPIENTRY
4138 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
4141 p
[0] = (GLfloat
) params
[0];
4142 p
[1] = (GLfloat
) params
[1];
4143 p
[2] = (GLfloat
) params
[2];
4144 p
[3] = (GLfloat
) params
[3];
4145 save_TexGenfv(coord
, pname
, p
);
4149 static void GLAPIENTRY
4150 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
4153 parray
[0] = (GLfloat
) param
;
4154 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4155 save_TexGenfv(coord
, pname
, parray
);
4159 static void GLAPIENTRY
4160 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
4163 p
[0] = (GLfloat
) params
[0];
4164 p
[1] = (GLfloat
) params
[1];
4165 p
[2] = (GLfloat
) params
[2];
4166 p
[3] = (GLfloat
) params
[3];
4167 save_TexGenfv(coord
, pname
, p
);
4171 static void GLAPIENTRY
4172 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
4176 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4177 save_TexGenfv(coord
, pname
, parray
);
4181 static void GLAPIENTRY
4182 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
4186 parray
[1] = parray
[2] = parray
[3] = 0;
4187 save_TexGeniv(coord
, pname
, parray
);
4191 static void GLAPIENTRY
4192 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4194 GET_CURRENT_CONTEXT(ctx
);
4196 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4197 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
4206 if (ctx
->ExecuteFlag
) {
4207 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
4212 static void GLAPIENTRY
4213 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
4217 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4218 save_TexParameterfv(target
, pname
, parray
);
4222 static void GLAPIENTRY
4223 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
4226 fparam
[0] = (GLfloat
) param
;
4227 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4228 save_TexParameterfv(target
, pname
, fparam
);
4232 static void GLAPIENTRY
4233 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
4236 fparam
[0] = (GLfloat
) params
[0];
4237 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4238 save_TexParameterfv(target
, pname
, fparam
);
4242 static void GLAPIENTRY
4243 save_TexImage1D(GLenum target
,
4244 GLint level
, GLint components
,
4245 GLsizei width
, GLint border
,
4246 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4248 GET_CURRENT_CONTEXT(ctx
);
4249 if (target
== GL_PROXY_TEXTURE_1D
) {
4250 /* don't compile, execute immediately */
4251 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4252 border
, format
, type
, pixels
));
4256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4257 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
4261 n
[3].i
= components
;
4262 n
[4].i
= (GLint
) width
;
4267 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4268 pixels
, &ctx
->Unpack
));
4270 if (ctx
->ExecuteFlag
) {
4271 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4272 border
, format
, type
, pixels
));
4278 static void GLAPIENTRY
4279 save_TexImage2D(GLenum target
,
4280 GLint level
, GLint components
,
4281 GLsizei width
, GLsizei height
, GLint border
,
4282 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4284 GET_CURRENT_CONTEXT(ctx
);
4285 if (target
== GL_PROXY_TEXTURE_2D
) {
4286 /* don't compile, execute immediately */
4287 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4288 height
, border
, format
, type
, pixels
));
4292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4293 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
4297 n
[3].i
= components
;
4298 n
[4].i
= (GLint
) width
;
4299 n
[5].i
= (GLint
) height
;
4304 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4305 pixels
, &ctx
->Unpack
));
4307 if (ctx
->ExecuteFlag
) {
4308 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4309 height
, border
, format
, type
, pixels
));
4315 static void GLAPIENTRY
4316 save_TexImage3D(GLenum target
,
4317 GLint level
, GLint internalFormat
,
4318 GLsizei width
, GLsizei height
, GLsizei depth
,
4320 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4322 GET_CURRENT_CONTEXT(ctx
);
4323 if (target
== GL_PROXY_TEXTURE_3D
) {
4324 /* don't compile, execute immediately */
4325 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4326 height
, depth
, border
, format
, type
,
4331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4332 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
4336 n
[3].i
= (GLint
) internalFormat
;
4337 n
[4].i
= (GLint
) width
;
4338 n
[5].i
= (GLint
) height
;
4339 n
[6].i
= (GLint
) depth
;
4343 save_pointer(&n
[10],
4344 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4345 pixels
, &ctx
->Unpack
));
4347 if (ctx
->ExecuteFlag
) {
4348 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4349 height
, depth
, border
, format
, type
,
4356 static void GLAPIENTRY
4357 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4358 GLsizei width
, GLenum format
, GLenum type
,
4359 const GLvoid
* pixels
)
4361 GET_CURRENT_CONTEXT(ctx
);
4364 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4366 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
4371 n
[4].i
= (GLint
) width
;
4375 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4376 pixels
, &ctx
->Unpack
));
4378 if (ctx
->ExecuteFlag
) {
4379 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4380 format
, type
, pixels
));
4385 static void GLAPIENTRY
4386 save_TexSubImage2D(GLenum target
, GLint level
,
4387 GLint xoffset
, GLint yoffset
,
4388 GLsizei width
, GLsizei height
,
4389 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4391 GET_CURRENT_CONTEXT(ctx
);
4394 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4396 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
4402 n
[5].i
= (GLint
) width
;
4403 n
[6].i
= (GLint
) height
;
4407 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4408 pixels
, &ctx
->Unpack
));
4410 if (ctx
->ExecuteFlag
) {
4411 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4412 width
, height
, format
, type
, pixels
));
4417 static void GLAPIENTRY
4418 save_TexSubImage3D(GLenum target
, GLint level
,
4419 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4420 GLsizei width
, GLsizei height
, GLsizei depth
,
4421 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4423 GET_CURRENT_CONTEXT(ctx
);
4426 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4428 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4435 n
[6].i
= (GLint
) width
;
4436 n
[7].i
= (GLint
) height
;
4437 n
[8].i
= (GLint
) depth
;
4440 save_pointer(&n
[11],
4441 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4442 pixels
, &ctx
->Unpack
));
4444 if (ctx
->ExecuteFlag
) {
4445 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4446 xoffset
, yoffset
, zoffset
,
4447 width
, height
, depth
, format
, type
,
4453 static void GLAPIENTRY
4454 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4456 GET_CURRENT_CONTEXT(ctx
);
4458 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4459 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4465 if (ctx
->ExecuteFlag
) {
4466 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4471 static void GLAPIENTRY
4472 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4474 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4479 static void GLAPIENTRY
4480 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4482 GET_CURRENT_CONTEXT(ctx
);
4484 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4485 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4489 n
[3].i
= (GLint
) width
;
4490 n
[4].i
= (GLint
) height
;
4492 if (ctx
->ExecuteFlag
) {
4493 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4498 static void GLAPIENTRY
4499 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4501 GET_CURRENT_CONTEXT(ctx
);
4503 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4504 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4511 if (ctx
->ExecuteFlag
) {
4512 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4516 static void GLAPIENTRY
4517 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4519 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4522 static void GLAPIENTRY
4523 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4525 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4528 static void GLAPIENTRY
4529 save_WindowPos2iMESA(GLint x
, GLint y
)
4531 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4534 static void GLAPIENTRY
4535 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4537 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4540 static void GLAPIENTRY
4541 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4543 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4546 static void GLAPIENTRY
4547 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4549 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4552 static void GLAPIENTRY
4553 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4555 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4558 static void GLAPIENTRY
4559 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4561 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4564 static void GLAPIENTRY
4565 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4567 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4570 static void GLAPIENTRY
4571 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4573 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4576 static void GLAPIENTRY
4577 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4579 save_WindowPos4fMESA(x
, y
, z
, w
);
4582 static void GLAPIENTRY
4583 save_WindowPos2dvMESA(const GLdouble
* v
)
4585 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4588 static void GLAPIENTRY
4589 save_WindowPos2fvMESA(const GLfloat
* v
)
4591 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4594 static void GLAPIENTRY
4595 save_WindowPos2ivMESA(const GLint
* v
)
4597 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4600 static void GLAPIENTRY
4601 save_WindowPos2svMESA(const GLshort
* v
)
4603 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4606 static void GLAPIENTRY
4607 save_WindowPos3dvMESA(const GLdouble
* v
)
4609 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4612 static void GLAPIENTRY
4613 save_WindowPos3fvMESA(const GLfloat
* v
)
4615 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4618 static void GLAPIENTRY
4619 save_WindowPos3ivMESA(const GLint
* v
)
4621 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4624 static void GLAPIENTRY
4625 save_WindowPos3svMESA(const GLshort
* v
)
4627 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4630 static void GLAPIENTRY
4631 save_WindowPos4dvMESA(const GLdouble
* v
)
4633 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4634 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4637 static void GLAPIENTRY
4638 save_WindowPos4fvMESA(const GLfloat
* v
)
4640 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4643 static void GLAPIENTRY
4644 save_WindowPos4ivMESA(const GLint
* v
)
4646 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4647 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4650 static void GLAPIENTRY
4651 save_WindowPos4svMESA(const GLshort
* v
)
4653 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4658 /* GL_ARB_multitexture */
4659 static void GLAPIENTRY
4660 save_ActiveTextureARB(GLenum target
)
4662 GET_CURRENT_CONTEXT(ctx
);
4664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4665 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4669 if (ctx
->ExecuteFlag
) {
4670 CALL_ActiveTexture(ctx
->Exec
, (target
));
4675 /* GL_ARB_transpose_matrix */
4677 static void GLAPIENTRY
4678 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4681 _math_transposefd(tm
, m
);
4682 save_LoadMatrixf(tm
);
4686 static void GLAPIENTRY
4687 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4690 _math_transposef(tm
, m
);
4691 save_LoadMatrixf(tm
);
4695 static void GLAPIENTRY
4696 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4699 _math_transposefd(tm
, m
);
4700 save_MultMatrixf(tm
);
4704 static void GLAPIENTRY
4705 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4708 _math_transposef(tm
, m
);
4709 save_MultMatrixf(tm
);
4712 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4714 GET_CURRENT_CONTEXT(ctx
);
4720 image
= malloc(size
);
4722 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4725 memcpy(image
, data
, size
);
4731 /* GL_ARB_texture_compression */
4732 static void GLAPIENTRY
4733 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4734 GLenum internalFormat
, GLsizei width
,
4735 GLint border
, GLsizei imageSize
,
4736 const GLvoid
* data
)
4738 GET_CURRENT_CONTEXT(ctx
);
4739 if (target
== GL_PROXY_TEXTURE_1D
) {
4740 /* don't compile, execute immediately */
4741 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4742 width
, border
, imageSize
,
4747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4749 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4750 6 + POINTER_DWORDS
);
4754 n
[3].e
= internalFormat
;
4755 n
[4].i
= (GLint
) width
;
4759 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4761 if (ctx
->ExecuteFlag
) {
4762 CALL_CompressedTexImage1D(ctx
->Exec
,
4763 (target
, level
, internalFormat
, width
,
4764 border
, imageSize
, data
));
4770 static void GLAPIENTRY
4771 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4772 GLenum internalFormat
, GLsizei width
,
4773 GLsizei height
, GLint border
, GLsizei imageSize
,
4774 const GLvoid
* data
)
4776 GET_CURRENT_CONTEXT(ctx
);
4777 if (target
== GL_PROXY_TEXTURE_2D
) {
4778 /* don't compile, execute immediately */
4779 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4780 width
, height
, border
,
4785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4787 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4788 7 + POINTER_DWORDS
);
4792 n
[3].e
= internalFormat
;
4793 n
[4].i
= (GLint
) width
;
4794 n
[5].i
= (GLint
) height
;
4798 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4800 if (ctx
->ExecuteFlag
) {
4801 CALL_CompressedTexImage2D(ctx
->Exec
,
4802 (target
, level
, internalFormat
, width
,
4803 height
, border
, imageSize
, data
));
4809 static void GLAPIENTRY
4810 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4811 GLenum internalFormat
, GLsizei width
,
4812 GLsizei height
, GLsizei depth
, GLint border
,
4813 GLsizei imageSize
, const GLvoid
* data
)
4815 GET_CURRENT_CONTEXT(ctx
);
4816 if (target
== GL_PROXY_TEXTURE_3D
) {
4817 /* don't compile, execute immediately */
4818 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4819 width
, height
, depth
, border
,
4824 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4826 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4827 8 + POINTER_DWORDS
);
4831 n
[3].e
= internalFormat
;
4832 n
[4].i
= (GLint
) width
;
4833 n
[5].i
= (GLint
) height
;
4834 n
[6].i
= (GLint
) depth
;
4838 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4840 if (ctx
->ExecuteFlag
) {
4841 CALL_CompressedTexImage3D(ctx
->Exec
,
4842 (target
, level
, internalFormat
, width
,
4843 height
, depth
, border
, imageSize
,
4850 static void GLAPIENTRY
4851 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4852 GLsizei width
, GLenum format
,
4853 GLsizei imageSize
, const GLvoid
* data
)
4856 GET_CURRENT_CONTEXT(ctx
);
4857 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4859 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4860 6 + POINTER_DWORDS
);
4865 n
[4].i
= (GLint
) width
;
4869 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4871 if (ctx
->ExecuteFlag
) {
4872 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4873 width
, format
, imageSize
,
4879 static void GLAPIENTRY
4880 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4881 GLint yoffset
, GLsizei width
, GLsizei height
,
4882 GLenum format
, GLsizei imageSize
,
4883 const GLvoid
* data
)
4886 GET_CURRENT_CONTEXT(ctx
);
4887 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4889 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4890 8 + POINTER_DWORDS
);
4896 n
[5].i
= (GLint
) width
;
4897 n
[6].i
= (GLint
) height
;
4901 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4903 if (ctx
->ExecuteFlag
) {
4904 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4905 (target
, level
, xoffset
, yoffset
, width
,
4906 height
, format
, imageSize
, data
));
4911 static void GLAPIENTRY
4912 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4913 GLint yoffset
, GLint zoffset
, GLsizei width
,
4914 GLsizei height
, GLsizei depth
, GLenum format
,
4915 GLsizei imageSize
, const GLvoid
* data
)
4918 GET_CURRENT_CONTEXT(ctx
);
4919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4921 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4922 10 + POINTER_DWORDS
);
4929 n
[6].i
= (GLint
) width
;
4930 n
[7].i
= (GLint
) height
;
4931 n
[8].i
= (GLint
) depth
;
4933 n
[10].i
= imageSize
;
4934 save_pointer(&n
[11],
4935 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4937 if (ctx
->ExecuteFlag
) {
4938 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4939 (target
, level
, xoffset
, yoffset
,
4940 zoffset
, width
, height
, depth
, format
,
4946 /* GL_ARB_multisample */
4947 static void GLAPIENTRY
4948 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4950 GET_CURRENT_CONTEXT(ctx
);
4952 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4953 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4958 if (ctx
->ExecuteFlag
) {
4959 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4965 * GL_ARB_vertex_program
4967 static void GLAPIENTRY
4968 save_BindProgramARB(GLenum target
, GLuint id
)
4970 GET_CURRENT_CONTEXT(ctx
);
4972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4973 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_ARB
, 2);
4978 if (ctx
->ExecuteFlag
) {
4979 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4983 static void GLAPIENTRY
4984 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4985 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4987 GET_CURRENT_CONTEXT(ctx
);
4989 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4990 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4999 if (ctx
->ExecuteFlag
) {
5000 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5005 static void GLAPIENTRY
5006 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
5007 const GLfloat
*params
)
5009 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
5010 params
[2], params
[3]);
5014 static void GLAPIENTRY
5015 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
5016 const GLfloat
* params
)
5018 GET_CURRENT_CONTEXT(ctx
);
5020 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5024 const GLfloat
* p
= params
;
5026 for (i
= 0 ; i
< count
; i
++) {
5027 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
5040 if (ctx
->ExecuteFlag
) {
5041 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5046 static void GLAPIENTRY
5047 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
5048 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
5050 save_ProgramEnvParameter4fARB(target
, index
,
5052 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
5056 static void GLAPIENTRY
5057 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
5058 const GLdouble
*params
)
5060 save_ProgramEnvParameter4fARB(target
, index
,
5061 (GLfloat
) params
[0],
5062 (GLfloat
) params
[1],
5063 (GLfloat
) params
[2], (GLfloat
) params
[3]);
5067 static void GLAPIENTRY
5068 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
5069 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5071 GET_CURRENT_CONTEXT(ctx
);
5073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5074 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5083 if (ctx
->ExecuteFlag
) {
5084 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5089 static void GLAPIENTRY
5090 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
5091 const GLfloat
*params
)
5093 GET_CURRENT_CONTEXT(ctx
);
5095 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5096 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5105 if (ctx
->ExecuteFlag
) {
5106 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
5111 static void GLAPIENTRY
5112 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
5113 const GLfloat
*params
)
5115 GET_CURRENT_CONTEXT(ctx
);
5117 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5121 const GLfloat
* p
= params
;
5123 for (i
= 0 ; i
< count
; i
++) {
5124 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5137 if (ctx
->ExecuteFlag
) {
5138 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5143 static void GLAPIENTRY
5144 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
5145 GLdouble x
, GLdouble y
,
5146 GLdouble z
, GLdouble w
)
5148 GET_CURRENT_CONTEXT(ctx
);
5150 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5151 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5155 n
[3].f
= (GLfloat
) x
;
5156 n
[4].f
= (GLfloat
) y
;
5157 n
[5].f
= (GLfloat
) z
;
5158 n
[6].f
= (GLfloat
) w
;
5160 if (ctx
->ExecuteFlag
) {
5161 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5166 static void GLAPIENTRY
5167 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
5168 const GLdouble
*params
)
5170 GET_CURRENT_CONTEXT(ctx
);
5172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5173 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5177 n
[3].f
= (GLfloat
) params
[0];
5178 n
[4].f
= (GLfloat
) params
[1];
5179 n
[5].f
= (GLfloat
) params
[2];
5180 n
[6].f
= (GLfloat
) params
[3];
5182 if (ctx
->ExecuteFlag
) {
5183 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
5188 /* GL_EXT_stencil_two_side */
5189 static void GLAPIENTRY
5190 save_ActiveStencilFaceEXT(GLenum face
)
5192 GET_CURRENT_CONTEXT(ctx
);
5194 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5195 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
5199 if (ctx
->ExecuteFlag
) {
5200 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
5205 /* GL_EXT_depth_bounds_test */
5206 static void GLAPIENTRY
5207 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
5209 GET_CURRENT_CONTEXT(ctx
);
5211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5212 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
5214 n
[1].f
= (GLfloat
) zmin
;
5215 n
[2].f
= (GLfloat
) zmax
;
5217 if (ctx
->ExecuteFlag
) {
5218 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
5224 static void GLAPIENTRY
5225 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
5226 const GLvoid
* string
)
5228 GET_CURRENT_CONTEXT(ctx
);
5231 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5233 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
5235 GLubyte
*programCopy
= malloc(len
);
5237 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
5240 memcpy(programCopy
, string
, len
);
5244 save_pointer(&n
[4], programCopy
);
5246 if (ctx
->ExecuteFlag
) {
5247 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
5252 static void GLAPIENTRY
5253 save_BeginQueryARB(GLenum target
, GLuint id
)
5255 GET_CURRENT_CONTEXT(ctx
);
5257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5258 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
5263 if (ctx
->ExecuteFlag
) {
5264 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
5268 static void GLAPIENTRY
5269 save_EndQueryARB(GLenum target
)
5271 GET_CURRENT_CONTEXT(ctx
);
5273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5274 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
5278 if (ctx
->ExecuteFlag
) {
5279 CALL_EndQuery(ctx
->Exec
, (target
));
5283 static void GLAPIENTRY
5284 save_QueryCounter(GLuint id
, GLenum target
)
5286 GET_CURRENT_CONTEXT(ctx
);
5288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5289 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
5294 if (ctx
->ExecuteFlag
) {
5295 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
5299 static void GLAPIENTRY
5300 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
5302 GET_CURRENT_CONTEXT(ctx
);
5304 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5305 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
5311 if (ctx
->ExecuteFlag
) {
5312 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5316 static void GLAPIENTRY
5317 save_EndQueryIndexed(GLenum target
, GLuint index
)
5319 GET_CURRENT_CONTEXT(ctx
);
5321 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5322 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5327 if (ctx
->ExecuteFlag
) {
5328 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5333 static void GLAPIENTRY
5334 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5336 GET_CURRENT_CONTEXT(ctx
);
5338 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5339 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5343 if (count
> MAX_DRAW_BUFFERS
)
5344 count
= MAX_DRAW_BUFFERS
;
5345 for (i
= 0; i
< count
; i
++) {
5346 n
[2 + i
].e
= buffers
[i
];
5349 if (ctx
->ExecuteFlag
) {
5350 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5354 static void GLAPIENTRY
5355 save_BindFragmentShaderATI(GLuint id
)
5357 GET_CURRENT_CONTEXT(ctx
);
5360 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5364 if (ctx
->ExecuteFlag
) {
5365 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5369 static void GLAPIENTRY
5370 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5372 GET_CURRENT_CONTEXT(ctx
);
5375 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5383 if (ctx
->ExecuteFlag
) {
5384 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5388 static void GLAPIENTRY
5389 save_Attr1fNV(GLenum attr
, GLfloat x
)
5391 GET_CURRENT_CONTEXT(ctx
);
5393 SAVE_FLUSH_VERTICES(ctx
);
5394 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5400 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5401 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5402 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5404 if (ctx
->ExecuteFlag
) {
5405 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5409 static void GLAPIENTRY
5410 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5412 GET_CURRENT_CONTEXT(ctx
);
5414 SAVE_FLUSH_VERTICES(ctx
);
5415 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5422 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5423 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5424 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5426 if (ctx
->ExecuteFlag
) {
5427 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5431 static void GLAPIENTRY
5432 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5434 GET_CURRENT_CONTEXT(ctx
);
5436 SAVE_FLUSH_VERTICES(ctx
);
5437 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5445 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5446 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5447 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5449 if (ctx
->ExecuteFlag
) {
5450 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5454 static void GLAPIENTRY
5455 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5457 GET_CURRENT_CONTEXT(ctx
);
5459 SAVE_FLUSH_VERTICES(ctx
);
5460 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5469 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5470 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5471 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5473 if (ctx
->ExecuteFlag
) {
5474 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5479 static void GLAPIENTRY
5480 save_Attr1fARB(GLenum attr
, GLfloat x
)
5482 GET_CURRENT_CONTEXT(ctx
);
5484 SAVE_FLUSH_VERTICES(ctx
);
5485 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5491 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5492 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5493 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5495 if (ctx
->ExecuteFlag
) {
5496 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5500 static void GLAPIENTRY
5501 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5503 GET_CURRENT_CONTEXT(ctx
);
5505 SAVE_FLUSH_VERTICES(ctx
);
5506 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5513 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5514 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5515 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5517 if (ctx
->ExecuteFlag
) {
5518 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5522 static void GLAPIENTRY
5523 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5525 GET_CURRENT_CONTEXT(ctx
);
5527 SAVE_FLUSH_VERTICES(ctx
);
5528 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5536 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5537 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5538 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5540 if (ctx
->ExecuteFlag
) {
5541 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5545 static void GLAPIENTRY
5546 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5548 GET_CURRENT_CONTEXT(ctx
);
5550 SAVE_FLUSH_VERTICES(ctx
);
5551 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5560 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5561 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5562 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5564 if (ctx
->ExecuteFlag
) {
5565 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5570 static void GLAPIENTRY
5571 save_EvalCoord1f(GLfloat x
)
5573 GET_CURRENT_CONTEXT(ctx
);
5575 SAVE_FLUSH_VERTICES(ctx
);
5576 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5580 if (ctx
->ExecuteFlag
) {
5581 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5585 static void GLAPIENTRY
5586 save_EvalCoord1fv(const GLfloat
* v
)
5588 save_EvalCoord1f(v
[0]);
5591 static void GLAPIENTRY
5592 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5594 GET_CURRENT_CONTEXT(ctx
);
5596 SAVE_FLUSH_VERTICES(ctx
);
5597 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5602 if (ctx
->ExecuteFlag
) {
5603 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5607 static void GLAPIENTRY
5608 save_EvalCoord2fv(const GLfloat
* v
)
5610 save_EvalCoord2f(v
[0], v
[1]);
5614 static void GLAPIENTRY
5615 save_EvalPoint1(GLint x
)
5617 GET_CURRENT_CONTEXT(ctx
);
5619 SAVE_FLUSH_VERTICES(ctx
);
5620 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5624 if (ctx
->ExecuteFlag
) {
5625 CALL_EvalPoint1(ctx
->Exec
, (x
));
5629 static void GLAPIENTRY
5630 save_EvalPoint2(GLint x
, GLint y
)
5632 GET_CURRENT_CONTEXT(ctx
);
5634 SAVE_FLUSH_VERTICES(ctx
);
5635 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5640 if (ctx
->ExecuteFlag
) {
5641 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5645 static void GLAPIENTRY
5646 save_Indexf(GLfloat x
)
5648 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5651 static void GLAPIENTRY
5652 save_Indexfv(const GLfloat
* v
)
5654 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5657 static void GLAPIENTRY
5658 save_EdgeFlag(GLboolean x
)
5660 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5665 * Compare 'count' elements of vectors 'a' and 'b'.
5666 * \return GL_TRUE if equal, GL_FALSE if different.
5668 static inline GLboolean
5669 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5671 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5676 * This glMaterial function is used for glMaterial calls that are outside
5677 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5679 static void GLAPIENTRY
5680 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5682 GET_CURRENT_CONTEXT(ctx
);
5690 case GL_FRONT_AND_BACK
:
5693 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5702 case GL_AMBIENT_AND_DIFFUSE
:
5708 case GL_COLOR_INDEXES
:
5712 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5716 if (ctx
->ExecuteFlag
) {
5717 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5720 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5722 /* Try to eliminate redundant statechanges. Because it is legal to
5723 * call glMaterial even inside begin/end calls, don't need to worry
5724 * about ctx->Driver.CurrentSavePrimitive here.
5726 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5727 if (bitmask
& (1 << i
)) {
5728 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5729 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5730 /* no change in material value */
5731 bitmask
&= ~(1 << i
);
5734 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5735 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5740 /* If this call has no effect, return early */
5744 SAVE_FLUSH_VERTICES(ctx
);
5746 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5750 for (i
= 0; i
< args
; i
++)
5751 n
[3 + i
].f
= param
[i
];
5755 static void GLAPIENTRY
5756 save_Begin(GLenum mode
)
5758 GET_CURRENT_CONTEXT(ctx
);
5760 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5761 /* compile this error into the display list */
5762 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5764 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5765 /* compile this error into the display list */
5766 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5771 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5773 /* Give the driver an opportunity to hook in an optimized
5774 * display list compiler.
5776 if (vbo_save_NotifyBegin(ctx
, mode
))
5779 SAVE_FLUSH_VERTICES(ctx
);
5780 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5785 if (ctx
->ExecuteFlag
) {
5786 CALL_Begin(ctx
->Exec
, (mode
));
5791 static void GLAPIENTRY
5794 GET_CURRENT_CONTEXT(ctx
);
5795 SAVE_FLUSH_VERTICES(ctx
);
5796 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5797 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5798 if (ctx
->ExecuteFlag
) {
5799 CALL_End(ctx
->Exec
, ());
5803 static void GLAPIENTRY
5804 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5806 GET_CURRENT_CONTEXT(ctx
);
5808 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5809 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5816 if (ctx
->ExecuteFlag
) {
5817 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5822 static void GLAPIENTRY
5823 save_Vertex2f(GLfloat x
, GLfloat y
)
5825 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5828 static void GLAPIENTRY
5829 save_Vertex2fv(const GLfloat
* v
)
5831 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5834 static void GLAPIENTRY
5835 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5837 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5840 static void GLAPIENTRY
5841 save_Vertex3fv(const GLfloat
* v
)
5843 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5846 static void GLAPIENTRY
5847 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5849 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5852 static void GLAPIENTRY
5853 save_Vertex4fv(const GLfloat
* v
)
5855 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5858 static void GLAPIENTRY
5859 save_TexCoord1f(GLfloat x
)
5861 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5864 static void GLAPIENTRY
5865 save_TexCoord1fv(const GLfloat
* v
)
5867 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5870 static void GLAPIENTRY
5871 save_TexCoord2f(GLfloat x
, GLfloat y
)
5873 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5876 static void GLAPIENTRY
5877 save_TexCoord2fv(const GLfloat
* v
)
5879 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5882 static void GLAPIENTRY
5883 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5885 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5888 static void GLAPIENTRY
5889 save_TexCoord3fv(const GLfloat
* v
)
5891 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5894 static void GLAPIENTRY
5895 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5897 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5900 static void GLAPIENTRY
5901 save_TexCoord4fv(const GLfloat
* v
)
5903 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5906 static void GLAPIENTRY
5907 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5909 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5912 static void GLAPIENTRY
5913 save_Normal3fv(const GLfloat
* v
)
5915 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5918 static void GLAPIENTRY
5919 save_FogCoordfEXT(GLfloat x
)
5921 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5924 static void GLAPIENTRY
5925 save_FogCoordfvEXT(const GLfloat
* v
)
5927 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5930 static void GLAPIENTRY
5931 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5933 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5936 static void GLAPIENTRY
5937 save_Color3fv(const GLfloat
* v
)
5939 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5942 static void GLAPIENTRY
5943 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5945 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5948 static void GLAPIENTRY
5949 save_Color4fv(const GLfloat
* v
)
5951 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5954 static void GLAPIENTRY
5955 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5957 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5960 static void GLAPIENTRY
5961 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5963 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5967 /* Just call the respective ATTR for texcoord
5969 static void GLAPIENTRY
5970 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5972 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5973 save_Attr1fNV(attr
, x
);
5976 static void GLAPIENTRY
5977 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5979 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5980 save_Attr1fNV(attr
, v
[0]);
5983 static void GLAPIENTRY
5984 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5986 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5987 save_Attr2fNV(attr
, x
, y
);
5990 static void GLAPIENTRY
5991 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5993 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5994 save_Attr2fNV(attr
, v
[0], v
[1]);
5997 static void GLAPIENTRY
5998 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
6000 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6001 save_Attr3fNV(attr
, x
, y
, z
);
6004 static void GLAPIENTRY
6005 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
6007 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6008 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
6011 static void GLAPIENTRY
6012 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
6013 GLfloat z
, GLfloat w
)
6015 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6016 save_Attr4fNV(attr
, x
, y
, z
, w
);
6019 static void GLAPIENTRY
6020 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
6022 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6023 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
6028 * Record a GL_INVALID_VALUE error when an invalid vertex attribute
6034 GET_CURRENT_CONTEXT(ctx
);
6035 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
6040 static void GLAPIENTRY
6041 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
6043 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6044 save_Attr1fARB(index
, x
);
6049 static void GLAPIENTRY
6050 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
6052 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6053 save_Attr1fARB(index
, v
[0]);
6058 static void GLAPIENTRY
6059 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
6061 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6062 save_Attr2fARB(index
, x
, y
);
6067 static void GLAPIENTRY
6068 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
6070 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6071 save_Attr2fARB(index
, v
[0], v
[1]);
6076 static void GLAPIENTRY
6077 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
6079 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6080 save_Attr3fARB(index
, x
, y
, z
);
6085 static void GLAPIENTRY
6086 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
6088 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6089 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
6094 static void GLAPIENTRY
6095 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
6098 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6099 save_Attr4fARB(index
, x
, y
, z
, w
);
6104 static void GLAPIENTRY
6105 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
6107 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6108 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
6113 static void GLAPIENTRY
6114 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
6115 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
6116 GLbitfield mask
, GLenum filter
)
6118 GET_CURRENT_CONTEXT(ctx
);
6120 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6121 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
6134 if (ctx
->ExecuteFlag
) {
6135 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
6136 dstX0
, dstY0
, dstX1
, dstY1
,
6142 /** GL_EXT_provoking_vertex */
6143 static void GLAPIENTRY
6144 save_ProvokingVertexEXT(GLenum mode
)
6146 GET_CURRENT_CONTEXT(ctx
);
6148 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6149 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
6153 if (ctx
->ExecuteFlag
) {
6154 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6155 _mesa_ProvokingVertex(mode
);
6160 /** GL_EXT_transform_feedback */
6161 static void GLAPIENTRY
6162 save_BeginTransformFeedback(GLenum mode
)
6164 GET_CURRENT_CONTEXT(ctx
);
6166 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6167 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
6171 if (ctx
->ExecuteFlag
) {
6172 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
6177 /** GL_EXT_transform_feedback */
6178 static void GLAPIENTRY
6179 save_EndTransformFeedback(void)
6181 GET_CURRENT_CONTEXT(ctx
);
6182 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6183 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
6184 if (ctx
->ExecuteFlag
) {
6185 CALL_EndTransformFeedback(ctx
->Exec
, ());
6189 static void GLAPIENTRY
6190 save_BindTransformFeedback(GLenum target
, GLuint name
)
6192 GET_CURRENT_CONTEXT(ctx
);
6194 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6195 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
6200 if (ctx
->ExecuteFlag
) {
6201 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
6205 static void GLAPIENTRY
6206 save_PauseTransformFeedback(void)
6208 GET_CURRENT_CONTEXT(ctx
);
6209 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6210 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
6211 if (ctx
->ExecuteFlag
) {
6212 CALL_PauseTransformFeedback(ctx
->Exec
, ());
6216 static void GLAPIENTRY
6217 save_ResumeTransformFeedback(void)
6219 GET_CURRENT_CONTEXT(ctx
);
6220 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6221 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
6222 if (ctx
->ExecuteFlag
) {
6223 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
6227 static void GLAPIENTRY
6228 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
6230 GET_CURRENT_CONTEXT(ctx
);
6232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6233 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
6238 if (ctx
->ExecuteFlag
) {
6239 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
6243 static void GLAPIENTRY
6244 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
6246 GET_CURRENT_CONTEXT(ctx
);
6248 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6249 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
6255 if (ctx
->ExecuteFlag
) {
6256 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
6260 static void GLAPIENTRY
6261 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
6264 GET_CURRENT_CONTEXT(ctx
);
6266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6267 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
6271 n
[3].si
= primcount
;
6273 if (ctx
->ExecuteFlag
) {
6274 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
6278 static void GLAPIENTRY
6279 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
6280 GLuint stream
, GLsizei primcount
)
6282 GET_CURRENT_CONTEXT(ctx
);
6284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6285 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
6290 n
[4].si
= primcount
;
6292 if (ctx
->ExecuteFlag
) {
6293 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
6298 static void GLAPIENTRY
6299 save_UseProgram(GLuint program
)
6301 GET_CURRENT_CONTEXT(ctx
);
6303 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6304 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
6308 if (ctx
->ExecuteFlag
) {
6309 CALL_UseProgram(ctx
->Exec
, (program
));
6314 static void GLAPIENTRY
6315 save_Uniform1fARB(GLint location
, GLfloat x
)
6317 GET_CURRENT_CONTEXT(ctx
);
6319 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6320 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6325 if (ctx
->ExecuteFlag
) {
6326 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6331 static void GLAPIENTRY
6332 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6334 GET_CURRENT_CONTEXT(ctx
);
6336 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6337 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6343 if (ctx
->ExecuteFlag
) {
6344 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6349 static void GLAPIENTRY
6350 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6352 GET_CURRENT_CONTEXT(ctx
);
6354 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6355 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6362 if (ctx
->ExecuteFlag
) {
6363 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6368 static void GLAPIENTRY
6369 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6371 GET_CURRENT_CONTEXT(ctx
);
6373 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6374 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6382 if (ctx
->ExecuteFlag
) {
6383 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6388 static void GLAPIENTRY
6389 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6391 GET_CURRENT_CONTEXT(ctx
);
6393 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6394 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
6398 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6400 if (ctx
->ExecuteFlag
) {
6401 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6405 static void GLAPIENTRY
6406 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6408 GET_CURRENT_CONTEXT(ctx
);
6410 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6411 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6415 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6417 if (ctx
->ExecuteFlag
) {
6418 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6422 static void GLAPIENTRY
6423 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6425 GET_CURRENT_CONTEXT(ctx
);
6427 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6428 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6432 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6434 if (ctx
->ExecuteFlag
) {
6435 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6439 static void GLAPIENTRY
6440 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6442 GET_CURRENT_CONTEXT(ctx
);
6444 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6445 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6449 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6451 if (ctx
->ExecuteFlag
) {
6452 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6457 static void GLAPIENTRY
6458 save_Uniform1iARB(GLint location
, GLint x
)
6460 GET_CURRENT_CONTEXT(ctx
);
6462 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6463 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6468 if (ctx
->ExecuteFlag
) {
6469 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6473 static void GLAPIENTRY
6474 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6476 GET_CURRENT_CONTEXT(ctx
);
6478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6479 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6485 if (ctx
->ExecuteFlag
) {
6486 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6490 static void GLAPIENTRY
6491 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6493 GET_CURRENT_CONTEXT(ctx
);
6495 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6496 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6503 if (ctx
->ExecuteFlag
) {
6504 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6508 static void GLAPIENTRY
6509 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6511 GET_CURRENT_CONTEXT(ctx
);
6513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6514 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6522 if (ctx
->ExecuteFlag
) {
6523 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6529 static void GLAPIENTRY
6530 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6532 GET_CURRENT_CONTEXT(ctx
);
6534 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6535 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6539 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6541 if (ctx
->ExecuteFlag
) {
6542 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6546 static void GLAPIENTRY
6547 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6549 GET_CURRENT_CONTEXT(ctx
);
6551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6552 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6556 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6558 if (ctx
->ExecuteFlag
) {
6559 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6563 static void GLAPIENTRY
6564 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6566 GET_CURRENT_CONTEXT(ctx
);
6568 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6569 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6573 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6575 if (ctx
->ExecuteFlag
) {
6576 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6580 static void GLAPIENTRY
6581 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6583 GET_CURRENT_CONTEXT(ctx
);
6585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6586 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6590 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6592 if (ctx
->ExecuteFlag
) {
6593 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6599 static void GLAPIENTRY
6600 save_Uniform1ui(GLint location
, GLuint x
)
6602 GET_CURRENT_CONTEXT(ctx
);
6604 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6605 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6610 if (ctx
->ExecuteFlag
) {
6611 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6615 static void GLAPIENTRY
6616 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6618 GET_CURRENT_CONTEXT(ctx
);
6620 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6621 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6627 if (ctx
->ExecuteFlag
) {
6628 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6632 static void GLAPIENTRY
6633 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6635 GET_CURRENT_CONTEXT(ctx
);
6637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6638 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6645 if (ctx
->ExecuteFlag
) {
6646 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6650 static void GLAPIENTRY
6651 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6653 GET_CURRENT_CONTEXT(ctx
);
6655 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6656 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6664 if (ctx
->ExecuteFlag
) {
6665 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6671 static void GLAPIENTRY
6672 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6674 GET_CURRENT_CONTEXT(ctx
);
6676 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6677 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6681 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6683 if (ctx
->ExecuteFlag
) {
6684 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6688 static void GLAPIENTRY
6689 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6691 GET_CURRENT_CONTEXT(ctx
);
6693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6694 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6698 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6700 if (ctx
->ExecuteFlag
) {
6701 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6705 static void GLAPIENTRY
6706 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6708 GET_CURRENT_CONTEXT(ctx
);
6710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6711 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6715 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6717 if (ctx
->ExecuteFlag
) {
6718 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6722 static void GLAPIENTRY
6723 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6725 GET_CURRENT_CONTEXT(ctx
);
6727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6728 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6732 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6734 if (ctx
->ExecuteFlag
) {
6735 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6741 static void GLAPIENTRY
6742 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6745 GET_CURRENT_CONTEXT(ctx
);
6747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6748 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6753 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6755 if (ctx
->ExecuteFlag
) {
6756 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6760 static void GLAPIENTRY
6761 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6764 GET_CURRENT_CONTEXT(ctx
);
6766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6767 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6772 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6774 if (ctx
->ExecuteFlag
) {
6775 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6779 static void GLAPIENTRY
6780 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6783 GET_CURRENT_CONTEXT(ctx
);
6785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6786 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6791 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6793 if (ctx
->ExecuteFlag
) {
6794 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6799 static void GLAPIENTRY
6800 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6803 GET_CURRENT_CONTEXT(ctx
);
6805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6806 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6811 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6813 if (ctx
->ExecuteFlag
) {
6814 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6818 static void GLAPIENTRY
6819 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6822 GET_CURRENT_CONTEXT(ctx
);
6824 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6825 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6830 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6832 if (ctx
->ExecuteFlag
) {
6833 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6838 static void GLAPIENTRY
6839 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6842 GET_CURRENT_CONTEXT(ctx
);
6844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6845 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6850 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6852 if (ctx
->ExecuteFlag
) {
6853 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6857 static void GLAPIENTRY
6858 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6861 GET_CURRENT_CONTEXT(ctx
);
6863 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6864 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6869 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6871 if (ctx
->ExecuteFlag
) {
6872 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6877 static void GLAPIENTRY
6878 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6881 GET_CURRENT_CONTEXT(ctx
);
6883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6884 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6889 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6891 if (ctx
->ExecuteFlag
) {
6892 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6896 static void GLAPIENTRY
6897 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6900 GET_CURRENT_CONTEXT(ctx
);
6902 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6903 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6908 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6910 if (ctx
->ExecuteFlag
) {
6911 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6915 static void GLAPIENTRY
6916 save_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
6918 GET_CURRENT_CONTEXT(ctx
);
6920 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6921 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM_STAGES
, 3);
6927 if (ctx
->ExecuteFlag
) {
6928 CALL_UseProgramStages(ctx
->Exec
, (pipeline
, stages
, program
));
6932 static void GLAPIENTRY
6933 save_ProgramUniform1f(GLuint program
, GLint location
, GLfloat x
)
6935 GET_CURRENT_CONTEXT(ctx
);
6937 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6938 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1F
, 3);
6944 if (ctx
->ExecuteFlag
) {
6945 CALL_ProgramUniform1f(ctx
->Exec
, (program
, location
, x
));
6949 static void GLAPIENTRY
6950 save_ProgramUniform2f(GLuint program
, GLint location
, GLfloat x
, GLfloat y
)
6952 GET_CURRENT_CONTEXT(ctx
);
6954 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6955 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2F
, 4);
6962 if (ctx
->ExecuteFlag
) {
6963 CALL_ProgramUniform2f(ctx
->Exec
, (program
, location
, x
, y
));
6967 static void GLAPIENTRY
6968 save_ProgramUniform3f(GLuint program
, GLint location
,
6969 GLfloat x
, GLfloat y
, GLfloat z
)
6971 GET_CURRENT_CONTEXT(ctx
);
6973 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6974 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3F
, 5);
6982 if (ctx
->ExecuteFlag
) {
6983 CALL_ProgramUniform3f(ctx
->Exec
, (program
, location
, x
, y
, z
));
6987 static void GLAPIENTRY
6988 save_ProgramUniform4f(GLuint program
, GLint location
,
6989 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6991 GET_CURRENT_CONTEXT(ctx
);
6993 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6994 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4F
, 6);
7003 if (ctx
->ExecuteFlag
) {
7004 CALL_ProgramUniform4f(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7008 static void GLAPIENTRY
7009 save_ProgramUniform1fv(GLuint program
, GLint location
, GLsizei count
,
7012 GET_CURRENT_CONTEXT(ctx
);
7014 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7015 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1FV
, 3 + POINTER_DWORDS
);
7020 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLfloat
)));
7022 if (ctx
->ExecuteFlag
) {
7023 CALL_ProgramUniform1fv(ctx
->Exec
, (program
, location
, count
, v
));
7027 static void GLAPIENTRY
7028 save_ProgramUniform2fv(GLuint program
, GLint location
, GLsizei count
,
7031 GET_CURRENT_CONTEXT(ctx
);
7033 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7034 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2FV
, 3 + POINTER_DWORDS
);
7039 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLfloat
)));
7041 if (ctx
->ExecuteFlag
) {
7042 CALL_ProgramUniform2fv(ctx
->Exec
, (program
, location
, count
, v
));
7046 static void GLAPIENTRY
7047 save_ProgramUniform3fv(GLuint program
, GLint location
, GLsizei count
,
7050 GET_CURRENT_CONTEXT(ctx
);
7052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7053 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3FV
, 3 + POINTER_DWORDS
);
7058 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLfloat
)));
7060 if (ctx
->ExecuteFlag
) {
7061 CALL_ProgramUniform3fv(ctx
->Exec
, (program
, location
, count
, v
));
7065 static void GLAPIENTRY
7066 save_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
7069 GET_CURRENT_CONTEXT(ctx
);
7071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7072 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4FV
, 3 + POINTER_DWORDS
);
7077 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLfloat
)));
7079 if (ctx
->ExecuteFlag
) {
7080 CALL_ProgramUniform4fv(ctx
->Exec
, (program
, location
, count
, v
));
7084 static void GLAPIENTRY
7085 save_ProgramUniform1i(GLuint program
, GLint location
, GLint x
)
7087 GET_CURRENT_CONTEXT(ctx
);
7089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7090 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1I
, 3);
7096 if (ctx
->ExecuteFlag
) {
7097 CALL_ProgramUniform1i(ctx
->Exec
, (program
, location
, x
));
7101 static void GLAPIENTRY
7102 save_ProgramUniform2i(GLuint program
, GLint location
, GLint x
, GLint y
)
7104 GET_CURRENT_CONTEXT(ctx
);
7106 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7107 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2I
, 4);
7114 if (ctx
->ExecuteFlag
) {
7115 CALL_ProgramUniform2i(ctx
->Exec
, (program
, location
, x
, y
));
7119 static void GLAPIENTRY
7120 save_ProgramUniform3i(GLuint program
, GLint location
,
7121 GLint x
, GLint y
, GLint z
)
7123 GET_CURRENT_CONTEXT(ctx
);
7125 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7126 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3I
, 5);
7134 if (ctx
->ExecuteFlag
) {
7135 CALL_ProgramUniform3i(ctx
->Exec
, (program
, location
, x
, y
, z
));
7139 static void GLAPIENTRY
7140 save_ProgramUniform4i(GLuint program
, GLint location
,
7141 GLint x
, GLint y
, GLint z
, GLint w
)
7143 GET_CURRENT_CONTEXT(ctx
);
7145 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7146 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4I
, 6);
7155 if (ctx
->ExecuteFlag
) {
7156 CALL_ProgramUniform4i(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7160 static void GLAPIENTRY
7161 save_ProgramUniform1iv(GLuint program
, GLint location
, GLsizei count
,
7164 GET_CURRENT_CONTEXT(ctx
);
7166 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7167 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1IV
, 3 + POINTER_DWORDS
);
7172 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLint
)));
7174 if (ctx
->ExecuteFlag
) {
7175 CALL_ProgramUniform1iv(ctx
->Exec
, (program
, location
, count
, v
));
7179 static void GLAPIENTRY
7180 save_ProgramUniform2iv(GLuint program
, GLint location
, GLsizei count
,
7183 GET_CURRENT_CONTEXT(ctx
);
7185 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7186 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2IV
, 3 + POINTER_DWORDS
);
7191 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLint
)));
7193 if (ctx
->ExecuteFlag
) {
7194 CALL_ProgramUniform2iv(ctx
->Exec
, (program
, location
, count
, v
));
7198 static void GLAPIENTRY
7199 save_ProgramUniform3iv(GLuint program
, GLint location
, GLsizei count
,
7202 GET_CURRENT_CONTEXT(ctx
);
7204 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7205 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3IV
, 3 + POINTER_DWORDS
);
7210 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLint
)));
7212 if (ctx
->ExecuteFlag
) {
7213 CALL_ProgramUniform3iv(ctx
->Exec
, (program
, location
, count
, v
));
7217 static void GLAPIENTRY
7218 save_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
7221 GET_CURRENT_CONTEXT(ctx
);
7223 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7224 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4IV
, 3 + POINTER_DWORDS
);
7229 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLint
)));
7231 if (ctx
->ExecuteFlag
) {
7232 CALL_ProgramUniform4iv(ctx
->Exec
, (program
, location
, count
, v
));
7236 static void GLAPIENTRY
7237 save_ProgramUniform1ui(GLuint program
, GLint location
, GLuint x
)
7239 GET_CURRENT_CONTEXT(ctx
);
7241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7242 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UI
, 3);
7248 if (ctx
->ExecuteFlag
) {
7249 CALL_ProgramUniform1ui(ctx
->Exec
, (program
, location
, x
));
7253 static void GLAPIENTRY
7254 save_ProgramUniform2ui(GLuint program
, GLint location
, GLuint x
, GLuint y
)
7256 GET_CURRENT_CONTEXT(ctx
);
7258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7259 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UI
, 4);
7266 if (ctx
->ExecuteFlag
) {
7267 CALL_ProgramUniform2ui(ctx
->Exec
, (program
, location
, x
, y
));
7271 static void GLAPIENTRY
7272 save_ProgramUniform3ui(GLuint program
, GLint location
,
7273 GLuint x
, GLuint y
, GLuint z
)
7275 GET_CURRENT_CONTEXT(ctx
);
7277 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7278 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UI
, 5);
7286 if (ctx
->ExecuteFlag
) {
7287 CALL_ProgramUniform3ui(ctx
->Exec
, (program
, location
, x
, y
, z
));
7291 static void GLAPIENTRY
7292 save_ProgramUniform4ui(GLuint program
, GLint location
,
7293 GLuint x
, GLuint y
, GLuint z
, GLuint w
)
7295 GET_CURRENT_CONTEXT(ctx
);
7297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7298 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UI
, 6);
7307 if (ctx
->ExecuteFlag
) {
7308 CALL_ProgramUniform4ui(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7312 static void GLAPIENTRY
7313 save_ProgramUniform1uiv(GLuint program
, GLint location
, GLsizei count
,
7316 GET_CURRENT_CONTEXT(ctx
);
7318 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7319 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UIV
, 3 + POINTER_DWORDS
);
7324 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLuint
)));
7326 if (ctx
->ExecuteFlag
) {
7327 CALL_ProgramUniform1uiv(ctx
->Exec
, (program
, location
, count
, v
));
7331 static void GLAPIENTRY
7332 save_ProgramUniform2uiv(GLuint program
, GLint location
, GLsizei count
,
7335 GET_CURRENT_CONTEXT(ctx
);
7337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7338 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UIV
, 3 + POINTER_DWORDS
);
7343 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLuint
)));
7345 if (ctx
->ExecuteFlag
) {
7346 CALL_ProgramUniform2uiv(ctx
->Exec
, (program
, location
, count
, v
));
7350 static void GLAPIENTRY
7351 save_ProgramUniform3uiv(GLuint program
, GLint location
, GLsizei count
,
7354 GET_CURRENT_CONTEXT(ctx
);
7356 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7357 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UIV
, 3 + POINTER_DWORDS
);
7362 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLuint
)));
7364 if (ctx
->ExecuteFlag
) {
7365 CALL_ProgramUniform3uiv(ctx
->Exec
, (program
, location
, count
, v
));
7369 static void GLAPIENTRY
7370 save_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
7373 GET_CURRENT_CONTEXT(ctx
);
7375 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7376 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UIV
, 3 + POINTER_DWORDS
);
7381 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLuint
)));
7383 if (ctx
->ExecuteFlag
) {
7384 CALL_ProgramUniform4uiv(ctx
->Exec
, (program
, location
, count
, v
));
7388 static void GLAPIENTRY
7389 save_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
7390 GLboolean transpose
, const GLfloat
*v
)
7392 GET_CURRENT_CONTEXT(ctx
);
7394 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7395 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
7396 4 + POINTER_DWORDS
);
7402 save_pointer(&n
[5], memdup(v
, count
* 2 * 2 * sizeof(GLfloat
)));
7404 if (ctx
->ExecuteFlag
) {
7405 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
7406 (program
, location
, count
, transpose
, v
));
7410 static void GLAPIENTRY
7411 save_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
7412 GLboolean transpose
, const GLfloat
*v
)
7414 GET_CURRENT_CONTEXT(ctx
);
7416 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7417 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
7418 4 + POINTER_DWORDS
);
7424 save_pointer(&n
[5], memdup(v
, count
* 2 * 3 * sizeof(GLfloat
)));
7426 if (ctx
->ExecuteFlag
) {
7427 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
7428 (program
, location
, count
, transpose
, v
));
7432 static void GLAPIENTRY
7433 save_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
7434 GLboolean transpose
, const GLfloat
*v
)
7436 GET_CURRENT_CONTEXT(ctx
);
7438 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7439 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
7440 4 + POINTER_DWORDS
);
7446 save_pointer(&n
[5], memdup(v
, count
* 2 * 4 * sizeof(GLfloat
)));
7448 if (ctx
->ExecuteFlag
) {
7449 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
7450 (program
, location
, count
, transpose
, v
));
7454 static void GLAPIENTRY
7455 save_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
7456 GLboolean transpose
, const GLfloat
*v
)
7458 GET_CURRENT_CONTEXT(ctx
);
7460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7461 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
7462 4 + POINTER_DWORDS
);
7468 save_pointer(&n
[5], memdup(v
, count
* 3 * 2 * sizeof(GLfloat
)));
7470 if (ctx
->ExecuteFlag
) {
7471 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
7472 (program
, location
, count
, transpose
, v
));
7476 static void GLAPIENTRY
7477 save_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
7478 GLboolean transpose
, const GLfloat
*v
)
7480 GET_CURRENT_CONTEXT(ctx
);
7482 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7483 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
7484 4 + POINTER_DWORDS
);
7490 save_pointer(&n
[5], memdup(v
, count
* 3 * 3 * sizeof(GLfloat
)));
7492 if (ctx
->ExecuteFlag
) {
7493 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
7494 (program
, location
, count
, transpose
, v
));
7498 static void GLAPIENTRY
7499 save_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
7500 GLboolean transpose
, const GLfloat
*v
)
7502 GET_CURRENT_CONTEXT(ctx
);
7504 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7505 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
7506 4 + POINTER_DWORDS
);
7512 save_pointer(&n
[5], memdup(v
, count
* 3 * 4 * sizeof(GLfloat
)));
7514 if (ctx
->ExecuteFlag
) {
7515 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
7516 (program
, location
, count
, transpose
, v
));
7520 static void GLAPIENTRY
7521 save_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
7522 GLboolean transpose
, const GLfloat
*v
)
7524 GET_CURRENT_CONTEXT(ctx
);
7526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7527 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
7528 4 + POINTER_DWORDS
);
7534 save_pointer(&n
[5], memdup(v
, count
* 4 * 2 * sizeof(GLfloat
)));
7536 if (ctx
->ExecuteFlag
) {
7537 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
7538 (program
, location
, count
, transpose
, v
));
7542 static void GLAPIENTRY
7543 save_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
7544 GLboolean transpose
, const GLfloat
*v
)
7546 GET_CURRENT_CONTEXT(ctx
);
7548 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7549 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
7550 4 + POINTER_DWORDS
);
7556 save_pointer(&n
[5], memdup(v
, count
* 4 * 3 * sizeof(GLfloat
)));
7558 if (ctx
->ExecuteFlag
) {
7559 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
7560 (program
, location
, count
, transpose
, v
));
7564 static void GLAPIENTRY
7565 save_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
7566 GLboolean transpose
, const GLfloat
*v
)
7568 GET_CURRENT_CONTEXT(ctx
);
7570 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7571 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
7572 4 + POINTER_DWORDS
);
7578 save_pointer(&n
[5], memdup(v
, count
* 4 * 4 * sizeof(GLfloat
)));
7580 if (ctx
->ExecuteFlag
) {
7581 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
7582 (program
, location
, count
, transpose
, v
));
7586 static void GLAPIENTRY
7587 save_ClipControl(GLenum origin
, GLenum depth
)
7589 GET_CURRENT_CONTEXT(ctx
);
7591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7592 n
= alloc_instruction(ctx
, OPCODE_CLIP_CONTROL
, 2);
7597 if (ctx
->ExecuteFlag
) {
7598 CALL_ClipControl(ctx
->Exec
, (origin
, depth
));
7602 static void GLAPIENTRY
7603 save_ClampColorARB(GLenum target
, GLenum clamp
)
7605 GET_CURRENT_CONTEXT(ctx
);
7607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7608 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
7613 if (ctx
->ExecuteFlag
) {
7614 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
7618 /** GL_EXT_texture_integer */
7619 static void GLAPIENTRY
7620 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
7622 GET_CURRENT_CONTEXT(ctx
);
7624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7625 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
7632 if (ctx
->ExecuteFlag
) {
7633 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7637 /** GL_EXT_texture_integer */
7638 static void GLAPIENTRY
7639 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
7641 GET_CURRENT_CONTEXT(ctx
);
7643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7644 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
7651 if (ctx
->ExecuteFlag
) {
7652 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7656 /** GL_EXT_texture_integer */
7657 static void GLAPIENTRY
7658 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
7660 GET_CURRENT_CONTEXT(ctx
);
7662 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7663 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
7672 if (ctx
->ExecuteFlag
) {
7673 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
7677 /** GL_EXT_texture_integer */
7678 static void GLAPIENTRY
7679 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
7681 GET_CURRENT_CONTEXT(ctx
);
7683 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7684 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
7688 n
[3].ui
= params
[0];
7689 n
[4].ui
= params
[1];
7690 n
[5].ui
= params
[2];
7691 n
[6].ui
= params
[3];
7693 if (ctx
->ExecuteFlag
) {
7694 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
7698 /* GL_ARB_instanced_arrays */
7699 static void GLAPIENTRY
7700 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
7702 GET_CURRENT_CONTEXT(ctx
);
7704 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7705 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
7710 if (ctx
->ExecuteFlag
) {
7711 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
7716 /* GL_NV_texture_barrier */
7717 static void GLAPIENTRY
7718 save_TextureBarrierNV(void)
7720 GET_CURRENT_CONTEXT(ctx
);
7721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7722 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
7723 if (ctx
->ExecuteFlag
) {
7724 CALL_TextureBarrierNV(ctx
->Exec
, ());
7729 /* GL_ARB_sampler_objects */
7730 static void GLAPIENTRY
7731 save_BindSampler(GLuint unit
, GLuint sampler
)
7734 GET_CURRENT_CONTEXT(ctx
);
7735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7736 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
7741 if (ctx
->ExecuteFlag
) {
7742 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
7746 static void GLAPIENTRY
7747 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7750 GET_CURRENT_CONTEXT(ctx
);
7751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7752 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7757 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7763 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7766 if (ctx
->ExecuteFlag
) {
7767 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7771 static void GLAPIENTRY
7772 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7776 parray
[1] = parray
[2] = parray
[3] = 0;
7777 save_SamplerParameteriv(sampler
, pname
, parray
);
7780 static void GLAPIENTRY
7781 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7784 GET_CURRENT_CONTEXT(ctx
);
7785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7786 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7791 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7797 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7800 if (ctx
->ExecuteFlag
) {
7801 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7805 static void GLAPIENTRY
7806 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7810 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7811 save_SamplerParameterfv(sampler
, pname
, parray
);
7814 static void GLAPIENTRY
7815 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7818 GET_CURRENT_CONTEXT(ctx
);
7819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7820 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7825 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7831 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7834 if (ctx
->ExecuteFlag
) {
7835 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7839 static void GLAPIENTRY
7840 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7843 GET_CURRENT_CONTEXT(ctx
);
7844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7845 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7849 n
[3].ui
= params
[0];
7850 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7851 n
[4].ui
= params
[1];
7852 n
[5].ui
= params
[2];
7853 n
[6].ui
= params
[3];
7856 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7859 if (ctx
->ExecuteFlag
) {
7860 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7864 static void GLAPIENTRY
7865 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7868 GET_CURRENT_CONTEXT(ctx
);
7869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7870 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7872 union uint64_pair p
;
7875 n
[2].ui
= p
.uint32
[0];
7876 n
[3].ui
= p
.uint32
[1];
7877 save_pointer(&n
[4], sync
);
7879 if (ctx
->ExecuteFlag
) {
7880 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7885 /** GL_NV_conditional_render */
7886 static void GLAPIENTRY
7887 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7889 GET_CURRENT_CONTEXT(ctx
);
7891 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7892 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7897 if (ctx
->ExecuteFlag
) {
7898 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7902 static void GLAPIENTRY
7903 save_EndConditionalRender(void)
7905 GET_CURRENT_CONTEXT(ctx
);
7906 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7907 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7908 if (ctx
->ExecuteFlag
) {
7909 CALL_EndConditionalRender(ctx
->Exec
, ());
7913 static void GLAPIENTRY
7914 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7916 GET_CURRENT_CONTEXT(ctx
);
7918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7919 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7925 if (ctx
->ExecuteFlag
) {
7926 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7930 /** GL_EXT_window_rectangles */
7931 static void GLAPIENTRY
7932 save_WindowRectanglesEXT(GLenum mode
, GLsizei count
, const GLint
*box
)
7934 GET_CURRENT_CONTEXT(ctx
);
7936 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7937 n
= alloc_instruction(ctx
, OPCODE_WINDOW_RECTANGLES
, 2 + POINTER_DWORDS
);
7939 GLint
*box_copy
= NULL
;
7942 box_copy
= memdup(box
, sizeof(GLint
) * 4 * count
);
7945 save_pointer(&n
[3], box_copy
);
7947 if (ctx
->ExecuteFlag
) {
7948 CALL_WindowRectanglesEXT(ctx
->Exec
, (mode
, count
, box
));
7953 * Save an error-generating command into display list.
7955 * KW: Will appear in the list before the vertex buffer containing the
7956 * command that provoked the error. I don't see this as a problem.
7959 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7962 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
7965 save_pointer(&n
[2], (void *) s
);
7966 /* note: the data/string here doesn't have to be freed in
7967 * _mesa_delete_list() since the string is never dynamically
7975 * Compile an error into current display list.
7978 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7980 if (ctx
->CompileFlag
)
7981 save_error(ctx
, error
, s
);
7982 if (ctx
->ExecuteFlag
)
7983 _mesa_error(ctx
, error
, "%s", s
);
7988 * Test if ID names a display list.
7991 islist(struct gl_context
*ctx
, GLuint list
)
7993 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
8003 /**********************************************************************/
8004 /* Display list execution */
8005 /**********************************************************************/
8009 * Execute a display list. Note that the ListBase offset must have already
8010 * been added before calling this function. I.e. the list argument is
8011 * the absolute list number, not relative to ListBase.
8012 * \param list - display list number
8015 execute_list(struct gl_context
*ctx
, GLuint list
)
8017 struct gl_display_list
*dlist
;
8021 if (list
== 0 || !islist(ctx
, list
))
8024 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
8025 /* raise an error? */
8029 dlist
= _mesa_lookup_list(ctx
, list
);
8033 ctx
->ListState
.CallDepth
++;
8035 vbo_save_BeginCallList(ctx
, dlist
);
8041 const OpCode opcode
= n
[0].opcode
;
8043 if (is_ext_opcode(opcode
)) {
8044 n
+= ext_opcode_execute(ctx
, n
);
8049 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
8052 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8054 case OPCODE_ALPHA_FUNC
:
8055 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8057 case OPCODE_BIND_TEXTURE
:
8058 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8062 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8063 ctx
->Unpack
= ctx
->DefaultPacking
;
8064 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
8065 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
8066 get_pointer(&n
[7])));
8067 ctx
->Unpack
= save
; /* restore */
8070 case OPCODE_BLEND_COLOR
:
8071 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8073 case OPCODE_BLEND_EQUATION
:
8074 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
8076 case OPCODE_BLEND_EQUATION_SEPARATE
:
8077 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8079 case OPCODE_BLEND_FUNC_SEPARATE
:
8080 CALL_BlendFuncSeparate(ctx
->Exec
,
8081 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8084 case OPCODE_BLEND_FUNC_I
:
8085 /* GL_ARB_draw_buffers_blend */
8086 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
8088 case OPCODE_BLEND_FUNC_SEPARATE_I
:
8089 /* GL_ARB_draw_buffers_blend */
8090 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
8093 case OPCODE_BLEND_EQUATION_I
:
8094 /* GL_ARB_draw_buffers_blend */
8095 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8097 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
8098 /* GL_ARB_draw_buffers_blend */
8099 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
8100 (n
[1].ui
, n
[2].e
, n
[3].e
));
8103 case OPCODE_CALL_LIST
:
8104 /* Generated by glCallList(), don't add ListBase */
8105 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
8106 execute_list(ctx
, n
[1].ui
);
8109 case OPCODE_CALL_LISTS
:
8110 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
8111 CALL_CallLists(ctx
->Exec
, (n
[1].i
, n
[2].e
, get_pointer(&n
[3])));
8115 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
8117 case OPCODE_CLEAR_BUFFER_IV
:
8124 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8127 case OPCODE_CLEAR_BUFFER_UIV
:
8134 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8137 case OPCODE_CLEAR_BUFFER_FV
:
8144 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8147 case OPCODE_CLEAR_BUFFER_FI
:
8148 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
8150 case OPCODE_CLEAR_COLOR
:
8151 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8153 case OPCODE_CLEAR_ACCUM
:
8154 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8156 case OPCODE_CLEAR_DEPTH
:
8157 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
8159 case OPCODE_CLEAR_INDEX
:
8160 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
8162 case OPCODE_CLEAR_STENCIL
:
8163 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
8165 case OPCODE_CLIP_PLANE
:
8172 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
8175 case OPCODE_COLOR_MASK
:
8176 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
8178 case OPCODE_COLOR_MASK_INDEXED
:
8179 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
8182 case OPCODE_COLOR_MATERIAL
:
8183 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8185 case OPCODE_COPY_PIXELS
:
8186 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8187 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
8190 case OPCODE_COPY_TEX_IMAGE1D
:
8191 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
8192 n
[5].i
, n
[6].i
, n
[7].i
));
8194 case OPCODE_COPY_TEX_IMAGE2D
:
8195 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
8196 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
8198 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
8199 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8200 n
[4].i
, n
[5].i
, n
[6].i
));
8202 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
8203 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8204 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8207 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
8208 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8209 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8212 case OPCODE_CULL_FACE
:
8213 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
8215 case OPCODE_DEPTH_FUNC
:
8216 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
8218 case OPCODE_DEPTH_MASK
:
8219 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
8221 case OPCODE_DEPTH_RANGE
:
8222 CALL_DepthRange(ctx
->Exec
,
8223 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
8225 case OPCODE_DISABLE
:
8226 CALL_Disable(ctx
->Exec
, (n
[1].e
));
8228 case OPCODE_DISABLE_INDEXED
:
8229 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8231 case OPCODE_DRAW_BUFFER
:
8232 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
8234 case OPCODE_DRAW_PIXELS
:
8236 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8237 ctx
->Unpack
= ctx
->DefaultPacking
;
8238 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
8239 get_pointer(&n
[5])));
8240 ctx
->Unpack
= save
; /* restore */
8244 CALL_Enable(ctx
->Exec
, (n
[1].e
));
8246 case OPCODE_ENABLE_INDEXED
:
8247 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8249 case OPCODE_EVALMESH1
:
8250 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
8252 case OPCODE_EVALMESH2
:
8253 CALL_EvalMesh2(ctx
->Exec
,
8254 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8263 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
8266 case OPCODE_FRONT_FACE
:
8267 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
8269 case OPCODE_FRUSTUM
:
8270 CALL_Frustum(ctx
->Exec
,
8271 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8274 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8276 case OPCODE_INDEX_MASK
:
8277 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
8279 case OPCODE_INIT_NAMES
:
8280 CALL_InitNames(ctx
->Exec
, ());
8289 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
8292 case OPCODE_LIGHT_MODEL
:
8299 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
8302 case OPCODE_LINE_STIPPLE
:
8303 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
8305 case OPCODE_LINE_WIDTH
:
8306 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
8308 case OPCODE_LIST_BASE
:
8309 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
8311 case OPCODE_LOAD_IDENTITY
:
8312 CALL_LoadIdentity(ctx
->Exec
, ());
8314 case OPCODE_LOAD_MATRIX
:
8315 STATIC_ASSERT(sizeof(Node
) == sizeof(GLfloat
));
8316 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
8318 case OPCODE_LOAD_NAME
:
8319 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
8321 case OPCODE_LOGIC_OP
:
8322 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
8326 GLenum target
= n
[1].e
;
8327 GLint ustride
= _mesa_evaluator_components(target
);
8328 GLint uorder
= n
[5].i
;
8329 GLfloat u1
= n
[2].f
;
8330 GLfloat u2
= n
[3].f
;
8331 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8332 (GLfloat
*) get_pointer(&n
[6])));
8337 GLenum target
= n
[1].e
;
8338 GLfloat u1
= n
[2].f
;
8339 GLfloat u2
= n
[3].f
;
8340 GLfloat v1
= n
[4].f
;
8341 GLfloat v2
= n
[5].f
;
8342 GLint ustride
= n
[6].i
;
8343 GLint vstride
= n
[7].i
;
8344 GLint uorder
= n
[8].i
;
8345 GLint vorder
= n
[9].i
;
8346 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8347 v1
, v2
, vstride
, vorder
,
8348 (GLfloat
*) get_pointer(&n
[10])));
8351 case OPCODE_MAPGRID1
:
8352 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8354 case OPCODE_MAPGRID2
:
8355 CALL_MapGrid2f(ctx
->Exec
,
8356 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
8358 case OPCODE_MATRIX_MODE
:
8359 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
8361 case OPCODE_MULT_MATRIX
:
8362 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
8365 CALL_Ortho(ctx
->Exec
,
8366 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8368 case OPCODE_PASSTHROUGH
:
8369 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
8371 case OPCODE_PIXEL_MAP
:
8372 CALL_PixelMapfv(ctx
->Exec
,
8373 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
8375 case OPCODE_PIXEL_TRANSFER
:
8376 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8378 case OPCODE_PIXEL_ZOOM
:
8379 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8381 case OPCODE_POINT_SIZE
:
8382 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
8384 case OPCODE_POINT_PARAMETERS
:
8390 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8393 case OPCODE_POLYGON_MODE
:
8394 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8396 case OPCODE_POLYGON_STIPPLE
:
8398 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8399 ctx
->Unpack
= ctx
->DefaultPacking
;
8400 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
8401 ctx
->Unpack
= save
; /* restore */
8404 case OPCODE_POLYGON_OFFSET
:
8405 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8407 case OPCODE_POLYGON_OFFSET_CLAMP
:
8408 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8410 case OPCODE_POP_ATTRIB
:
8411 CALL_PopAttrib(ctx
->Exec
, ());
8413 case OPCODE_POP_MATRIX
:
8414 CALL_PopMatrix(ctx
->Exec
, ());
8416 case OPCODE_POP_NAME
:
8417 CALL_PopName(ctx
->Exec
, ());
8419 case OPCODE_PRIORITIZE_TEXTURE
:
8420 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
8422 case OPCODE_PUSH_ATTRIB
:
8423 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
8425 case OPCODE_PUSH_MATRIX
:
8426 CALL_PushMatrix(ctx
->Exec
, ());
8428 case OPCODE_PUSH_NAME
:
8429 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
8431 case OPCODE_RASTER_POS
:
8432 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8434 case OPCODE_READ_BUFFER
:
8435 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
8438 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8441 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8443 case OPCODE_SCISSOR
:
8444 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8446 case OPCODE_SHADE_MODEL
:
8447 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
8449 case OPCODE_PROVOKING_VERTEX
:
8450 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
8452 case OPCODE_STENCIL_FUNC
:
8453 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
8455 case OPCODE_STENCIL_MASK
:
8456 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
8458 case OPCODE_STENCIL_OP
:
8459 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
8461 case OPCODE_STENCIL_FUNC_SEPARATE
:
8462 CALL_StencilFuncSeparate(ctx
->Exec
,
8463 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
8465 case OPCODE_STENCIL_MASK_SEPARATE
:
8466 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8468 case OPCODE_STENCIL_OP_SEPARATE
:
8469 CALL_StencilOpSeparate(ctx
->Exec
,
8470 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8479 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8489 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8492 case OPCODE_TEXPARAMETER
:
8499 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8502 case OPCODE_TEX_IMAGE1D
:
8504 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8505 ctx
->Unpack
= ctx
->DefaultPacking
;
8506 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
8508 n
[3].i
, /* components */
8510 n
[5].e
, /* border */
8511 n
[6].e
, /* format */
8513 get_pointer(&n
[8])));
8514 ctx
->Unpack
= save
; /* restore */
8517 case OPCODE_TEX_IMAGE2D
:
8519 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8520 ctx
->Unpack
= ctx
->DefaultPacking
;
8521 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
8523 n
[3].i
, /* components */
8525 n
[5].i
, /* height */
8526 n
[6].e
, /* border */
8527 n
[7].e
, /* format */
8529 get_pointer(&n
[9])));
8530 ctx
->Unpack
= save
; /* restore */
8533 case OPCODE_TEX_IMAGE3D
:
8535 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8536 ctx
->Unpack
= ctx
->DefaultPacking
;
8537 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
8539 n
[3].i
, /* components */
8541 n
[5].i
, /* height */
8543 n
[7].e
, /* border */
8544 n
[8].e
, /* format */
8546 get_pointer(&n
[10])));
8547 ctx
->Unpack
= save
; /* restore */
8550 case OPCODE_TEX_SUB_IMAGE1D
:
8552 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8553 ctx
->Unpack
= ctx
->DefaultPacking
;
8554 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8556 n
[6].e
, get_pointer(&n
[7])));
8557 ctx
->Unpack
= save
; /* restore */
8560 case OPCODE_TEX_SUB_IMAGE2D
:
8562 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8563 ctx
->Unpack
= ctx
->DefaultPacking
;
8564 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8566 n
[6].i
, n
[7].e
, n
[8].e
,
8567 get_pointer(&n
[9])));
8568 ctx
->Unpack
= save
; /* restore */
8571 case OPCODE_TEX_SUB_IMAGE3D
:
8573 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8574 ctx
->Unpack
= ctx
->DefaultPacking
;
8575 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8576 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8577 n
[8].i
, n
[9].e
, n
[10].e
,
8578 get_pointer(&n
[11])));
8579 ctx
->Unpack
= save
; /* restore */
8582 case OPCODE_TRANSLATE
:
8583 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8585 case OPCODE_VIEWPORT
:
8586 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8587 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8589 case OPCODE_WINDOW_POS
:
8590 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8592 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8593 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8595 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8596 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8597 n
[4].i
, n
[5].i
, n
[6].i
,
8598 get_pointer(&n
[7])));
8600 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8601 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8602 n
[4].i
, n
[5].i
, n
[6].i
,
8603 n
[7].i
, get_pointer(&n
[8])));
8605 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8606 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8607 n
[4].i
, n
[5].i
, n
[6].i
,
8609 get_pointer(&n
[9])));
8611 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8612 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8613 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8615 get_pointer(&n
[7])));
8617 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8618 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8619 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8620 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8621 get_pointer(&n
[9])));
8623 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8624 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8625 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8626 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8628 get_pointer(&n
[11])));
8630 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8631 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8633 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8634 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8636 case OPCODE_BIND_PROGRAM_ARB
: /* GL_ARB_vertex_program */
8637 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8639 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8640 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8641 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8644 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8645 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8647 case OPCODE_DEPTH_BOUNDS_EXT
:
8648 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8650 case OPCODE_PROGRAM_STRING_ARB
:
8651 CALL_ProgramStringARB(ctx
->Exec
,
8652 (n
[1].e
, n
[2].e
, n
[3].i
,
8653 get_pointer(&n
[4])));
8655 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8656 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8660 case OPCODE_BEGIN_QUERY_ARB
:
8661 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8663 case OPCODE_END_QUERY_ARB
:
8664 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8666 case OPCODE_QUERY_COUNTER
:
8667 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8669 case OPCODE_BEGIN_QUERY_INDEXED
:
8670 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8672 case OPCODE_END_QUERY_INDEXED
:
8673 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8675 case OPCODE_DRAW_BUFFERS_ARB
:
8677 GLenum buffers
[MAX_DRAW_BUFFERS
];
8678 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8679 for (i
= 0; i
< count
; i
++)
8680 buffers
[i
] = n
[2 + i
].e
;
8681 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8684 case OPCODE_BLIT_FRAMEBUFFER
:
8685 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8686 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8689 case OPCODE_USE_PROGRAM
:
8690 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8692 case OPCODE_UNIFORM_1F
:
8693 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8695 case OPCODE_UNIFORM_2F
:
8696 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8698 case OPCODE_UNIFORM_3F
:
8699 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8701 case OPCODE_UNIFORM_4F
:
8702 CALL_Uniform4f(ctx
->Exec
,
8703 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8705 case OPCODE_UNIFORM_1FV
:
8706 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8708 case OPCODE_UNIFORM_2FV
:
8709 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8711 case OPCODE_UNIFORM_3FV
:
8712 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8714 case OPCODE_UNIFORM_4FV
:
8715 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8717 case OPCODE_UNIFORM_1I
:
8718 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8720 case OPCODE_UNIFORM_2I
:
8721 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8723 case OPCODE_UNIFORM_3I
:
8724 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8726 case OPCODE_UNIFORM_4I
:
8727 CALL_Uniform4i(ctx
->Exec
,
8728 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8730 case OPCODE_UNIFORM_1IV
:
8731 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8733 case OPCODE_UNIFORM_2IV
:
8734 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8736 case OPCODE_UNIFORM_3IV
:
8737 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8739 case OPCODE_UNIFORM_4IV
:
8740 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8742 case OPCODE_UNIFORM_1UI
:
8743 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8745 case OPCODE_UNIFORM_2UI
:
8746 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8748 case OPCODE_UNIFORM_3UI
:
8749 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8751 case OPCODE_UNIFORM_4UI
:
8752 /*CALL_Uniform4uiARB(ctx->Exec,
8753 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8756 case OPCODE_UNIFORM_1UIV
:
8757 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
8758 get_pointer(&n[3])));*/
8760 case OPCODE_UNIFORM_2UIV
:
8761 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
8762 get_pointer(&n[3])));*/
8764 case OPCODE_UNIFORM_3UIV
:
8765 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
8766 get_pointer(&n[3])));*/
8768 case OPCODE_UNIFORM_4UIV
:
8769 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
8770 get_pointer(&n[3])));*/
8772 case OPCODE_UNIFORM_MATRIX22
:
8773 CALL_UniformMatrix2fv(ctx
->Exec
,
8774 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8776 case OPCODE_UNIFORM_MATRIX33
:
8777 CALL_UniformMatrix3fv(ctx
->Exec
,
8778 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8780 case OPCODE_UNIFORM_MATRIX44
:
8781 CALL_UniformMatrix4fv(ctx
->Exec
,
8782 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8784 case OPCODE_UNIFORM_MATRIX23
:
8785 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8786 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8788 case OPCODE_UNIFORM_MATRIX32
:
8789 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8790 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8792 case OPCODE_UNIFORM_MATRIX24
:
8793 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8794 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8796 case OPCODE_UNIFORM_MATRIX42
:
8797 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8798 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8800 case OPCODE_UNIFORM_MATRIX34
:
8801 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8802 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8804 case OPCODE_UNIFORM_MATRIX43
:
8805 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8806 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8809 case OPCODE_USE_PROGRAM_STAGES
:
8810 CALL_UseProgramStages(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8812 case OPCODE_PROGRAM_UNIFORM_1F
:
8813 CALL_ProgramUniform1f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
));
8815 case OPCODE_PROGRAM_UNIFORM_2F
:
8816 CALL_ProgramUniform2f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
, n
[4].f
));
8818 case OPCODE_PROGRAM_UNIFORM_3F
:
8819 CALL_ProgramUniform3f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8820 n
[3].f
, n
[4].f
, n
[5].f
));
8822 case OPCODE_PROGRAM_UNIFORM_4F
:
8823 CALL_ProgramUniform4f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8824 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8826 case OPCODE_PROGRAM_UNIFORM_1FV
:
8827 CALL_ProgramUniform1fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8828 get_pointer(&n
[4])));
8830 case OPCODE_PROGRAM_UNIFORM_2FV
:
8831 CALL_ProgramUniform2fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8832 get_pointer(&n
[4])));
8834 case OPCODE_PROGRAM_UNIFORM_3FV
:
8835 CALL_ProgramUniform3fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8836 get_pointer(&n
[4])));
8838 case OPCODE_PROGRAM_UNIFORM_4FV
:
8839 CALL_ProgramUniform4fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8840 get_pointer(&n
[4])));
8842 case OPCODE_PROGRAM_UNIFORM_1I
:
8843 CALL_ProgramUniform1i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
));
8845 case OPCODE_PROGRAM_UNIFORM_2I
:
8846 CALL_ProgramUniform2i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].i
));
8848 case OPCODE_PROGRAM_UNIFORM_3I
:
8849 CALL_ProgramUniform3i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8850 n
[3].i
, n
[4].i
, n
[5].i
));
8852 case OPCODE_PROGRAM_UNIFORM_4I
:
8853 CALL_ProgramUniform4i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8854 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
));
8856 case OPCODE_PROGRAM_UNIFORM_1IV
:
8857 CALL_ProgramUniform1iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8858 get_pointer(&n
[4])));
8860 case OPCODE_PROGRAM_UNIFORM_2IV
:
8861 CALL_ProgramUniform2iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8862 get_pointer(&n
[4])));
8864 case OPCODE_PROGRAM_UNIFORM_3IV
:
8865 CALL_ProgramUniform3iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8866 get_pointer(&n
[4])));
8868 case OPCODE_PROGRAM_UNIFORM_4IV
:
8869 CALL_ProgramUniform4iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8870 get_pointer(&n
[4])));
8872 case OPCODE_PROGRAM_UNIFORM_1UI
:
8873 CALL_ProgramUniform1ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].ui
));
8875 case OPCODE_PROGRAM_UNIFORM_2UI
:
8876 CALL_ProgramUniform2ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8879 case OPCODE_PROGRAM_UNIFORM_3UI
:
8880 CALL_ProgramUniform3ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8881 n
[3].ui
, n
[4].ui
, n
[5].ui
));
8883 case OPCODE_PROGRAM_UNIFORM_4UI
:
8884 CALL_ProgramUniform4ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8886 n
[4].ui
, n
[5].ui
, n
[6].ui
));
8888 case OPCODE_PROGRAM_UNIFORM_1UIV
:
8889 CALL_ProgramUniform1uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8890 get_pointer(&n
[4])));
8892 case OPCODE_PROGRAM_UNIFORM_2UIV
:
8893 CALL_ProgramUniform2uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8894 get_pointer(&n
[4])));
8896 case OPCODE_PROGRAM_UNIFORM_3UIV
:
8897 CALL_ProgramUniform3uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8898 get_pointer(&n
[4])));
8900 case OPCODE_PROGRAM_UNIFORM_4UIV
:
8901 CALL_ProgramUniform4uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8902 get_pointer(&n
[4])));
8904 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
8905 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
8906 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8907 get_pointer(&n
[5])));
8909 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
8910 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
8911 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8912 get_pointer(&n
[5])));
8914 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
8915 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
8916 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8917 get_pointer(&n
[5])));
8919 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
8920 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
8921 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8922 get_pointer(&n
[5])));
8924 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
8925 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
8926 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8927 get_pointer(&n
[5])));
8929 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
8930 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
8931 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8932 get_pointer(&n
[5])));
8934 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
8935 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
8936 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8937 get_pointer(&n
[5])));
8939 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
8940 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
8941 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8942 get_pointer(&n
[5])));
8944 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
8945 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
8946 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8947 get_pointer(&n
[5])));
8950 case OPCODE_CLIP_CONTROL
:
8951 CALL_ClipControl(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8954 case OPCODE_CLAMP_COLOR
:
8955 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8958 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8959 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8961 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8962 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (n
[1].ui
, &n
[2].f
));
8964 case OPCODE_ATTR_1F_NV
:
8965 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8967 case OPCODE_ATTR_2F_NV
:
8968 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8970 case OPCODE_ATTR_3F_NV
:
8971 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8973 case OPCODE_ATTR_4F_NV
:
8974 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8976 case OPCODE_ATTR_1F_ARB
:
8977 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8979 case OPCODE_ATTR_2F_ARB
:
8980 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8982 case OPCODE_ATTR_3F_ARB
:
8983 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8985 case OPCODE_ATTR_4F_ARB
:
8986 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8988 case OPCODE_MATERIAL
:
8989 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8992 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8995 CALL_End(ctx
->Exec
, ());
8998 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
9000 case OPCODE_EVAL_C1
:
9001 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
9003 case OPCODE_EVAL_C2
:
9004 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
9006 case OPCODE_EVAL_P1
:
9007 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
9009 case OPCODE_EVAL_P2
:
9010 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
9013 /* GL_EXT_texture_integer */
9014 case OPCODE_CLEARCOLOR_I
:
9015 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
9017 case OPCODE_CLEARCOLOR_UI
:
9018 CALL_ClearColorIuiEXT(ctx
->Exec
,
9019 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
9021 case OPCODE_TEXPARAMETER_I
:
9028 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
9031 case OPCODE_TEXPARAMETER_UI
:
9034 params
[0] = n
[3].ui
;
9035 params
[1] = n
[4].ui
;
9036 params
[2] = n
[5].ui
;
9037 params
[3] = n
[6].ui
;
9038 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
9042 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
9043 /* GL_ARB_instanced_arrays */
9044 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
9047 case OPCODE_TEXTURE_BARRIER_NV
:
9048 CALL_TextureBarrierNV(ctx
->Exec
, ());
9051 /* GL_EXT/ARB_transform_feedback */
9052 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
9053 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
9055 case OPCODE_END_TRANSFORM_FEEDBACK
:
9056 CALL_EndTransformFeedback(ctx
->Exec
, ());
9058 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
9059 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
9061 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
9062 CALL_PauseTransformFeedback(ctx
->Exec
, ());
9064 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
9065 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
9067 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
9068 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
9070 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
9071 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
9072 (n
[1].e
, n
[2].ui
, n
[3].ui
));
9074 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
9075 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
9076 (n
[1].e
, n
[2].ui
, n
[3].si
));
9078 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
9079 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
9080 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
9084 case OPCODE_BIND_SAMPLER
:
9085 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
9087 case OPCODE_SAMPLER_PARAMETERIV
:
9094 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9097 case OPCODE_SAMPLER_PARAMETERFV
:
9104 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9107 case OPCODE_SAMPLER_PARAMETERIIV
:
9114 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9117 case OPCODE_SAMPLER_PARAMETERUIV
:
9120 params
[0] = n
[3].ui
;
9121 params
[1] = n
[4].ui
;
9122 params
[2] = n
[5].ui
;
9123 params
[3] = n
[6].ui
;
9124 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9129 case OPCODE_WAIT_SYNC
:
9131 union uint64_pair p
;
9132 p
.uint32
[0] = n
[2].ui
;
9133 p
.uint32
[1] = n
[3].ui
;
9134 CALL_WaitSync(ctx
->Exec
,
9135 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
9139 /* GL_NV_conditional_render */
9140 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
9141 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
9143 case OPCODE_END_CONDITIONAL_RENDER
:
9144 CALL_EndConditionalRender(ctx
->Exec
, ());
9147 case OPCODE_UNIFORM_BLOCK_BINDING
:
9148 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
9151 /* GL_EXT_window_rectangles */
9152 case OPCODE_WINDOW_RECTANGLES
:
9153 CALL_WindowRectanglesEXT(
9154 ctx
->Exec
, (n
[1].e
, n
[2].si
, get_pointer(&n
[3])));
9157 case OPCODE_CONTINUE
:
9158 n
= (Node
*) get_pointer(&n
[1]);
9163 case OPCODE_END_OF_LIST
:
9169 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
9171 _mesa_problem(ctx
, "%s", msg
);
9176 /* increment n to point to next compiled command */
9177 if (opcode
!= OPCODE_CONTINUE
) {
9178 n
+= InstSize
[opcode
];
9183 vbo_save_EndCallList(ctx
);
9185 ctx
->ListState
.CallDepth
--;
9190 /**********************************************************************/
9192 /**********************************************************************/
9195 * Test if a display list number is valid.
9197 GLboolean GLAPIENTRY
9198 _mesa_IsList(GLuint list
)
9200 GET_CURRENT_CONTEXT(ctx
);
9201 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9202 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
9203 return islist(ctx
, list
);
9208 * Delete a sequence of consecutive display lists.
9211 _mesa_DeleteLists(GLuint list
, GLsizei range
)
9213 GET_CURRENT_CONTEXT(ctx
);
9215 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9216 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9219 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
9224 /* We may be deleting a set of bitmap lists. See if there's a
9225 * bitmap atlas to free.
9227 struct gl_bitmap_atlas
*atlas
= lookup_bitmap_atlas(ctx
, list
);
9229 _mesa_delete_bitmap_atlas(ctx
, atlas
);
9230 _mesa_HashRemove(ctx
->Shared
->BitmapAtlas
, list
);
9234 for (i
= list
; i
< list
+ range
; i
++) {
9235 destroy_list(ctx
, i
);
9241 * Return a display list number, n, such that lists n through n+range-1
9245 _mesa_GenLists(GLsizei range
)
9247 GET_CURRENT_CONTEXT(ctx
);
9249 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9250 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
9253 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
9261 * Make this an atomic operation
9263 _mesa_HashLockMutex(ctx
->Shared
->DisplayList
);
9265 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
9267 /* reserve the list IDs by with empty/dummy lists */
9269 for (i
= 0; i
< range
; i
++) {
9270 _mesa_HashInsertLocked(ctx
->Shared
->DisplayList
, base
+ i
,
9271 make_list(base
+ i
, 1));
9275 if (USE_BITMAP_ATLAS
&&
9277 ctx
->Driver
.DrawAtlasBitmaps
) {
9278 /* "range > 16" is a rough heuristic to guess when glGenLists might be
9279 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
9280 * Create the empty atlas now.
9282 struct gl_bitmap_atlas
*atlas
= lookup_bitmap_atlas(ctx
, base
);
9284 atlas
= alloc_bitmap_atlas(ctx
, base
);
9287 /* Atlas _should_ be new/empty now, but clobbering is OK */
9288 assert(atlas
->numBitmaps
== 0);
9289 atlas
->numBitmaps
= range
;
9293 _mesa_HashUnlockMutex(ctx
->Shared
->DisplayList
);
9300 * Begin a new display list.
9303 _mesa_NewList(GLuint name
, GLenum mode
)
9305 GET_CURRENT_CONTEXT(ctx
);
9307 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
9308 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9310 if (MESA_VERBOSE
& VERBOSE_API
)
9311 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
9312 _mesa_enum_to_string(mode
));
9315 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
9319 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
9320 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
9324 if (ctx
->ListState
.CurrentList
) {
9325 /* already compiling a display list */
9326 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
9330 ctx
->CompileFlag
= GL_TRUE
;
9331 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
9333 /* Reset accumulated list state */
9334 invalidate_saved_current_state( ctx
);
9336 /* Allocate new display list */
9337 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
9338 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
9339 ctx
->ListState
.CurrentPos
= 0;
9341 vbo_save_NewList(ctx
, name
, mode
);
9343 ctx
->CurrentServerDispatch
= ctx
->Save
;
9344 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9345 if (ctx
->MarshalExec
== NULL
) {
9346 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9352 * End definition of current display list.
9357 GET_CURRENT_CONTEXT(ctx
);
9358 SAVE_FLUSH_VERTICES(ctx
);
9359 FLUSH_VERTICES(ctx
, 0);
9361 if (MESA_VERBOSE
& VERBOSE_API
)
9362 _mesa_debug(ctx
, "glEndList\n");
9364 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
9365 _mesa_error(ctx
, GL_INVALID_OPERATION
,
9366 "glEndList() called inside glBegin/End");
9369 /* Check that a list is under construction */
9370 if (!ctx
->ListState
.CurrentList
) {
9371 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
9375 /* Call before emitting END_OF_LIST, in case the driver wants to
9376 * emit opcodes itself.
9378 vbo_save_EndList(ctx
);
9380 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
9384 /* Destroy old list, if any */
9385 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
9387 /* Install the new list */
9388 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
9389 ctx
->ListState
.CurrentList
->Name
,
9390 ctx
->ListState
.CurrentList
);
9393 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
9394 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
9396 ctx
->ListState
.CurrentList
= NULL
;
9397 ctx
->ListState
.CurrentBlock
= NULL
;
9398 ctx
->ListState
.CurrentPos
= 0;
9399 ctx
->ExecuteFlag
= GL_TRUE
;
9400 ctx
->CompileFlag
= GL_FALSE
;
9402 ctx
->CurrentServerDispatch
= ctx
->Exec
;
9403 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9404 if (ctx
->MarshalExec
== NULL
) {
9405 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9411 _mesa_CallList(GLuint list
)
9413 GLboolean save_compile_flag
;
9414 GET_CURRENT_CONTEXT(ctx
);
9415 FLUSH_CURRENT(ctx
, 0);
9417 if (MESA_VERBOSE
& VERBOSE_API
)
9418 _mesa_debug(ctx
, "glCallList %d\n", list
);
9421 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
9426 mesa_print_display_list( list
);
9428 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9429 * execute the display list, and restore the CompileFlag.
9431 save_compile_flag
= ctx
->CompileFlag
;
9432 if (save_compile_flag
) {
9433 ctx
->CompileFlag
= GL_FALSE
;
9436 execute_list(ctx
, list
);
9437 ctx
->CompileFlag
= save_compile_flag
;
9439 /* also restore API function pointers to point to "save" versions */
9440 if (save_compile_flag
) {
9441 ctx
->CurrentServerDispatch
= ctx
->Save
;
9442 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9443 if (ctx
->MarshalExec
== NULL
) {
9444 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9451 * Try to execute a glCallLists() command where the display lists contain
9452 * glBitmap commands with a texture atlas.
9453 * \return true for success, false otherwise
9456 render_bitmap_atlas(struct gl_context
*ctx
, GLsizei n
, GLenum type
,
9459 struct gl_bitmap_atlas
*atlas
;
9462 if (!USE_BITMAP_ATLAS
||
9463 !ctx
->Current
.RasterPosValid
||
9464 ctx
->List
.ListBase
== 0 ||
9465 type
!= GL_UNSIGNED_BYTE
||
9466 !ctx
->Driver
.DrawAtlasBitmaps
) {
9471 atlas
= lookup_bitmap_atlas(ctx
, ctx
->List
.ListBase
);
9474 /* Even if glGenLists wasn't called, we can still try to create
9477 atlas
= alloc_bitmap_atlas(ctx
, ctx
->List
.ListBase
);
9480 if (atlas
&& !atlas
->complete
&& !atlas
->incomplete
) {
9481 /* Try to build the bitmap atlas now.
9482 * If the atlas was created in glGenLists, we'll have recorded the
9483 * number of lists (bitmaps). Otherwise, take a guess at 256.
9485 if (atlas
->numBitmaps
== 0)
9486 atlas
->numBitmaps
= 256;
9487 build_bitmap_atlas(ctx
, atlas
, ctx
->List
.ListBase
);
9490 if (!atlas
|| !atlas
->complete
) {
9494 /* check that all display list IDs are in the atlas */
9495 for (i
= 0; i
< n
; i
++) {
9496 const GLubyte
*ids
= (const GLubyte
*) lists
;
9498 if (ids
[i
] >= atlas
->numBitmaps
) {
9503 ctx
->Driver
.DrawAtlasBitmaps(ctx
, atlas
, n
, (const GLubyte
*) lists
);
9510 * Execute glCallLists: call multiple display lists.
9513 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
9515 GET_CURRENT_CONTEXT(ctx
);
9517 GLboolean save_compile_flag
;
9519 if (MESA_VERBOSE
& VERBOSE_API
)
9520 _mesa_debug(ctx
, "glCallLists %d\n", n
);
9524 case GL_UNSIGNED_BYTE
:
9526 case GL_UNSIGNED_SHORT
:
9528 case GL_UNSIGNED_INT
:
9536 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
9541 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallLists(n < 0)");
9543 } else if (n
== 0 || lists
== NULL
) {
9548 if (render_bitmap_atlas(ctx
, n
, type
, lists
)) {
9552 /* Save the CompileFlag status, turn it off, execute display list,
9553 * and restore the CompileFlag.
9555 save_compile_flag
= ctx
->CompileFlag
;
9556 ctx
->CompileFlag
= GL_FALSE
;
9558 for (i
= 0; i
< n
; i
++) {
9559 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
9560 execute_list(ctx
, list
);
9563 ctx
->CompileFlag
= save_compile_flag
;
9565 /* also restore API function pointers to point to "save" versions */
9566 if (save_compile_flag
) {
9567 ctx
->CurrentServerDispatch
= ctx
->Save
;
9568 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9569 if (ctx
->MarshalExec
== NULL
) {
9570 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9577 * Set the offset added to list numbers in glCallLists.
9580 _mesa_ListBase(GLuint base
)
9582 GET_CURRENT_CONTEXT(ctx
);
9583 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9584 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9585 ctx
->List
.ListBase
= base
;
9589 * Setup the given dispatch table to point to Mesa's display list
9590 * building functions.
9592 * This does not include any of the tnl functions - they are
9593 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9597 _mesa_initialize_save_table(const struct gl_context
*ctx
)
9599 struct _glapi_table
*table
= ctx
->Save
;
9600 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
9602 /* Initially populate the dispatch table with the contents of the
9603 * normal-execution dispatch table. This lets us skip populating functions
9604 * that should be called directly instead of compiled into display lists.
9606 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
9608 _mesa_loopback_init_api_table(ctx
, table
);
9611 vbo_initialize_save_dispatch(ctx
, table
);
9614 SET_Accum(table
, save_Accum
);
9615 SET_AlphaFunc(table
, save_AlphaFunc
);
9616 SET_Bitmap(table
, save_Bitmap
);
9617 SET_BlendFunc(table
, save_BlendFunc
);
9618 SET_CallList(table
, save_CallList
);
9619 SET_CallLists(table
, save_CallLists
);
9620 SET_Clear(table
, save_Clear
);
9621 SET_ClearAccum(table
, save_ClearAccum
);
9622 SET_ClearColor(table
, save_ClearColor
);
9623 SET_ClearDepth(table
, save_ClearDepth
);
9624 SET_ClearIndex(table
, save_ClearIndex
);
9625 SET_ClearStencil(table
, save_ClearStencil
);
9626 SET_ClipPlane(table
, save_ClipPlane
);
9627 SET_ColorMask(table
, save_ColorMask
);
9628 SET_ColorMaski(table
, save_ColorMaskIndexed
);
9629 SET_ColorMaterial(table
, save_ColorMaterial
);
9630 SET_CopyPixels(table
, save_CopyPixels
);
9631 SET_CullFace(table
, save_CullFace
);
9632 SET_DepthFunc(table
, save_DepthFunc
);
9633 SET_DepthMask(table
, save_DepthMask
);
9634 SET_DepthRange(table
, save_DepthRange
);
9635 SET_Disable(table
, save_Disable
);
9636 SET_Disablei(table
, save_DisableIndexed
);
9637 SET_DrawBuffer(table
, save_DrawBuffer
);
9638 SET_DrawPixels(table
, save_DrawPixels
);
9639 SET_Enable(table
, save_Enable
);
9640 SET_Enablei(table
, save_EnableIndexed
);
9641 SET_EvalMesh1(table
, save_EvalMesh1
);
9642 SET_EvalMesh2(table
, save_EvalMesh2
);
9643 SET_Fogf(table
, save_Fogf
);
9644 SET_Fogfv(table
, save_Fogfv
);
9645 SET_Fogi(table
, save_Fogi
);
9646 SET_Fogiv(table
, save_Fogiv
);
9647 SET_FrontFace(table
, save_FrontFace
);
9648 SET_Frustum(table
, save_Frustum
);
9649 SET_Hint(table
, save_Hint
);
9650 SET_IndexMask(table
, save_IndexMask
);
9651 SET_InitNames(table
, save_InitNames
);
9652 SET_LightModelf(table
, save_LightModelf
);
9653 SET_LightModelfv(table
, save_LightModelfv
);
9654 SET_LightModeli(table
, save_LightModeli
);
9655 SET_LightModeliv(table
, save_LightModeliv
);
9656 SET_Lightf(table
, save_Lightf
);
9657 SET_Lightfv(table
, save_Lightfv
);
9658 SET_Lighti(table
, save_Lighti
);
9659 SET_Lightiv(table
, save_Lightiv
);
9660 SET_LineStipple(table
, save_LineStipple
);
9661 SET_LineWidth(table
, save_LineWidth
);
9662 SET_ListBase(table
, save_ListBase
);
9663 SET_LoadIdentity(table
, save_LoadIdentity
);
9664 SET_LoadMatrixd(table
, save_LoadMatrixd
);
9665 SET_LoadMatrixf(table
, save_LoadMatrixf
);
9666 SET_LoadName(table
, save_LoadName
);
9667 SET_LogicOp(table
, save_LogicOp
);
9668 SET_Map1d(table
, save_Map1d
);
9669 SET_Map1f(table
, save_Map1f
);
9670 SET_Map2d(table
, save_Map2d
);
9671 SET_Map2f(table
, save_Map2f
);
9672 SET_MapGrid1d(table
, save_MapGrid1d
);
9673 SET_MapGrid1f(table
, save_MapGrid1f
);
9674 SET_MapGrid2d(table
, save_MapGrid2d
);
9675 SET_MapGrid2f(table
, save_MapGrid2f
);
9676 SET_MatrixMode(table
, save_MatrixMode
);
9677 SET_MultMatrixd(table
, save_MultMatrixd
);
9678 SET_MultMatrixf(table
, save_MultMatrixf
);
9679 SET_NewList(table
, save_NewList
);
9680 SET_Ortho(table
, save_Ortho
);
9681 SET_PassThrough(table
, save_PassThrough
);
9682 SET_PixelMapfv(table
, save_PixelMapfv
);
9683 SET_PixelMapuiv(table
, save_PixelMapuiv
);
9684 SET_PixelMapusv(table
, save_PixelMapusv
);
9685 SET_PixelTransferf(table
, save_PixelTransferf
);
9686 SET_PixelTransferi(table
, save_PixelTransferi
);
9687 SET_PixelZoom(table
, save_PixelZoom
);
9688 SET_PointSize(table
, save_PointSize
);
9689 SET_PolygonMode(table
, save_PolygonMode
);
9690 SET_PolygonOffset(table
, save_PolygonOffset
);
9691 SET_PolygonStipple(table
, save_PolygonStipple
);
9692 SET_PopAttrib(table
, save_PopAttrib
);
9693 SET_PopMatrix(table
, save_PopMatrix
);
9694 SET_PopName(table
, save_PopName
);
9695 SET_PushAttrib(table
, save_PushAttrib
);
9696 SET_PushMatrix(table
, save_PushMatrix
);
9697 SET_PushName(table
, save_PushName
);
9698 SET_RasterPos2d(table
, save_RasterPos2d
);
9699 SET_RasterPos2dv(table
, save_RasterPos2dv
);
9700 SET_RasterPos2f(table
, save_RasterPos2f
);
9701 SET_RasterPos2fv(table
, save_RasterPos2fv
);
9702 SET_RasterPos2i(table
, save_RasterPos2i
);
9703 SET_RasterPos2iv(table
, save_RasterPos2iv
);
9704 SET_RasterPos2s(table
, save_RasterPos2s
);
9705 SET_RasterPos2sv(table
, save_RasterPos2sv
);
9706 SET_RasterPos3d(table
, save_RasterPos3d
);
9707 SET_RasterPos3dv(table
, save_RasterPos3dv
);
9708 SET_RasterPos3f(table
, save_RasterPos3f
);
9709 SET_RasterPos3fv(table
, save_RasterPos3fv
);
9710 SET_RasterPos3i(table
, save_RasterPos3i
);
9711 SET_RasterPos3iv(table
, save_RasterPos3iv
);
9712 SET_RasterPos3s(table
, save_RasterPos3s
);
9713 SET_RasterPos3sv(table
, save_RasterPos3sv
);
9714 SET_RasterPos4d(table
, save_RasterPos4d
);
9715 SET_RasterPos4dv(table
, save_RasterPos4dv
);
9716 SET_RasterPos4f(table
, save_RasterPos4f
);
9717 SET_RasterPos4fv(table
, save_RasterPos4fv
);
9718 SET_RasterPos4i(table
, save_RasterPos4i
);
9719 SET_RasterPos4iv(table
, save_RasterPos4iv
);
9720 SET_RasterPos4s(table
, save_RasterPos4s
);
9721 SET_RasterPos4sv(table
, save_RasterPos4sv
);
9722 SET_ReadBuffer(table
, save_ReadBuffer
);
9723 SET_Rectf(table
, save_Rectf
);
9724 SET_Rotated(table
, save_Rotated
);
9725 SET_Rotatef(table
, save_Rotatef
);
9726 SET_Scaled(table
, save_Scaled
);
9727 SET_Scalef(table
, save_Scalef
);
9728 SET_Scissor(table
, save_Scissor
);
9729 SET_ShadeModel(table
, save_ShadeModel
);
9730 SET_StencilFunc(table
, save_StencilFunc
);
9731 SET_StencilMask(table
, save_StencilMask
);
9732 SET_StencilOp(table
, save_StencilOp
);
9733 SET_TexEnvf(table
, save_TexEnvf
);
9734 SET_TexEnvfv(table
, save_TexEnvfv
);
9735 SET_TexEnvi(table
, save_TexEnvi
);
9736 SET_TexEnviv(table
, save_TexEnviv
);
9737 SET_TexGend(table
, save_TexGend
);
9738 SET_TexGendv(table
, save_TexGendv
);
9739 SET_TexGenf(table
, save_TexGenf
);
9740 SET_TexGenfv(table
, save_TexGenfv
);
9741 SET_TexGeni(table
, save_TexGeni
);
9742 SET_TexGeniv(table
, save_TexGeniv
);
9743 SET_TexImage1D(table
, save_TexImage1D
);
9744 SET_TexImage2D(table
, save_TexImage2D
);
9745 SET_TexParameterf(table
, save_TexParameterf
);
9746 SET_TexParameterfv(table
, save_TexParameterfv
);
9747 SET_TexParameteri(table
, save_TexParameteri
);
9748 SET_TexParameteriv(table
, save_TexParameteriv
);
9749 SET_Translated(table
, save_Translated
);
9750 SET_Translatef(table
, save_Translatef
);
9751 SET_Viewport(table
, save_Viewport
);
9754 SET_BindTexture(table
, save_BindTexture
);
9755 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
9756 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
9757 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
9758 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
9759 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
9760 SET_TexSubImage1D(table
, save_TexSubImage1D
);
9761 SET_TexSubImage2D(table
, save_TexSubImage2D
);
9764 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
9765 SET_TexImage3D(table
, save_TexImage3D
);
9766 SET_TexSubImage3D(table
, save_TexSubImage3D
);
9769 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
9770 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
9771 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
9773 /* ATI_separate_stencil */
9774 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
9776 /* GL_ARB_imaging */
9777 /* Not all are supported */
9778 SET_BlendColor(table
, save_BlendColor
);
9779 SET_BlendEquation(table
, save_BlendEquation
);
9781 /* 2. GL_EXT_blend_color */
9783 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9786 /* 3. GL_EXT_polygon_offset */
9787 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9789 /* 6. GL_EXT_texture3d */
9791 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9792 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9793 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9796 /* 37. GL_EXT_blend_minmax */
9798 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9801 /* 54. GL_EXT_point_parameters */
9802 SET_PointParameterf(table
, save_PointParameterfEXT
);
9803 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9805 /* 173. GL_EXT_blend_func_separate */
9806 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9808 /* 197. GL_MESA_window_pos */
9809 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9810 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9811 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9812 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9813 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9814 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9815 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9816 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9817 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9818 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9819 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9820 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9821 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9822 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9823 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9824 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9825 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9826 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9827 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9828 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9829 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9830 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9831 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9832 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9834 /* 245. GL_ATI_fragment_shader */
9835 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9836 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9838 /* 262. GL_NV_point_sprite */
9839 SET_PointParameteri(table
, save_PointParameteriNV
);
9840 SET_PointParameteriv(table
, save_PointParameterivNV
);
9842 /* 268. GL_EXT_stencil_two_side */
9843 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9845 /* ???. GL_EXT_depth_bounds_test */
9846 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9848 /* ARB 1. GL_ARB_multitexture */
9849 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9851 /* ARB 3. GL_ARB_transpose_matrix */
9852 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9853 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9854 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9855 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9857 /* ARB 5. GL_ARB_multisample */
9858 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9860 /* ARB 12. GL_ARB_texture_compression */
9861 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9862 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9863 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9864 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9865 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9866 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9868 /* ARB 14. GL_ARB_point_parameters */
9869 /* aliased with EXT_point_parameters functions */
9871 /* ARB 25. GL_ARB_window_pos */
9872 /* aliased with MESA_window_pos functions */
9874 /* ARB 26. GL_ARB_vertex_program */
9875 /* ARB 27. GL_ARB_fragment_program */
9876 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9877 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9878 SET_BindProgramARB(table
, save_BindProgramARB
);
9879 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9880 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9881 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9882 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9883 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9884 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9885 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9886 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9888 SET_BeginQuery(table
, save_BeginQueryARB
);
9889 SET_EndQuery(table
, save_EndQueryARB
);
9890 SET_QueryCounter(table
, save_QueryCounter
);
9892 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9894 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9896 SET_UseProgram(table
, save_UseProgram
);
9897 SET_Uniform1f(table
, save_Uniform1fARB
);
9898 SET_Uniform2f(table
, save_Uniform2fARB
);
9899 SET_Uniform3f(table
, save_Uniform3fARB
);
9900 SET_Uniform4f(table
, save_Uniform4fARB
);
9901 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9902 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9903 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9904 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9905 SET_Uniform1i(table
, save_Uniform1iARB
);
9906 SET_Uniform2i(table
, save_Uniform2iARB
);
9907 SET_Uniform3i(table
, save_Uniform3iARB
);
9908 SET_Uniform4i(table
, save_Uniform4iARB
);
9909 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9910 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9911 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9912 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9913 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9914 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9915 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9916 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9917 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9918 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9919 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9920 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9921 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9923 /* 299. GL_EXT_blend_equation_separate */
9924 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9926 /* GL_EXT_gpu_program_parameters */
9927 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9928 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9930 /* 364. GL_EXT_provoking_vertex */
9931 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9933 /* GL_EXT_texture_integer */
9934 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9935 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9936 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9937 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9939 /* GL_ARB_clip_control */
9940 SET_ClipControl(table
, save_ClipControl
);
9942 /* GL_ARB_color_buffer_float */
9943 SET_ClampColor(table
, save_ClampColorARB
);
9946 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9947 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9948 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9949 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9951 SET_Uniform1ui(table
, save_Uniform1ui
);
9952 SET_Uniform2ui(table
, save_Uniform2ui
);
9953 SET_Uniform3ui(table
, save_Uniform3ui
);
9954 SET_Uniform4ui(table
, save_Uniform4ui
);
9955 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9956 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9957 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9958 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9960 (void) save_Uniform1ui
;
9961 (void) save_Uniform2ui
;
9962 (void) save_Uniform3ui
;
9963 (void) save_Uniform4ui
;
9964 (void) save_Uniform1uiv
;
9965 (void) save_Uniform2uiv
;
9966 (void) save_Uniform3uiv
;
9967 (void) save_Uniform4uiv
;
9971 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9972 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9973 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9974 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9975 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9976 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9977 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9978 SET_DrawTransformFeedbackInstanced(table
,
9979 save_DrawTransformFeedbackInstanced
);
9980 SET_DrawTransformFeedbackStreamInstanced(table
,
9981 save_DrawTransformFeedbackStreamInstanced
);
9982 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9983 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9985 /* GL_ARB_instanced_arrays */
9986 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9988 /* GL_NV_texture_barrier */
9989 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9991 SET_BindSampler(table
, save_BindSampler
);
9992 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9993 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9994 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9995 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9996 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9997 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9999 /* GL_ARB_draw_buffer_blend */
10000 SET_BlendFunciARB(table
, save_BlendFunci
);
10001 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
10002 SET_BlendEquationiARB(table
, save_BlendEquationi
);
10003 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
10005 /* GL_NV_conditional_render */
10006 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
10007 SET_EndConditionalRender(table
, save_EndConditionalRender
);
10010 SET_WaitSync(table
, save_WaitSync
);
10012 /* GL_ARB_uniform_buffer_object */
10013 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
10015 /* GL_ARB_draw_instanced */
10016 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
10017 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
10019 /* GL_ARB_draw_elements_base_vertex */
10020 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
10022 /* GL_ARB_base_instance */
10023 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
10024 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
10025 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
10027 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
10028 SET_UseProgramStages(table
, save_UseProgramStages
);
10029 SET_ProgramUniform1f(table
, save_ProgramUniform1f
);
10030 SET_ProgramUniform2f(table
, save_ProgramUniform2f
);
10031 SET_ProgramUniform3f(table
, save_ProgramUniform3f
);
10032 SET_ProgramUniform4f(table
, save_ProgramUniform4f
);
10033 SET_ProgramUniform1fv(table
, save_ProgramUniform1fv
);
10034 SET_ProgramUniform2fv(table
, save_ProgramUniform2fv
);
10035 SET_ProgramUniform3fv(table
, save_ProgramUniform3fv
);
10036 SET_ProgramUniform4fv(table
, save_ProgramUniform4fv
);
10037 SET_ProgramUniform1i(table
, save_ProgramUniform1i
);
10038 SET_ProgramUniform2i(table
, save_ProgramUniform2i
);
10039 SET_ProgramUniform3i(table
, save_ProgramUniform3i
);
10040 SET_ProgramUniform4i(table
, save_ProgramUniform4i
);
10041 SET_ProgramUniform1iv(table
, save_ProgramUniform1iv
);
10042 SET_ProgramUniform2iv(table
, save_ProgramUniform2iv
);
10043 SET_ProgramUniform3iv(table
, save_ProgramUniform3iv
);
10044 SET_ProgramUniform4iv(table
, save_ProgramUniform4iv
);
10045 SET_ProgramUniform1ui(table
, save_ProgramUniform1ui
);
10046 SET_ProgramUniform2ui(table
, save_ProgramUniform2ui
);
10047 SET_ProgramUniform3ui(table
, save_ProgramUniform3ui
);
10048 SET_ProgramUniform4ui(table
, save_ProgramUniform4ui
);
10049 SET_ProgramUniform1uiv(table
, save_ProgramUniform1uiv
);
10050 SET_ProgramUniform2uiv(table
, save_ProgramUniform2uiv
);
10051 SET_ProgramUniform3uiv(table
, save_ProgramUniform3uiv
);
10052 SET_ProgramUniform4uiv(table
, save_ProgramUniform4uiv
);
10053 SET_ProgramUniformMatrix2fv(table
, save_ProgramUniformMatrix2fv
);
10054 SET_ProgramUniformMatrix3fv(table
, save_ProgramUniformMatrix3fv
);
10055 SET_ProgramUniformMatrix4fv(table
, save_ProgramUniformMatrix4fv
);
10056 SET_ProgramUniformMatrix2x3fv(table
, save_ProgramUniformMatrix2x3fv
);
10057 SET_ProgramUniformMatrix3x2fv(table
, save_ProgramUniformMatrix3x2fv
);
10058 SET_ProgramUniformMatrix2x4fv(table
, save_ProgramUniformMatrix2x4fv
);
10059 SET_ProgramUniformMatrix4x2fv(table
, save_ProgramUniformMatrix4x2fv
);
10060 SET_ProgramUniformMatrix3x4fv(table
, save_ProgramUniformMatrix3x4fv
);
10061 SET_ProgramUniformMatrix4x3fv(table
, save_ProgramUniformMatrix4x3fv
);
10063 /* GL_EXT_polygon_offset_clamp */
10064 SET_PolygonOffsetClampEXT(table
, save_PolygonOffsetClampEXT
);
10066 /* GL_EXT_window_rectangles */
10067 SET_WindowRectanglesEXT(table
, save_WindowRectanglesEXT
);
10072 static const char *
10073 enum_string(GLenum k
)
10075 return _mesa_enum_to_string(k
);
10080 * Print the commands in a display list. For debugging only.
10081 * TODO: many commands aren't handled yet.
10082 * \param fname filename to write display list to. If null, use stdout.
10084 static void GLAPIENTRY
10085 print_list(struct gl_context
*ctx
, GLuint list
, const char *fname
)
10087 struct gl_display_list
*dlist
;
10093 f
= fopen(fname
, "w");
10098 if (!islist(ctx
, list
)) {
10099 fprintf(f
, "%u is not a display list ID\n", list
);
10103 dlist
= _mesa_lookup_list(ctx
, list
);
10110 fprintf(f
, "START-LIST %u, address %p\n", list
, (void *) n
);
10112 done
= n
? GL_FALSE
: GL_TRUE
;
10114 const OpCode opcode
= n
[0].opcode
;
10116 if (is_ext_opcode(opcode
)) {
10117 n
+= ext_opcode_print(ctx
, n
, f
);
10122 fprintf(f
, "Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
10124 case OPCODE_ACTIVE_TEXTURE
:
10125 fprintf(f
, "ActiveTexture(%s)\n", enum_string(n
[1].e
));
10127 case OPCODE_BITMAP
:
10128 fprintf(f
, "Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
10129 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
10130 get_pointer(&n
[7]));
10132 case OPCODE_BLEND_COLOR
:
10133 fprintf(f
, "BlendColor %f, %f, %f, %f\n",
10134 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10136 case OPCODE_BLEND_EQUATION
:
10137 fprintf(f
, "BlendEquation %s\n",
10138 enum_string(n
[1].e
));
10140 case OPCODE_BLEND_EQUATION_SEPARATE
:
10141 fprintf(f
, "BlendEquationSeparate %s, %s\n",
10142 enum_string(n
[1].e
),
10143 enum_string(n
[2].e
));
10145 case OPCODE_BLEND_FUNC_SEPARATE
:
10146 fprintf(f
, "BlendFuncSeparate %s, %s, %s, %s\n",
10147 enum_string(n
[1].e
),
10148 enum_string(n
[2].e
),
10149 enum_string(n
[3].e
),
10150 enum_string(n
[4].e
));
10152 case OPCODE_BLEND_EQUATION_I
:
10153 fprintf(f
, "BlendEquationi %u, %s\n",
10154 n
[1].ui
, enum_string(n
[2].e
));
10156 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
10157 fprintf(f
, "BlendEquationSeparatei %u, %s, %s\n",
10158 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
10160 case OPCODE_BLEND_FUNC_I
:
10161 fprintf(f
, "BlendFunci %u, %s, %s\n",
10162 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
10164 case OPCODE_BLEND_FUNC_SEPARATE_I
:
10165 fprintf(f
, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
10167 enum_string(n
[2].e
),
10168 enum_string(n
[3].e
),
10169 enum_string(n
[4].e
),
10170 enum_string(n
[5].e
));
10172 case OPCODE_CALL_LIST
:
10173 fprintf(f
, "CallList %d\n", (int) n
[1].ui
);
10175 case OPCODE_CALL_LISTS
:
10176 fprintf(f
, "CallLists %d, %s\n", n
[1].i
, enum_string(n
[1].e
));
10178 case OPCODE_DISABLE
:
10179 fprintf(f
, "Disable %s\n", enum_string(n
[1].e
));
10181 case OPCODE_ENABLE
:
10182 fprintf(f
, "Enable %s\n", enum_string(n
[1].e
));
10184 case OPCODE_FRUSTUM
:
10185 fprintf(f
, "Frustum %g %g %g %g %g %g\n",
10186 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10188 case OPCODE_LINE_STIPPLE
:
10189 fprintf(f
, "LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
10191 case OPCODE_LINE_WIDTH
:
10192 fprintf(f
, "LineWidth %f\n", n
[1].f
);
10194 case OPCODE_LOAD_IDENTITY
:
10195 fprintf(f
, "LoadIdentity\n");
10197 case OPCODE_LOAD_MATRIX
:
10198 fprintf(f
, "LoadMatrix\n");
10199 fprintf(f
, " %8f %8f %8f %8f\n",
10200 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
10201 fprintf(f
, " %8f %8f %8f %8f\n",
10202 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
10203 fprintf(f
, " %8f %8f %8f %8f\n",
10204 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
10205 fprintf(f
, " %8f %8f %8f %8f\n",
10206 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
10208 case OPCODE_MULT_MATRIX
:
10209 fprintf(f
, "MultMatrix (or Rotate)\n");
10210 fprintf(f
, " %8f %8f %8f %8f\n",
10211 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
10212 fprintf(f
, " %8f %8f %8f %8f\n",
10213 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
10214 fprintf(f
, " %8f %8f %8f %8f\n",
10215 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
10216 fprintf(f
, " %8f %8f %8f %8f\n",
10217 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
10220 fprintf(f
, "Ortho %g %g %g %g %g %g\n",
10221 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10223 case OPCODE_POINT_SIZE
:
10224 fprintf(f
, "PointSize %f\n", n
[1].f
);
10226 case OPCODE_POP_ATTRIB
:
10227 fprintf(f
, "PopAttrib\n");
10229 case OPCODE_POP_MATRIX
:
10230 fprintf(f
, "PopMatrix\n");
10232 case OPCODE_POP_NAME
:
10233 fprintf(f
, "PopName\n");
10235 case OPCODE_PUSH_ATTRIB
:
10236 fprintf(f
, "PushAttrib %x\n", n
[1].bf
);
10238 case OPCODE_PUSH_MATRIX
:
10239 fprintf(f
, "PushMatrix\n");
10241 case OPCODE_PUSH_NAME
:
10242 fprintf(f
, "PushName %d\n", (int) n
[1].ui
);
10244 case OPCODE_RASTER_POS
:
10245 fprintf(f
, "RasterPos %g %g %g %g\n",
10246 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10248 case OPCODE_ROTATE
:
10249 fprintf(f
, "Rotate %g %g %g %g\n",
10250 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10253 fprintf(f
, "Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
10255 case OPCODE_TRANSLATE
:
10256 fprintf(f
, "Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
10258 case OPCODE_BIND_TEXTURE
:
10259 fprintf(f
, "BindTexture %s %d\n",
10260 _mesa_enum_to_string(n
[1].ui
), n
[2].ui
);
10262 case OPCODE_SHADE_MODEL
:
10263 fprintf(f
, "ShadeModel %s\n", _mesa_enum_to_string(n
[1].ui
));
10266 fprintf(f
, "Map1 %s %.3f %.3f %d %d\n",
10267 _mesa_enum_to_string(n
[1].ui
),
10268 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
10271 fprintf(f
, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
10272 _mesa_enum_to_string(n
[1].ui
),
10273 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
10274 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
10276 case OPCODE_MAPGRID1
:
10277 fprintf(f
, "MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
10279 case OPCODE_MAPGRID2
:
10280 fprintf(f
, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
10281 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
10283 case OPCODE_EVALMESH1
:
10284 fprintf(f
, "EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
10286 case OPCODE_EVALMESH2
:
10287 fprintf(f
, "EvalMesh2 %d %d %d %d\n",
10288 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
10291 case OPCODE_ATTR_1F_NV
:
10292 fprintf(f
, "ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
10294 case OPCODE_ATTR_2F_NV
:
10295 fprintf(f
, "ATTR_2F_NV attr %d: %f %f\n",
10296 n
[1].i
, n
[2].f
, n
[3].f
);
10298 case OPCODE_ATTR_3F_NV
:
10299 fprintf(f
, "ATTR_3F_NV attr %d: %f %f %f\n",
10300 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
10302 case OPCODE_ATTR_4F_NV
:
10303 fprintf(f
, "ATTR_4F_NV attr %d: %f %f %f %f\n",
10304 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
10306 case OPCODE_ATTR_1F_ARB
:
10307 fprintf(f
, "ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
10309 case OPCODE_ATTR_2F_ARB
:
10310 fprintf(f
, "ATTR_2F_ARB attr %d: %f %f\n",
10311 n
[1].i
, n
[2].f
, n
[3].f
);
10313 case OPCODE_ATTR_3F_ARB
:
10314 fprintf(f
, "ATTR_3F_ARB attr %d: %f %f %f\n",
10315 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
10317 case OPCODE_ATTR_4F_ARB
:
10318 fprintf(f
, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
10319 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
10322 case OPCODE_MATERIAL
:
10323 fprintf(f
, "MATERIAL %x %x: %f %f %f %f\n",
10324 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10327 fprintf(f
, "BEGIN %x\n", n
[1].i
);
10330 fprintf(f
, "END\n");
10333 fprintf(f
, "RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
10336 case OPCODE_EVAL_C1
:
10337 fprintf(f
, "EVAL_C1 %f\n", n
[1].f
);
10339 case OPCODE_EVAL_C2
:
10340 fprintf(f
, "EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
10342 case OPCODE_EVAL_P1
:
10343 fprintf(f
, "EVAL_P1 %d\n", n
[1].i
);
10345 case OPCODE_EVAL_P2
:
10346 fprintf(f
, "EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
10349 case OPCODE_PROVOKING_VERTEX
:
10350 fprintf(f
, "ProvokingVertex %s\n",
10351 _mesa_enum_to_string(n
[1].ui
));
10355 * meta opcodes/commands
10358 fprintf(f
, "Error: %s %s\n", enum_string(n
[1].e
),
10359 (const char *) get_pointer(&n
[2]));
10361 case OPCODE_CONTINUE
:
10362 fprintf(f
, "DISPLAY-LIST-CONTINUE\n");
10363 n
= (Node
*) get_pointer(&n
[1]);
10366 fprintf(f
, "NOP\n");
10368 case OPCODE_END_OF_LIST
:
10369 fprintf(f
, "END-LIST %u\n", list
);
10373 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
10375 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
10376 opcode
, (void *) n
);
10380 fprintf(f
, "command %d, %u operands\n", opcode
,
10384 /* increment n to point to next compiled command */
10385 if (opcode
!= OPCODE_CONTINUE
) {
10386 n
+= InstSize
[opcode
];
10400 * Clients may call this function to help debug display list problems.
10401 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
10402 * changed, or break in the future without notice.
10405 mesa_print_display_list(GLuint list
)
10407 GET_CURRENT_CONTEXT(ctx
);
10408 print_list(ctx
, list
, NULL
);
10412 /**********************************************************************/
10413 /***** Initialization *****/
10414 /**********************************************************************/
10417 save_vtxfmt_init(GLvertexformat
* vfmt
)
10419 vfmt
->ArrayElement
= _ae_ArrayElement
;
10421 vfmt
->Begin
= save_Begin
;
10423 vfmt
->CallList
= save_CallList
;
10424 vfmt
->CallLists
= save_CallLists
;
10426 vfmt
->Color3f
= save_Color3f
;
10427 vfmt
->Color3fv
= save_Color3fv
;
10428 vfmt
->Color4f
= save_Color4f
;
10429 vfmt
->Color4fv
= save_Color4fv
;
10430 vfmt
->EdgeFlag
= save_EdgeFlag
;
10431 vfmt
->End
= save_End
;
10433 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
10434 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
10435 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
10436 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
10437 vfmt
->EvalPoint1
= save_EvalPoint1
;
10438 vfmt
->EvalPoint2
= save_EvalPoint2
;
10440 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
10441 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
10442 vfmt
->Indexf
= save_Indexf
;
10443 vfmt
->Indexfv
= save_Indexfv
;
10444 vfmt
->Materialfv
= save_Materialfv
;
10445 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
10446 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
10447 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
10448 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
10449 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
10450 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
10451 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
10452 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
10453 vfmt
->Normal3f
= save_Normal3f
;
10454 vfmt
->Normal3fv
= save_Normal3fv
;
10455 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
10456 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
10457 vfmt
->TexCoord1f
= save_TexCoord1f
;
10458 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
10459 vfmt
->TexCoord2f
= save_TexCoord2f
;
10460 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
10461 vfmt
->TexCoord3f
= save_TexCoord3f
;
10462 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
10463 vfmt
->TexCoord4f
= save_TexCoord4f
;
10464 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
10465 vfmt
->Vertex2f
= save_Vertex2f
;
10466 vfmt
->Vertex2fv
= save_Vertex2fv
;
10467 vfmt
->Vertex3f
= save_Vertex3f
;
10468 vfmt
->Vertex3fv
= save_Vertex3fv
;
10469 vfmt
->Vertex4f
= save_Vertex4f
;
10470 vfmt
->Vertex4fv
= save_Vertex4fv
;
10471 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
10472 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
10473 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
10474 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
10475 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
10476 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
10477 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
10478 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
10483 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
10484 const GLvertexformat
*vfmt
)
10486 SET_CallList(disp
, vfmt
->CallList
);
10487 SET_CallLists(disp
, vfmt
->CallLists
);
10492 * Initialize display list state for given context.
10495 _mesa_init_display_list(struct gl_context
*ctx
)
10497 static GLboolean tableInitialized
= GL_FALSE
;
10499 /* zero-out the instruction size table, just once */
10500 if (!tableInitialized
) {
10501 memset(InstSize
, 0, sizeof(InstSize
));
10502 tableInitialized
= GL_TRUE
;
10505 /* extension info */
10506 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
10509 ctx
->ListState
.CallDepth
= 0;
10510 ctx
->ExecuteFlag
= GL_TRUE
;
10511 ctx
->CompileFlag
= GL_FALSE
;
10512 ctx
->ListState
.CurrentBlock
= NULL
;
10513 ctx
->ListState
.CurrentPos
= 0;
10515 /* Display List group */
10516 ctx
->List
.ListBase
= 0;
10518 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
10520 InstSize
[OPCODE_NOP
] = 1;
10525 _mesa_free_display_list_data(struct gl_context
*ctx
)
10527 free(ctx
->ListExt
);
10528 ctx
->ListExt
= NULL
;