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
,
328 /* GL_NV_primitive_restart */
329 OPCODE_PRIMITIVE_RESTART_NV
,
330 /* GL_ARB_shader_objects */
348 OPCODE_UNIFORM_MATRIX22
,
349 OPCODE_UNIFORM_MATRIX33
,
350 OPCODE_UNIFORM_MATRIX44
,
351 OPCODE_UNIFORM_MATRIX23
,
352 OPCODE_UNIFORM_MATRIX32
,
353 OPCODE_UNIFORM_MATRIX24
,
354 OPCODE_UNIFORM_MATRIX42
,
355 OPCODE_UNIFORM_MATRIX34
,
356 OPCODE_UNIFORM_MATRIX43
,
368 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
369 OPCODE_USE_PROGRAM_STAGES
,
370 OPCODE_PROGRAM_UNIFORM_1F
,
371 OPCODE_PROGRAM_UNIFORM_2F
,
372 OPCODE_PROGRAM_UNIFORM_3F
,
373 OPCODE_PROGRAM_UNIFORM_4F
,
374 OPCODE_PROGRAM_UNIFORM_1FV
,
375 OPCODE_PROGRAM_UNIFORM_2FV
,
376 OPCODE_PROGRAM_UNIFORM_3FV
,
377 OPCODE_PROGRAM_UNIFORM_4FV
,
378 OPCODE_PROGRAM_UNIFORM_1I
,
379 OPCODE_PROGRAM_UNIFORM_2I
,
380 OPCODE_PROGRAM_UNIFORM_3I
,
381 OPCODE_PROGRAM_UNIFORM_4I
,
382 OPCODE_PROGRAM_UNIFORM_1IV
,
383 OPCODE_PROGRAM_UNIFORM_2IV
,
384 OPCODE_PROGRAM_UNIFORM_3IV
,
385 OPCODE_PROGRAM_UNIFORM_4IV
,
386 OPCODE_PROGRAM_UNIFORM_1UI
,
387 OPCODE_PROGRAM_UNIFORM_2UI
,
388 OPCODE_PROGRAM_UNIFORM_3UI
,
389 OPCODE_PROGRAM_UNIFORM_4UI
,
390 OPCODE_PROGRAM_UNIFORM_1UIV
,
391 OPCODE_PROGRAM_UNIFORM_2UIV
,
392 OPCODE_PROGRAM_UNIFORM_3UIV
,
393 OPCODE_PROGRAM_UNIFORM_4UIV
,
394 OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
395 OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
396 OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
397 OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
398 OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
399 OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
400 OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
401 OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
402 OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
404 /* GL_ARB_clip_control */
407 /* GL_ARB_color_buffer_float */
410 /* GL_EXT_framebuffer_blit */
411 OPCODE_BLIT_FRAMEBUFFER
,
413 /* Vertex attributes -- fallback for when optimized display
414 * list build isn't active.
433 /* GL_EXT_provoking_vertex */
434 OPCODE_PROVOKING_VERTEX
,
436 /* GL_EXT_transform_feedback */
437 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
438 OPCODE_END_TRANSFORM_FEEDBACK
,
439 OPCODE_BIND_TRANSFORM_FEEDBACK
,
440 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
441 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
442 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
444 /* GL_EXT_texture_integer */
446 OPCODE_CLEARCOLOR_UI
,
447 OPCODE_TEXPARAMETER_I
,
448 OPCODE_TEXPARAMETER_UI
,
450 /* GL_ARB_instanced_arrays */
451 OPCODE_VERTEX_ATTRIB_DIVISOR
,
453 /* GL_NV_texture_barrier */
454 OPCODE_TEXTURE_BARRIER_NV
,
456 /* GL_ARB_sampler_object */
458 OPCODE_SAMPLER_PARAMETERIV
,
459 OPCODE_SAMPLER_PARAMETERFV
,
460 OPCODE_SAMPLER_PARAMETERIIV
,
461 OPCODE_SAMPLER_PARAMETERUIV
,
466 /* GL_NV_conditional_render */
467 OPCODE_BEGIN_CONDITIONAL_RENDER
,
468 OPCODE_END_CONDITIONAL_RENDER
,
470 /* ARB_timer_query */
471 OPCODE_QUERY_COUNTER
,
473 /* ARB_transform_feedback3 */
474 OPCODE_BEGIN_QUERY_INDEXED
,
475 OPCODE_END_QUERY_INDEXED
,
476 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
478 /* ARB_transform_feedback_instanced */
479 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
480 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
482 /* ARB_uniform_buffer_object */
483 OPCODE_UNIFORM_BLOCK_BINDING
,
485 /* EXT_polygon_offset_clamp */
486 OPCODE_POLYGON_OFFSET_CLAMP
,
488 /* EXT_window_rectangles */
489 OPCODE_WINDOW_RECTANGLES
,
491 /* The following three are meta instructions */
492 OPCODE_ERROR
, /* raise compiled-in error */
494 OPCODE_NOP
, /* No-op (used for 8-byte alignment */
504 * Display list instructions are stored as sequences of "nodes". Nodes
505 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
506 * are linked together with a pointer.
508 * Each instruction in the display list is stored as a sequence of
509 * contiguous nodes in memory.
510 * Each node is the union of a variety of data types.
512 * Note, all of these members should be 4 bytes in size or less for the
513 * sake of compact display lists. We store 8-byte pointers in a pair of
514 * these nodes using the save/get_pointer() functions below.
532 typedef union gl_dlist_node Node
;
535 /** How many 4-byte dwords to store a pointer */
536 #define POINTER_DWORDS (sizeof(void *) / 4)
538 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
539 * space for display lists. The following types and functions are
540 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
545 GLuint dwords
[POINTER_DWORDS
];
550 * Save a 4 or 8-byte pointer at dest (and dest+1).
553 save_pointer(Node
*dest
, void *src
)
558 STATIC_ASSERT(POINTER_DWORDS
== 1 || POINTER_DWORDS
== 2);
559 STATIC_ASSERT(sizeof(Node
) == 4);
563 for (i
= 0; i
< POINTER_DWORDS
; i
++)
564 dest
[i
].ui
= p
.dwords
[i
];
569 * Retrieve a 4 or 8-byte pointer from node (node+1).
572 get_pointer(const Node
*node
)
577 for (i
= 0; i
< POINTER_DWORDS
; i
++)
578 p
.dwords
[i
] = node
[i
].ui
;
585 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
596 * How many nodes to allocate at a time. Note that bulk vertex data
597 * from glBegin/glVertex/glEnd primitives will typically wind up in
598 * a VBO, and not directly in the display list itself.
600 #define BLOCK_SIZE 256
605 * Number of nodes of storage needed for each instruction.
606 * Sizes for dynamically allocated opcodes are stored in the context struct.
608 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
611 void mesa_print_display_list(GLuint list
);
615 * Does the given display list only contain a single glBitmap call?
618 is_bitmap_list(const struct gl_display_list
*dlist
)
620 const Node
*n
= dlist
->Head
;
621 if (n
[0].opcode
== OPCODE_BITMAP
) {
622 n
+= InstSize
[OPCODE_BITMAP
];
623 if (n
[0].opcode
== OPCODE_END_OF_LIST
)
631 * Is the given display list an empty list?
634 is_empty_list(const struct gl_display_list
*dlist
)
636 const Node
*n
= dlist
->Head
;
637 return n
[0].opcode
== OPCODE_END_OF_LIST
;
642 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
645 _mesa_delete_bitmap_atlas(struct gl_context
*ctx
, struct gl_bitmap_atlas
*atlas
)
648 ctx
->Driver
.DeleteTexture(ctx
, atlas
->texObj
);
655 * Lookup a gl_bitmap_atlas by listBase ID.
657 static struct gl_bitmap_atlas
*
658 lookup_bitmap_atlas(struct gl_context
*ctx
, GLuint listBase
)
660 struct gl_bitmap_atlas
*atlas
;
662 assert(listBase
> 0);
663 atlas
= _mesa_HashLookup(ctx
->Shared
->BitmapAtlas
, listBase
);
669 * Create new bitmap atlas and insert into hash table.
671 static struct gl_bitmap_atlas
*
672 alloc_bitmap_atlas(struct gl_context
*ctx
, GLuint listBase
)
674 struct gl_bitmap_atlas
*atlas
;
676 assert(listBase
> 0);
677 assert(_mesa_HashLookup(ctx
->Shared
->BitmapAtlas
, listBase
) == NULL
);
679 atlas
= calloc(1, sizeof(*atlas
));
681 _mesa_HashInsert(ctx
->Shared
->BitmapAtlas
, listBase
, atlas
);
689 * Try to build a bitmap atlas. This involves examining a sequence of
690 * display lists which contain glBitmap commands and putting the bitmap
691 * images into a texture map (the atlas).
692 * If we succeed, gl_bitmap_atlas::complete will be set to true.
693 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
696 build_bitmap_atlas(struct gl_context
*ctx
, struct gl_bitmap_atlas
*atlas
,
699 unsigned i
, row_height
= 0, xpos
= 0, ypos
= 0;
704 assert(!atlas
->complete
);
705 assert(atlas
->numBitmaps
> 0);
707 /* We use a rectangle texture (non-normalized coords) for the atlas */
708 assert(ctx
->Extensions
.NV_texture_rectangle
);
709 assert(ctx
->Const
.MaxTextureRectSize
>= 1024);
711 atlas
->texWidth
= 1024;
712 atlas
->texHeight
= 0; /* determined below */
714 atlas
->glyphs
= malloc(atlas
->numBitmaps
* sizeof(atlas
->glyphs
[0]));
715 if (!atlas
->glyphs
) {
717 atlas
->incomplete
= true;
721 /* Loop over the display lists. They should all contain a single glBitmap
722 * call. If not, bail out. Also, compute the position and sizes of each
723 * bitmap in the atlas to determine the texture atlas size.
725 for (i
= 0; i
< atlas
->numBitmaps
; i
++) {
726 const struct gl_display_list
*list
= _mesa_lookup_list(ctx
, listBase
+ i
);
728 struct gl_bitmap_glyph
*g
= &atlas
->glyphs
[i
];
729 unsigned bitmap_width
, bitmap_height
;
730 float bitmap_xmove
, bitmap_ymove
, bitmap_xorig
, bitmap_yorig
;
732 if (!list
|| is_empty_list(list
)) {
734 atlas
->numBitmaps
= i
;
738 if (!is_bitmap_list(list
)) {
739 /* This list does not contain exactly one glBitmap command. Give up. */
740 atlas
->incomplete
= true;
744 /* get bitmap info from the display list command */
746 assert(n
[0].opcode
== OPCODE_BITMAP
);
747 bitmap_width
= n
[1].i
;
748 bitmap_height
= n
[2].i
;
749 bitmap_xorig
= n
[3].f
;
750 bitmap_yorig
= n
[4].f
;
751 bitmap_xmove
= n
[5].f
;
752 bitmap_ymove
= n
[6].f
;
754 if (xpos
+ bitmap_width
> atlas
->texWidth
) {
755 /* advance to the next row of the texture */
761 /* save the bitmap's position in the atlas */
765 g
->h
= bitmap_height
;
766 g
->xorig
= bitmap_xorig
;
767 g
->yorig
= bitmap_yorig
;
768 g
->xmove
= bitmap_xmove
;
769 g
->ymove
= bitmap_ymove
;
771 xpos
+= bitmap_width
;
773 /* keep track of tallest bitmap in the row */
774 row_height
= MAX2(row_height
, bitmap_height
);
777 /* Now we know the texture height */
778 atlas
->texHeight
= ypos
+ row_height
;
780 if (atlas
->texHeight
== 0) {
781 /* no glyphs found, give up */
784 else if (atlas
->texHeight
> ctx
->Const
.MaxTextureRectSize
) {
785 /* too large, give up */
789 /* Create atlas texture (texture ID is irrelevant) */
790 atlas
->texObj
= ctx
->Driver
.NewTextureObject(ctx
, 999, GL_TEXTURE_RECTANGLE
);
791 if (!atlas
->texObj
) {
795 atlas
->texObj
->Sampler
.MinFilter
= GL_NEAREST
;
796 atlas
->texObj
->Sampler
.MagFilter
= GL_NEAREST
;
797 atlas
->texObj
->MaxLevel
= 0;
798 atlas
->texObj
->Immutable
= GL_TRUE
;
800 atlas
->texImage
= _mesa_get_tex_image(ctx
, atlas
->texObj
,
801 GL_TEXTURE_RECTANGLE
, 0);
802 if (!atlas
->texImage
) {
806 _mesa_init_teximage_fields(ctx
, atlas
->texImage
,
807 atlas
->texWidth
, atlas
->texHeight
, 1, 0,
808 GL_ALPHA
, MESA_FORMAT_A_UNORM8
);
810 /* alloc image storage */
811 if (!ctx
->Driver
.AllocTextureImageBuffer(ctx
, atlas
->texImage
)) {
815 /* map teximage, load with bitmap glyphs */
816 ctx
->Driver
.MapTextureImage(ctx
, atlas
->texImage
, 0,
817 0, 0, atlas
->texWidth
, atlas
->texHeight
,
818 GL_MAP_WRITE_BIT
, &map
, &map_stride
);
823 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
824 memset(map
, 0xff, map_stride
* atlas
->texHeight
);
826 for (i
= 0; i
< atlas
->numBitmaps
; i
++) {
827 const struct gl_display_list
*list
= _mesa_lookup_list(ctx
, listBase
+ i
);
828 const Node
*n
= list
->Head
;
830 assert(n
[0].opcode
== OPCODE_BITMAP
||
831 n
[0].opcode
== OPCODE_END_OF_LIST
);
833 if (n
[0].opcode
== OPCODE_BITMAP
) {
834 unsigned bitmap_width
= n
[1].i
;
835 unsigned bitmap_height
= n
[2].i
;
836 unsigned xpos
= atlas
->glyphs
[i
].x
;
837 unsigned ypos
= atlas
->glyphs
[i
].y
;
838 const void *bitmap_image
= get_pointer(&n
[7]);
840 assert(atlas
->glyphs
[i
].w
== bitmap_width
);
841 assert(atlas
->glyphs
[i
].h
== bitmap_height
);
843 /* put the bitmap image into the texture image */
844 _mesa_expand_bitmap(bitmap_width
, bitmap_height
,
845 &ctx
->DefaultPacking
, bitmap_image
,
846 map
+ map_stride
* ypos
+ xpos
, /* dest addr */
851 ctx
->Driver
.UnmapTextureImage(ctx
, atlas
->texImage
, 0);
853 atlas
->complete
= true;
858 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Display list bitmap atlas");
861 ctx
->Driver
.DeleteTexture(ctx
, atlas
->texObj
);
864 atlas
->glyphs
= NULL
;
865 atlas
->incomplete
= true;
870 * Allocate a gl_display_list object with an initial block of storage.
871 * \param count how many display list nodes/tokens to allocate
873 static struct gl_display_list
*
874 make_list(GLuint name
, GLuint count
)
876 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
878 dlist
->Head
= malloc(sizeof(Node
) * count
);
879 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
885 * Lookup function to just encapsulate casting.
887 struct gl_display_list
*
888 _mesa_lookup_list(struct gl_context
*ctx
, GLuint list
)
890 return (struct gl_display_list
*)
891 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
895 /** Is the given opcode an extension code? */
896 static inline GLboolean
897 is_ext_opcode(OpCode opcode
)
899 return (opcode
>= OPCODE_EXT_0
);
903 /** Destroy an extended opcode instruction */
905 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
907 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
909 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
910 step
= ctx
->ListExt
->Opcode
[i
].Size
;
915 /** Execute an extended opcode instruction */
917 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
919 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
921 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
922 step
= ctx
->ListExt
->Opcode
[i
].Size
;
927 /** Print an extended opcode instruction */
929 ext_opcode_print(struct gl_context
*ctx
, Node
*node
, FILE *f
)
931 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
933 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1], f
);
934 step
= ctx
->ListExt
->Opcode
[i
].Size
;
940 * Delete the named display list, but don't remove from hash table.
941 * \param dlist - display list pointer
944 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
949 n
= block
= dlist
->Head
;
951 done
= block
? GL_FALSE
: GL_TRUE
;
953 const OpCode opcode
= n
[0].opcode
;
955 /* check for extension opcodes first */
956 if (is_ext_opcode(opcode
)) {
957 n
+= ext_opcode_destroy(ctx
, n
);
961 /* for some commands, we need to free malloc'd memory */
963 free(get_pointer(&n
[6]));
966 free(get_pointer(&n
[10]));
968 case OPCODE_CALL_LISTS
:
969 free(get_pointer(&n
[3]));
971 case OPCODE_DRAW_PIXELS
:
972 free(get_pointer(&n
[5]));
975 free(get_pointer(&n
[7]));
977 case OPCODE_POLYGON_STIPPLE
:
978 free(get_pointer(&n
[1]));
980 case OPCODE_TEX_IMAGE1D
:
981 free(get_pointer(&n
[8]));
983 case OPCODE_TEX_IMAGE2D
:
984 free(get_pointer(&n
[9]));
986 case OPCODE_TEX_IMAGE3D
:
987 free(get_pointer(&n
[10]));
989 case OPCODE_TEX_SUB_IMAGE1D
:
990 free(get_pointer(&n
[7]));
992 case OPCODE_TEX_SUB_IMAGE2D
:
993 free(get_pointer(&n
[9]));
995 case OPCODE_TEX_SUB_IMAGE3D
:
996 free(get_pointer(&n
[11]));
998 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
999 free(get_pointer(&n
[7]));
1001 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
1002 free(get_pointer(&n
[8]));
1004 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
1005 free(get_pointer(&n
[9]));
1007 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
1008 free(get_pointer(&n
[7]));
1010 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
1011 free(get_pointer(&n
[9]));
1013 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
1014 free(get_pointer(&n
[11]));
1016 case OPCODE_PROGRAM_STRING_ARB
:
1017 free(get_pointer(&n
[4])); /* program string */
1019 case OPCODE_UNIFORM_1FV
:
1020 case OPCODE_UNIFORM_2FV
:
1021 case OPCODE_UNIFORM_3FV
:
1022 case OPCODE_UNIFORM_4FV
:
1023 case OPCODE_UNIFORM_1IV
:
1024 case OPCODE_UNIFORM_2IV
:
1025 case OPCODE_UNIFORM_3IV
:
1026 case OPCODE_UNIFORM_4IV
:
1027 case OPCODE_UNIFORM_1UIV
:
1028 case OPCODE_UNIFORM_2UIV
:
1029 case OPCODE_UNIFORM_3UIV
:
1030 case OPCODE_UNIFORM_4UIV
:
1031 free(get_pointer(&n
[3]));
1033 case OPCODE_UNIFORM_MATRIX22
:
1034 case OPCODE_UNIFORM_MATRIX33
:
1035 case OPCODE_UNIFORM_MATRIX44
:
1036 case OPCODE_UNIFORM_MATRIX24
:
1037 case OPCODE_UNIFORM_MATRIX42
:
1038 case OPCODE_UNIFORM_MATRIX23
:
1039 case OPCODE_UNIFORM_MATRIX32
:
1040 case OPCODE_UNIFORM_MATRIX34
:
1041 case OPCODE_UNIFORM_MATRIX43
:
1042 free(get_pointer(&n
[4]));
1044 case OPCODE_PROGRAM_UNIFORM_1FV
:
1045 case OPCODE_PROGRAM_UNIFORM_2FV
:
1046 case OPCODE_PROGRAM_UNIFORM_3FV
:
1047 case OPCODE_PROGRAM_UNIFORM_4FV
:
1048 case OPCODE_PROGRAM_UNIFORM_1IV
:
1049 case OPCODE_PROGRAM_UNIFORM_2IV
:
1050 case OPCODE_PROGRAM_UNIFORM_3IV
:
1051 case OPCODE_PROGRAM_UNIFORM_4IV
:
1052 case OPCODE_PROGRAM_UNIFORM_1UIV
:
1053 case OPCODE_PROGRAM_UNIFORM_2UIV
:
1054 case OPCODE_PROGRAM_UNIFORM_3UIV
:
1055 case OPCODE_PROGRAM_UNIFORM_4UIV
:
1056 free(get_pointer(&n
[4]));
1058 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
1059 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
1060 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
1061 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
1062 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
1063 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
1064 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
1065 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
1066 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
1067 free(get_pointer(&n
[5]));
1069 case OPCODE_PIXEL_MAP
:
1070 free(get_pointer(&n
[3]));
1072 case OPCODE_WINDOW_RECTANGLES
:
1073 free(get_pointer(&n
[3]));
1075 case OPCODE_CONTINUE
:
1076 n
= (Node
*) get_pointer(&n
[1]);
1080 case OPCODE_END_OF_LIST
:
1085 /* just increment 'n' pointer, below */
1089 if (opcode
!= OPCODE_CONTINUE
) {
1090 assert(InstSize
[opcode
] > 0);
1091 n
+= InstSize
[opcode
];
1102 * Called by _mesa_HashWalk() to check if a display list which is being
1103 * deleted belongs to a bitmap texture atlas.
1106 check_atlas_for_deleted_list(GLuint atlas_id
, void *data
, void *userData
)
1108 struct gl_bitmap_atlas
*atlas
= (struct gl_bitmap_atlas
*) data
;
1109 GLuint list_id
= *((GLuint
*) userData
); /* the list being deleted */
1111 /* See if the list_id falls in the range contained in this texture atlas */
1112 if (atlas
->complete
&&
1113 list_id
>= atlas_id
&&
1114 list_id
< atlas_id
+ atlas
->numBitmaps
) {
1115 /* Mark the atlas as incomplete so it doesn't get used. But don't
1116 * delete it yet since we don't want to try to recreate it in the next
1119 atlas
->complete
= false;
1120 atlas
->incomplete
= true;
1126 * Destroy a display list and remove from hash table.
1127 * \param list - display list number
1130 destroy_list(struct gl_context
*ctx
, GLuint list
)
1132 struct gl_display_list
*dlist
;
1137 dlist
= _mesa_lookup_list(ctx
, list
);
1141 if (is_bitmap_list(dlist
)) {
1142 /* If we're destroying a simple glBitmap display list, there's a
1143 * chance that we're destroying a bitmap image that's in a texture
1144 * atlas. Examine all atlases to see if that's the case. There's
1145 * usually few (if any) atlases so this isn't expensive.
1147 _mesa_HashWalk(ctx
->Shared
->BitmapAtlas
,
1148 check_atlas_for_deleted_list
, &list
);
1151 _mesa_delete_list(ctx
, dlist
);
1152 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
1157 * Translate the nth element of list from <type> to GLint.
1160 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
1172 bptr
= (GLbyte
*) list
;
1173 return (GLint
) bptr
[n
];
1174 case GL_UNSIGNED_BYTE
:
1175 ubptr
= (GLubyte
*) list
;
1176 return (GLint
) ubptr
[n
];
1178 sptr
= (GLshort
*) list
;
1179 return (GLint
) sptr
[n
];
1180 case GL_UNSIGNED_SHORT
:
1181 usptr
= (GLushort
*) list
;
1182 return (GLint
) usptr
[n
];
1184 iptr
= (GLint
*) list
;
1186 case GL_UNSIGNED_INT
:
1187 uiptr
= (GLuint
*) list
;
1188 return (GLint
) uiptr
[n
];
1190 fptr
= (GLfloat
*) list
;
1191 return (GLint
) floorf(fptr
[n
]);
1193 ubptr
= ((GLubyte
*) list
) + 2 * n
;
1194 return (GLint
) ubptr
[0] * 256
1197 ubptr
= ((GLubyte
*) list
) + 3 * n
;
1198 return (GLint
) ubptr
[0] * 65536
1199 + (GLint
) ubptr
[1] * 256
1202 ubptr
= ((GLubyte
*) list
) + 4 * n
;
1203 return (GLint
) ubptr
[0] * 16777216
1204 + (GLint
) ubptr
[1] * 65536
1205 + (GLint
) ubptr
[2] * 256
1214 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1215 * If width < 0 or height < 0 or format or type are invalid we'll just
1216 * return NULL. We will not generate an error since OpenGL command
1217 * arguments aren't error-checked until the command is actually executed
1218 * (not when they're compiled).
1219 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1222 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
1223 GLsizei width
, GLsizei height
, GLsizei depth
,
1224 GLenum format
, GLenum type
, const GLvoid
* pixels
,
1225 const struct gl_pixelstore_attrib
*unpack
)
1227 if (width
<= 0 || height
<= 0) {
1231 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
1232 /* bad format and/or type */
1236 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
1240 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
1241 format
, type
, pixels
, unpack
);
1242 if (pixels
&& !image
) {
1243 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1247 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
1248 depth
, format
, type
, INT_MAX
, pixels
)) {
1249 const GLubyte
*map
, *src
;
1253 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
1254 GL_MAP_READ_BIT
, unpack
->BufferObj
,
1257 /* unable to map src buffer! */
1258 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
1262 src
= ADD_POINTERS(map
, pixels
);
1263 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
1264 format
, type
, src
, unpack
);
1266 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
, MAP_INTERNAL
);
1269 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1275 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
1280 /** Return copy of memory */
1282 memdup(const void *src
, GLsizei bytes
)
1284 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
1286 memcpy(b
, src
, bytes
);
1292 * Allocate space for a display list instruction (opcode + payload space).
1293 * \param opcode the instruction opcode (OPCODE_* value)
1294 * \param bytes instruction payload size (not counting opcode)
1295 * \param align8 does the payload need to be 8-byte aligned?
1296 * This is only relevant in 64-bit environments.
1297 * \return pointer to allocated memory (the payload will be at pointer+1)
1300 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
, bool align8
)
1302 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
1303 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
1307 assert(bytes
<= BLOCK_SIZE
* sizeof(Node
));
1309 if (opcode
< OPCODE_EXT_0
) {
1310 if (InstSize
[opcode
] == 0) {
1311 /* save instruction size now */
1312 InstSize
[opcode
] = numNodes
;
1315 /* make sure instruction size agrees */
1316 assert(numNodes
== InstSize
[opcode
]);
1320 if (sizeof(void *) > sizeof(Node
) && align8
1321 && ctx
->ListState
.CurrentPos
% 2 == 0) {
1322 /* The opcode would get placed at node[0] and the payload would start
1323 * at node[1]. But the payload needs to be at an even offset (8-byte
1332 if (ctx
->ListState
.CurrentPos
+ nopNode
+ numNodes
+ contNodes
1334 /* This block is full. Allocate a new block and chain to it */
1336 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1337 n
[0].opcode
= OPCODE_CONTINUE
;
1338 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
1340 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
1344 /* a fresh block should be 8-byte aligned on 64-bit systems */
1345 assert(((GLintptr
) newblock
) % sizeof(void *) == 0);
1347 save_pointer(&n
[1], newblock
);
1348 ctx
->ListState
.CurrentBlock
= newblock
;
1349 ctx
->ListState
.CurrentPos
= 0;
1351 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1352 * we have to insert a NOP so that the payload of the real opcode lands
1353 * on an even location:
1354 * node[0] = OPCODE_NOP
1355 * node[1] = OPCODE_x;
1356 * node[2] = start of payload
1358 nopNode
= sizeof(void *) > sizeof(Node
) && align8
;
1361 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1363 assert(ctx
->ListState
.CurrentPos
% 2 == 0); /* even value */
1364 n
[0].opcode
= OPCODE_NOP
;
1366 /* The "real" opcode will now be at an odd location and the payload
1367 * will be at an even location.
1370 ctx
->ListState
.CurrentPos
+= nopNode
+ numNodes
;
1372 n
[0].opcode
= opcode
;
1380 * Allocate space for a display list instruction. Used by callers outside
1381 * this file for things like VBO vertex data.
1383 * \param opcode the instruction opcode (OPCODE_* value)
1384 * \param bytes instruction size in bytes, not counting opcode.
1385 * \return pointer to the usable data area (not including the internal
1389 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1391 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, false);
1393 return n
+ 1; /* return pointer to payload area, after opcode */
1400 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1401 * aligned in 64-bit environments, 4-byte aligned otherwise.
1404 _mesa_dlist_alloc_aligned(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1406 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, true);
1408 return n
+ 1; /* return pointer to payload area, after opcode */
1415 * This function allows modules and drivers to get their own opcodes
1416 * for extending display list functionality.
1417 * \param ctx the rendering context
1418 * \param size number of bytes for storing the new display list command
1419 * \param execute function to execute the new display list command
1420 * \param destroy function to destroy the new display list command
1421 * \param print function to print the new display list command
1422 * \return the new opcode number or -1 if error
1425 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1427 void (*execute
) (struct gl_context
*, void *),
1428 void (*destroy
) (struct gl_context
*, void *),
1429 void (*print
) (struct gl_context
*, void *, FILE *))
1431 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1432 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1433 ctx
->ListExt
->Opcode
[i
].Size
=
1434 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1435 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1436 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1437 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1438 return i
+ OPCODE_EXT_0
;
1445 * Allocate space for a display list instruction. The space is basically
1446 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1447 * function parameter, node[2] is the second parameter, etc.
1449 * \param opcode one of OPCODE_x
1450 * \param nparams number of function parameters
1451 * \return pointer to start of instruction space
1453 static inline Node
*
1454 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1456 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
), false);
1461 * Called by EndList to try to reduce memory used for the list.
1464 trim_list(struct gl_context
*ctx
)
1466 /* If the list we're ending only has one allocated block of nodes/tokens
1467 * and its size isn't a full block size, realloc the block to use less
1468 * memory. This is important for apps that create many small display
1469 * lists and apps that use glXUseXFont (many lists each containing one
1471 * Note: we currently only trim display lists that allocated one block
1472 * of tokens. That hits the short list case which is what we're mainly
1473 * concerned with. Trimming longer lists would involve traversing the
1474 * linked list of blocks.
1476 struct gl_dlist_state
*list
= &ctx
->ListState
;
1478 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1479 (list
->CurrentPos
< BLOCK_SIZE
)) {
1480 /* There's only one block and it's not full, so realloc */
1481 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1482 list
->CurrentList
->Head
=
1483 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1484 if (!list
->CurrentBlock
) {
1485 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1493 * Display List compilation functions
1495 static void GLAPIENTRY
1496 save_Accum(GLenum op
, GLfloat value
)
1498 GET_CURRENT_CONTEXT(ctx
);
1500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1501 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1506 if (ctx
->ExecuteFlag
) {
1507 CALL_Accum(ctx
->Exec
, (op
, value
));
1512 static void GLAPIENTRY
1513 save_AlphaFunc(GLenum func
, GLclampf ref
)
1515 GET_CURRENT_CONTEXT(ctx
);
1517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1518 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1521 n
[2].f
= (GLfloat
) ref
;
1523 if (ctx
->ExecuteFlag
) {
1524 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1529 static void GLAPIENTRY
1530 save_BindTexture(GLenum target
, GLuint texture
)
1532 GET_CURRENT_CONTEXT(ctx
);
1534 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1535 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1540 if (ctx
->ExecuteFlag
) {
1541 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1546 static void GLAPIENTRY
1547 save_Bitmap(GLsizei width
, GLsizei height
,
1548 GLfloat xorig
, GLfloat yorig
,
1549 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1551 GET_CURRENT_CONTEXT(ctx
);
1553 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1554 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1556 n
[1].i
= (GLint
) width
;
1557 n
[2].i
= (GLint
) height
;
1563 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1564 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1566 if (ctx
->ExecuteFlag
) {
1567 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1568 xorig
, yorig
, xmove
, ymove
, pixels
));
1573 static void GLAPIENTRY
1574 save_BlendEquation(GLenum mode
)
1576 GET_CURRENT_CONTEXT(ctx
);
1578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1579 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1583 if (ctx
->ExecuteFlag
) {
1584 CALL_BlendEquation(ctx
->Exec
, (mode
));
1589 static void GLAPIENTRY
1590 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1592 GET_CURRENT_CONTEXT(ctx
);
1594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1595 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1600 if (ctx
->ExecuteFlag
) {
1601 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1606 static void GLAPIENTRY
1607 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1608 GLenum sfactorA
, GLenum dfactorA
)
1610 GET_CURRENT_CONTEXT(ctx
);
1612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1613 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1615 n
[1].e
= sfactorRGB
;
1616 n
[2].e
= dfactorRGB
;
1620 if (ctx
->ExecuteFlag
) {
1621 CALL_BlendFuncSeparate(ctx
->Exec
,
1622 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1627 static void GLAPIENTRY
1628 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1630 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1634 static void GLAPIENTRY
1635 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1637 GET_CURRENT_CONTEXT(ctx
);
1639 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1640 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1647 if (ctx
->ExecuteFlag
) {
1648 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1652 /* GL_ARB_draw_buffers_blend */
1653 static void GLAPIENTRY
1654 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1655 GLenum sfactorA
, GLenum dfactorA
)
1657 GET_CURRENT_CONTEXT(ctx
);
1659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1660 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1663 n
[2].e
= sfactorRGB
;
1664 n
[3].e
= dfactorRGB
;
1668 if (ctx
->ExecuteFlag
) {
1669 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1670 sfactorA
, dfactorA
));
1674 /* GL_ARB_draw_buffers_blend */
1675 static void GLAPIENTRY
1676 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1678 GET_CURRENT_CONTEXT(ctx
);
1680 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1681 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_I
, 3);
1687 if (ctx
->ExecuteFlag
) {
1688 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1692 /* GL_ARB_draw_buffers_blend */
1693 static void GLAPIENTRY
1694 save_BlendEquationi(GLuint buf
, GLenum mode
)
1696 GET_CURRENT_CONTEXT(ctx
);
1698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1699 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1704 if (ctx
->ExecuteFlag
) {
1705 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1709 /* GL_ARB_draw_buffers_blend */
1710 static void GLAPIENTRY
1711 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1713 GET_CURRENT_CONTEXT(ctx
);
1715 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1716 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1722 if (ctx
->ExecuteFlag
) {
1723 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1728 /* GL_ARB_draw_instanced. */
1729 static void GLAPIENTRY
1730 save_DrawArraysInstancedARB(UNUSED GLenum mode
,
1732 UNUSED GLsizei count
,
1733 UNUSED GLsizei primcount
)
1735 GET_CURRENT_CONTEXT(ctx
);
1736 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1737 "glDrawArraysInstanced() during display list compile");
1740 static void GLAPIENTRY
1741 save_DrawElementsInstancedARB(UNUSED GLenum mode
,
1742 UNUSED GLsizei count
,
1744 UNUSED
const GLvoid
*indices
,
1745 UNUSED GLsizei primcount
)
1747 GET_CURRENT_CONTEXT(ctx
);
1748 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1749 "glDrawElementsInstanced() during display list compile");
1752 static void GLAPIENTRY
1753 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode
,
1754 UNUSED GLsizei count
,
1756 UNUSED
const GLvoid
*indices
,
1757 UNUSED GLsizei primcount
,
1758 UNUSED GLint basevertex
)
1760 GET_CURRENT_CONTEXT(ctx
);
1761 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1762 "glDrawElementsInstancedBaseVertex() during display list compile");
1765 /* GL_ARB_base_instance. */
1766 static void GLAPIENTRY
1767 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode
,
1769 UNUSED GLsizei count
,
1770 UNUSED GLsizei primcount
,
1771 UNUSED GLuint baseinstance
)
1773 GET_CURRENT_CONTEXT(ctx
);
1774 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1775 "glDrawArraysInstancedBaseInstance() during display list compile");
1778 static void APIENTRY
1779 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode
,
1780 UNUSED GLsizei count
,
1782 UNUSED
const void *indices
,
1783 UNUSED GLsizei primcount
,
1784 UNUSED GLuint baseinstance
)
1786 GET_CURRENT_CONTEXT(ctx
);
1787 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1788 "glDrawElementsInstancedBaseInstance() during display list compile");
1791 static void APIENTRY
1792 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode
,
1793 UNUSED GLsizei count
,
1795 UNUSED
const void *indices
,
1796 UNUSED GLsizei primcount
,
1797 UNUSED GLint basevertex
,
1798 UNUSED GLuint baseinstance
)
1800 GET_CURRENT_CONTEXT(ctx
);
1801 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1802 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1807 * While building a display list we cache some OpenGL state.
1808 * Under some circumstances we need to invalidate that state (immediately
1809 * when we start compiling a list, or after glCallList(s)).
1812 invalidate_saved_current_state(struct gl_context
*ctx
)
1816 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1817 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1819 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1820 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1822 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1824 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1828 static void GLAPIENTRY
1829 save_CallList(GLuint list
)
1831 GET_CURRENT_CONTEXT(ctx
);
1833 SAVE_FLUSH_VERTICES(ctx
);
1835 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1840 /* After this, we don't know what state we're in. Invalidate all
1841 * cached information previously gathered:
1843 invalidate_saved_current_state( ctx
);
1845 if (ctx
->ExecuteFlag
) {
1846 _mesa_CallList(list
);
1851 static void GLAPIENTRY
1852 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1854 GET_CURRENT_CONTEXT(ctx
);
1859 SAVE_FLUSH_VERTICES(ctx
);
1863 case GL_UNSIGNED_BYTE
:
1867 case GL_UNSIGNED_SHORT
:
1875 case GL_UNSIGNED_INT
:
1884 if (num
> 0 && type_size
> 0) {
1885 /* create a copy of the array of list IDs to save in the display list */
1886 lists_copy
= memdup(lists
, num
* type_size
);
1891 n
= alloc_instruction(ctx
, OPCODE_CALL_LISTS
, 2 + POINTER_DWORDS
);
1895 save_pointer(&n
[3], lists_copy
);
1898 /* After this, we don't know what state we're in. Invalidate all
1899 * cached information previously gathered:
1901 invalidate_saved_current_state( ctx
);
1903 if (ctx
->ExecuteFlag
) {
1904 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1909 static void GLAPIENTRY
1910 save_Clear(GLbitfield mask
)
1912 GET_CURRENT_CONTEXT(ctx
);
1914 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1915 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1919 if (ctx
->ExecuteFlag
) {
1920 CALL_Clear(ctx
->Exec
, (mask
));
1925 static void GLAPIENTRY
1926 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1928 GET_CURRENT_CONTEXT(ctx
);
1930 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1931 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1934 n
[2].i
= drawbuffer
;
1936 if (buffer
== GL_COLOR
) {
1947 if (ctx
->ExecuteFlag
) {
1948 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1953 static void GLAPIENTRY
1954 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1956 GET_CURRENT_CONTEXT(ctx
);
1958 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1959 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1962 n
[2].i
= drawbuffer
;
1964 if (buffer
== GL_COLOR
) {
1975 if (ctx
->ExecuteFlag
) {
1976 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1981 static void GLAPIENTRY
1982 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1984 GET_CURRENT_CONTEXT(ctx
);
1986 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1987 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1990 n
[2].i
= drawbuffer
;
1992 if (buffer
== GL_COLOR
) {
2003 if (ctx
->ExecuteFlag
) {
2004 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
2009 static void GLAPIENTRY
2010 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
2011 GLfloat depth
, GLint stencil
)
2013 GET_CURRENT_CONTEXT(ctx
);
2015 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2016 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
2019 n
[2].i
= drawbuffer
;
2023 if (ctx
->ExecuteFlag
) {
2024 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
2029 static void GLAPIENTRY
2030 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
2032 GET_CURRENT_CONTEXT(ctx
);
2034 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2035 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
2042 if (ctx
->ExecuteFlag
) {
2043 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
2048 static void GLAPIENTRY
2049 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
2051 GET_CURRENT_CONTEXT(ctx
);
2053 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2054 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
2061 if (ctx
->ExecuteFlag
) {
2062 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
2067 static void GLAPIENTRY
2068 save_ClearDepth(GLclampd depth
)
2070 GET_CURRENT_CONTEXT(ctx
);
2072 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2073 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
2075 n
[1].f
= (GLfloat
) depth
;
2077 if (ctx
->ExecuteFlag
) {
2078 CALL_ClearDepth(ctx
->Exec
, (depth
));
2083 static void GLAPIENTRY
2084 save_ClearIndex(GLfloat c
)
2086 GET_CURRENT_CONTEXT(ctx
);
2088 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2089 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
2093 if (ctx
->ExecuteFlag
) {
2094 CALL_ClearIndex(ctx
->Exec
, (c
));
2099 static void GLAPIENTRY
2100 save_ClearStencil(GLint s
)
2102 GET_CURRENT_CONTEXT(ctx
);
2104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2105 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
2109 if (ctx
->ExecuteFlag
) {
2110 CALL_ClearStencil(ctx
->Exec
, (s
));
2115 static void GLAPIENTRY
2116 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
2118 GET_CURRENT_CONTEXT(ctx
);
2120 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2121 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
2124 n
[2].f
= (GLfloat
) equ
[0];
2125 n
[3].f
= (GLfloat
) equ
[1];
2126 n
[4].f
= (GLfloat
) equ
[2];
2127 n
[5].f
= (GLfloat
) equ
[3];
2129 if (ctx
->ExecuteFlag
) {
2130 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
2136 static void GLAPIENTRY
2137 save_ColorMask(GLboolean red
, GLboolean green
,
2138 GLboolean blue
, GLboolean alpha
)
2140 GET_CURRENT_CONTEXT(ctx
);
2142 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2143 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
2150 if (ctx
->ExecuteFlag
) {
2151 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
2156 static void GLAPIENTRY
2157 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
2158 GLboolean blue
, GLboolean alpha
)
2160 GET_CURRENT_CONTEXT(ctx
);
2162 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2163 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
2171 if (ctx
->ExecuteFlag
) {
2172 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2177 static void GLAPIENTRY
2178 save_ColorMaterial(GLenum face
, GLenum mode
)
2180 GET_CURRENT_CONTEXT(ctx
);
2182 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2184 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
2189 if (ctx
->ExecuteFlag
) {
2190 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
2195 static void GLAPIENTRY
2196 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
2198 GET_CURRENT_CONTEXT(ctx
);
2200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2201 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
2205 n
[3].i
= (GLint
) width
;
2206 n
[4].i
= (GLint
) height
;
2209 if (ctx
->ExecuteFlag
) {
2210 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
2216 static void GLAPIENTRY
2217 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
2218 GLint x
, GLint y
, GLsizei width
, GLint border
)
2220 GET_CURRENT_CONTEXT(ctx
);
2222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2223 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
2227 n
[3].e
= internalformat
;
2233 if (ctx
->ExecuteFlag
) {
2234 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
2235 x
, y
, width
, border
));
2240 static void GLAPIENTRY
2241 save_CopyTexImage2D(GLenum target
, GLint level
,
2242 GLenum internalformat
,
2243 GLint x
, GLint y
, GLsizei width
,
2244 GLsizei height
, GLint border
)
2246 GET_CURRENT_CONTEXT(ctx
);
2248 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2249 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
2253 n
[3].e
= internalformat
;
2260 if (ctx
->ExecuteFlag
) {
2261 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
2262 x
, y
, width
, height
, border
));
2268 static void GLAPIENTRY
2269 save_CopyTexSubImage1D(GLenum target
, GLint level
,
2270 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
2272 GET_CURRENT_CONTEXT(ctx
);
2274 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2275 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
2284 if (ctx
->ExecuteFlag
) {
2285 CALL_CopyTexSubImage1D(ctx
->Exec
,
2286 (target
, level
, xoffset
, x
, y
, width
));
2291 static void GLAPIENTRY
2292 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2293 GLint xoffset
, GLint yoffset
,
2294 GLint x
, GLint y
, GLsizei width
, GLint height
)
2296 GET_CURRENT_CONTEXT(ctx
);
2298 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2299 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2310 if (ctx
->ExecuteFlag
) {
2311 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2312 x
, y
, width
, height
));
2317 static void GLAPIENTRY
2318 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2319 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2320 GLint x
, GLint y
, GLsizei width
, GLint height
)
2322 GET_CURRENT_CONTEXT(ctx
);
2324 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2325 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2337 if (ctx
->ExecuteFlag
) {
2338 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2339 xoffset
, yoffset
, zoffset
,
2340 x
, y
, width
, height
));
2345 static void GLAPIENTRY
2346 save_CullFace(GLenum mode
)
2348 GET_CURRENT_CONTEXT(ctx
);
2350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2351 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2355 if (ctx
->ExecuteFlag
) {
2356 CALL_CullFace(ctx
->Exec
, (mode
));
2361 static void GLAPIENTRY
2362 save_DepthFunc(GLenum func
)
2364 GET_CURRENT_CONTEXT(ctx
);
2366 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2367 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2371 if (ctx
->ExecuteFlag
) {
2372 CALL_DepthFunc(ctx
->Exec
, (func
));
2377 static void GLAPIENTRY
2378 save_DepthMask(GLboolean mask
)
2380 GET_CURRENT_CONTEXT(ctx
);
2382 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2383 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2387 if (ctx
->ExecuteFlag
) {
2388 CALL_DepthMask(ctx
->Exec
, (mask
));
2393 static void GLAPIENTRY
2394 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2396 GET_CURRENT_CONTEXT(ctx
);
2398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2399 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2401 n
[1].f
= (GLfloat
) nearval
;
2402 n
[2].f
= (GLfloat
) farval
;
2404 if (ctx
->ExecuteFlag
) {
2405 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2410 static void GLAPIENTRY
2411 save_Disable(GLenum cap
)
2413 GET_CURRENT_CONTEXT(ctx
);
2415 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2416 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2420 if (ctx
->ExecuteFlag
) {
2421 CALL_Disable(ctx
->Exec
, (cap
));
2426 static void GLAPIENTRY
2427 save_DisableIndexed(GLuint index
, GLenum cap
)
2429 GET_CURRENT_CONTEXT(ctx
);
2431 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2432 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2437 if (ctx
->ExecuteFlag
) {
2438 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2443 static void GLAPIENTRY
2444 save_DrawBuffer(GLenum mode
)
2446 GET_CURRENT_CONTEXT(ctx
);
2448 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2449 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2453 if (ctx
->ExecuteFlag
) {
2454 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2459 static void GLAPIENTRY
2460 save_DrawPixels(GLsizei width
, GLsizei height
,
2461 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2463 GET_CURRENT_CONTEXT(ctx
);
2466 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2468 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2475 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2476 pixels
, &ctx
->Unpack
));
2478 if (ctx
->ExecuteFlag
) {
2479 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2485 static void GLAPIENTRY
2486 save_Enable(GLenum cap
)
2488 GET_CURRENT_CONTEXT(ctx
);
2490 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2491 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2495 if (ctx
->ExecuteFlag
) {
2496 CALL_Enable(ctx
->Exec
, (cap
));
2502 static void GLAPIENTRY
2503 save_EnableIndexed(GLuint index
, GLenum cap
)
2505 GET_CURRENT_CONTEXT(ctx
);
2507 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2508 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2513 if (ctx
->ExecuteFlag
) {
2514 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2520 static void GLAPIENTRY
2521 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2523 GET_CURRENT_CONTEXT(ctx
);
2525 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2526 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2532 if (ctx
->ExecuteFlag
) {
2533 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2538 static void GLAPIENTRY
2539 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2541 GET_CURRENT_CONTEXT(ctx
);
2543 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2544 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2552 if (ctx
->ExecuteFlag
) {
2553 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2560 static void GLAPIENTRY
2561 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2563 GET_CURRENT_CONTEXT(ctx
);
2565 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2566 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2574 if (ctx
->ExecuteFlag
) {
2575 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2580 static void GLAPIENTRY
2581 save_Fogf(GLenum pname
, GLfloat param
)
2585 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2586 save_Fogfv(pname
, parray
);
2590 static void GLAPIENTRY
2591 save_Fogiv(GLenum pname
, const GLint
*params
)
2596 case GL_FOG_DENSITY
:
2600 p
[0] = (GLfloat
) *params
;
2606 p
[0] = INT_TO_FLOAT(params
[0]);
2607 p
[1] = INT_TO_FLOAT(params
[1]);
2608 p
[2] = INT_TO_FLOAT(params
[2]);
2609 p
[3] = INT_TO_FLOAT(params
[3]);
2612 /* Error will be caught later in gl_Fogfv */
2613 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2615 save_Fogfv(pname
, p
);
2619 static void GLAPIENTRY
2620 save_Fogi(GLenum pname
, GLint param
)
2624 parray
[1] = parray
[2] = parray
[3] = 0;
2625 save_Fogiv(pname
, parray
);
2629 static void GLAPIENTRY
2630 save_FrontFace(GLenum mode
)
2632 GET_CURRENT_CONTEXT(ctx
);
2634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2635 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2639 if (ctx
->ExecuteFlag
) {
2640 CALL_FrontFace(ctx
->Exec
, (mode
));
2645 static void GLAPIENTRY
2646 save_Frustum(GLdouble left
, GLdouble right
,
2647 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2649 GET_CURRENT_CONTEXT(ctx
);
2651 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2652 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2654 n
[1].f
= (GLfloat
) left
;
2655 n
[2].f
= (GLfloat
) right
;
2656 n
[3].f
= (GLfloat
) bottom
;
2657 n
[4].f
= (GLfloat
) top
;
2658 n
[5].f
= (GLfloat
) nearval
;
2659 n
[6].f
= (GLfloat
) farval
;
2661 if (ctx
->ExecuteFlag
) {
2662 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2667 static void GLAPIENTRY
2668 save_Hint(GLenum target
, GLenum mode
)
2670 GET_CURRENT_CONTEXT(ctx
);
2672 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2673 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2678 if (ctx
->ExecuteFlag
) {
2679 CALL_Hint(ctx
->Exec
, (target
, mode
));
2684 static void GLAPIENTRY
2685 save_IndexMask(GLuint mask
)
2687 GET_CURRENT_CONTEXT(ctx
);
2689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2690 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2694 if (ctx
->ExecuteFlag
) {
2695 CALL_IndexMask(ctx
->Exec
, (mask
));
2700 static void GLAPIENTRY
2701 save_InitNames(void)
2703 GET_CURRENT_CONTEXT(ctx
);
2704 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2705 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2706 if (ctx
->ExecuteFlag
) {
2707 CALL_InitNames(ctx
->Exec
, ());
2712 static void GLAPIENTRY
2713 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2715 GET_CURRENT_CONTEXT(ctx
);
2717 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2718 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2736 case GL_SPOT_DIRECTION
:
2739 case GL_SPOT_EXPONENT
:
2742 case GL_SPOT_CUTOFF
:
2745 case GL_CONSTANT_ATTENUATION
:
2748 case GL_LINEAR_ATTENUATION
:
2751 case GL_QUADRATIC_ATTENUATION
:
2757 for (i
= 0; i
< nParams
; i
++) {
2758 n
[3 + i
].f
= params
[i
];
2761 if (ctx
->ExecuteFlag
) {
2762 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2767 static void GLAPIENTRY
2768 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2772 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2773 save_Lightfv(light
, pname
, parray
);
2777 static void GLAPIENTRY
2778 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2785 fparam
[0] = INT_TO_FLOAT(params
[0]);
2786 fparam
[1] = INT_TO_FLOAT(params
[1]);
2787 fparam
[2] = INT_TO_FLOAT(params
[2]);
2788 fparam
[3] = INT_TO_FLOAT(params
[3]);
2791 fparam
[0] = (GLfloat
) params
[0];
2792 fparam
[1] = (GLfloat
) params
[1];
2793 fparam
[2] = (GLfloat
) params
[2];
2794 fparam
[3] = (GLfloat
) params
[3];
2796 case GL_SPOT_DIRECTION
:
2797 fparam
[0] = (GLfloat
) params
[0];
2798 fparam
[1] = (GLfloat
) params
[1];
2799 fparam
[2] = (GLfloat
) params
[2];
2801 case GL_SPOT_EXPONENT
:
2802 case GL_SPOT_CUTOFF
:
2803 case GL_CONSTANT_ATTENUATION
:
2804 case GL_LINEAR_ATTENUATION
:
2805 case GL_QUADRATIC_ATTENUATION
:
2806 fparam
[0] = (GLfloat
) params
[0];
2809 /* error will be caught later in gl_Lightfv */
2812 save_Lightfv(light
, pname
, fparam
);
2816 static void GLAPIENTRY
2817 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2821 parray
[1] = parray
[2] = parray
[3] = 0;
2822 save_Lightiv(light
, pname
, parray
);
2826 static void GLAPIENTRY
2827 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2829 GET_CURRENT_CONTEXT(ctx
);
2831 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2832 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2840 if (ctx
->ExecuteFlag
) {
2841 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2846 static void GLAPIENTRY
2847 save_LightModelf(GLenum pname
, GLfloat param
)
2851 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2852 save_LightModelfv(pname
, parray
);
2856 static void GLAPIENTRY
2857 save_LightModeliv(GLenum pname
, const GLint
*params
)
2861 case GL_LIGHT_MODEL_AMBIENT
:
2862 fparam
[0] = INT_TO_FLOAT(params
[0]);
2863 fparam
[1] = INT_TO_FLOAT(params
[1]);
2864 fparam
[2] = INT_TO_FLOAT(params
[2]);
2865 fparam
[3] = INT_TO_FLOAT(params
[3]);
2867 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2868 case GL_LIGHT_MODEL_TWO_SIDE
:
2869 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2870 fparam
[0] = (GLfloat
) params
[0];
2876 /* Error will be caught later in gl_LightModelfv */
2877 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2879 save_LightModelfv(pname
, fparam
);
2883 static void GLAPIENTRY
2884 save_LightModeli(GLenum pname
, GLint param
)
2888 parray
[1] = parray
[2] = parray
[3] = 0;
2889 save_LightModeliv(pname
, parray
);
2893 static void GLAPIENTRY
2894 save_LineStipple(GLint factor
, GLushort pattern
)
2896 GET_CURRENT_CONTEXT(ctx
);
2898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2899 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2904 if (ctx
->ExecuteFlag
) {
2905 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2910 static void GLAPIENTRY
2911 save_LineWidth(GLfloat width
)
2913 GET_CURRENT_CONTEXT(ctx
);
2915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2916 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2920 if (ctx
->ExecuteFlag
) {
2921 CALL_LineWidth(ctx
->Exec
, (width
));
2926 static void GLAPIENTRY
2927 save_ListBase(GLuint base
)
2929 GET_CURRENT_CONTEXT(ctx
);
2931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2932 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2936 if (ctx
->ExecuteFlag
) {
2937 CALL_ListBase(ctx
->Exec
, (base
));
2942 static void GLAPIENTRY
2943 save_LoadIdentity(void)
2945 GET_CURRENT_CONTEXT(ctx
);
2946 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2947 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2948 if (ctx
->ExecuteFlag
) {
2949 CALL_LoadIdentity(ctx
->Exec
, ());
2954 static void GLAPIENTRY
2955 save_LoadMatrixf(const GLfloat
* m
)
2957 GET_CURRENT_CONTEXT(ctx
);
2959 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2960 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2963 for (i
= 0; i
< 16; i
++) {
2967 if (ctx
->ExecuteFlag
) {
2968 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2973 static void GLAPIENTRY
2974 save_LoadMatrixd(const GLdouble
* m
)
2978 for (i
= 0; i
< 16; i
++) {
2979 f
[i
] = (GLfloat
) m
[i
];
2981 save_LoadMatrixf(f
);
2985 static void GLAPIENTRY
2986 save_LoadName(GLuint name
)
2988 GET_CURRENT_CONTEXT(ctx
);
2990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2991 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2995 if (ctx
->ExecuteFlag
) {
2996 CALL_LoadName(ctx
->Exec
, (name
));
3001 static void GLAPIENTRY
3002 save_LogicOp(GLenum opcode
)
3004 GET_CURRENT_CONTEXT(ctx
);
3006 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3007 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
3011 if (ctx
->ExecuteFlag
) {
3012 CALL_LogicOp(ctx
->Exec
, (opcode
));
3017 static void GLAPIENTRY
3018 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
3019 GLint order
, const GLdouble
* points
)
3021 GET_CURRENT_CONTEXT(ctx
);
3023 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3024 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
3026 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
3028 n
[2].f
= (GLfloat
) u1
;
3029 n
[3].f
= (GLfloat
) u2
;
3030 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
3032 save_pointer(&n
[6], pnts
);
3034 if (ctx
->ExecuteFlag
) {
3035 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
3039 static void GLAPIENTRY
3040 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
3041 GLint order
, const GLfloat
* points
)
3043 GET_CURRENT_CONTEXT(ctx
);
3045 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3046 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
3048 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
3052 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
3054 save_pointer(&n
[6], pnts
);
3056 if (ctx
->ExecuteFlag
) {
3057 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
3062 static void GLAPIENTRY
3063 save_Map2d(GLenum target
,
3064 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
3065 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
3066 const GLdouble
* points
)
3068 GET_CURRENT_CONTEXT(ctx
);
3070 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3071 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
3073 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
3074 vstride
, vorder
, points
);
3076 n
[2].f
= (GLfloat
) u1
;
3077 n
[3].f
= (GLfloat
) u2
;
3078 n
[4].f
= (GLfloat
) v1
;
3079 n
[5].f
= (GLfloat
) v2
;
3080 /* XXX verify these strides are correct */
3081 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
3082 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
3085 save_pointer(&n
[10], pnts
);
3087 if (ctx
->ExecuteFlag
) {
3088 CALL_Map2d(ctx
->Exec
, (target
,
3089 u1
, u2
, ustride
, uorder
,
3090 v1
, v2
, vstride
, vorder
, points
));
3095 static void GLAPIENTRY
3096 save_Map2f(GLenum target
,
3097 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
3098 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
3099 const GLfloat
* points
)
3101 GET_CURRENT_CONTEXT(ctx
);
3103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3104 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
3106 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
3107 vstride
, vorder
, points
);
3113 /* XXX verify these strides are correct */
3114 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
3115 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
3118 save_pointer(&n
[10], pnts
);
3120 if (ctx
->ExecuteFlag
) {
3121 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
3122 v1
, v2
, vstride
, vorder
, points
));
3127 static void GLAPIENTRY
3128 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
3130 GET_CURRENT_CONTEXT(ctx
);
3132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3133 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
3139 if (ctx
->ExecuteFlag
) {
3140 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
3145 static void GLAPIENTRY
3146 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
3148 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
3152 static void GLAPIENTRY
3153 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
3154 GLint vn
, GLfloat v1
, GLfloat v2
)
3156 GET_CURRENT_CONTEXT(ctx
);
3158 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3159 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
3168 if (ctx
->ExecuteFlag
) {
3169 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
3175 static void GLAPIENTRY
3176 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
3177 GLint vn
, GLdouble v1
, GLdouble v2
)
3179 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
3180 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
3184 static void GLAPIENTRY
3185 save_MatrixMode(GLenum mode
)
3187 GET_CURRENT_CONTEXT(ctx
);
3189 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3190 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
3194 if (ctx
->ExecuteFlag
) {
3195 CALL_MatrixMode(ctx
->Exec
, (mode
));
3200 static void GLAPIENTRY
3201 save_MultMatrixf(const GLfloat
* m
)
3203 GET_CURRENT_CONTEXT(ctx
);
3205 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3206 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
3209 for (i
= 0; i
< 16; i
++) {
3213 if (ctx
->ExecuteFlag
) {
3214 CALL_MultMatrixf(ctx
->Exec
, (m
));
3219 static void GLAPIENTRY
3220 save_MultMatrixd(const GLdouble
* m
)
3224 for (i
= 0; i
< 16; i
++) {
3225 f
[i
] = (GLfloat
) m
[i
];
3227 save_MultMatrixf(f
);
3231 static void GLAPIENTRY
3232 save_NewList(GLuint name
, GLenum mode
)
3234 GET_CURRENT_CONTEXT(ctx
);
3235 /* It's an error to call this function while building a display list */
3236 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
3243 static void GLAPIENTRY
3244 save_Ortho(GLdouble left
, GLdouble right
,
3245 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
3247 GET_CURRENT_CONTEXT(ctx
);
3249 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3250 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
3252 n
[1].f
= (GLfloat
) left
;
3253 n
[2].f
= (GLfloat
) right
;
3254 n
[3].f
= (GLfloat
) bottom
;
3255 n
[4].f
= (GLfloat
) top
;
3256 n
[5].f
= (GLfloat
) nearval
;
3257 n
[6].f
= (GLfloat
) farval
;
3259 if (ctx
->ExecuteFlag
) {
3260 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
3265 static void GLAPIENTRY
3266 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
3268 GET_CURRENT_CONTEXT(ctx
);
3270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3271 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
3275 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
3277 if (ctx
->ExecuteFlag
) {
3278 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
3283 static void GLAPIENTRY
3284 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
3286 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3288 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3289 for (i
= 0; i
< mapsize
; i
++) {
3290 fvalues
[i
] = (GLfloat
) values
[i
];
3294 for (i
= 0; i
< mapsize
; i
++) {
3295 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3298 save_PixelMapfv(map
, mapsize
, fvalues
);
3302 static void GLAPIENTRY
3303 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3305 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3307 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3308 for (i
= 0; i
< mapsize
; i
++) {
3309 fvalues
[i
] = (GLfloat
) values
[i
];
3313 for (i
= 0; i
< mapsize
; i
++) {
3314 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3317 save_PixelMapfv(map
, mapsize
, fvalues
);
3321 static void GLAPIENTRY
3322 save_PixelTransferf(GLenum pname
, GLfloat param
)
3324 GET_CURRENT_CONTEXT(ctx
);
3326 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3327 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3332 if (ctx
->ExecuteFlag
) {
3333 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3338 static void GLAPIENTRY
3339 save_PixelTransferi(GLenum pname
, GLint param
)
3341 save_PixelTransferf(pname
, (GLfloat
) param
);
3345 static void GLAPIENTRY
3346 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3348 GET_CURRENT_CONTEXT(ctx
);
3350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3351 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3356 if (ctx
->ExecuteFlag
) {
3357 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3362 static void GLAPIENTRY
3363 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3365 GET_CURRENT_CONTEXT(ctx
);
3367 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3368 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3375 if (ctx
->ExecuteFlag
) {
3376 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3381 static void GLAPIENTRY
3382 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3386 parray
[1] = parray
[2] = 0.0F
;
3387 save_PointParameterfvEXT(pname
, parray
);
3390 static void GLAPIENTRY
3391 save_PointParameteriNV(GLenum pname
, GLint param
)
3394 parray
[0] = (GLfloat
) param
;
3395 parray
[1] = parray
[2] = 0.0F
;
3396 save_PointParameterfvEXT(pname
, parray
);
3399 static void GLAPIENTRY
3400 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3403 parray
[0] = (GLfloat
) param
[0];
3404 parray
[1] = parray
[2] = 0.0F
;
3405 save_PointParameterfvEXT(pname
, parray
);
3409 static void GLAPIENTRY
3410 save_PointSize(GLfloat size
)
3412 GET_CURRENT_CONTEXT(ctx
);
3414 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3415 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3419 if (ctx
->ExecuteFlag
) {
3420 CALL_PointSize(ctx
->Exec
, (size
));
3425 static void GLAPIENTRY
3426 save_PolygonMode(GLenum face
, GLenum mode
)
3428 GET_CURRENT_CONTEXT(ctx
);
3430 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3431 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3436 if (ctx
->ExecuteFlag
) {
3437 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3442 static void GLAPIENTRY
3443 save_PolygonStipple(const GLubyte
* pattern
)
3445 GET_CURRENT_CONTEXT(ctx
);
3448 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3450 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3453 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3454 pattern
, &ctx
->Unpack
));
3456 if (ctx
->ExecuteFlag
) {
3457 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3462 static void GLAPIENTRY
3463 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3465 GET_CURRENT_CONTEXT(ctx
);
3467 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3468 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3473 if (ctx
->ExecuteFlag
) {
3474 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3479 static void GLAPIENTRY
3480 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3482 GET_CURRENT_CONTEXT(ctx
);
3483 /* XXX mult by DepthMaxF here??? */
3484 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3487 static void GLAPIENTRY
3488 save_PolygonOffsetClampEXT(GLfloat factor
, GLfloat units
, GLfloat clamp
)
3490 GET_CURRENT_CONTEXT(ctx
);
3492 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3493 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET_CLAMP
, 3);
3499 if (ctx
->ExecuteFlag
) {
3500 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (factor
, units
, clamp
));
3504 static void GLAPIENTRY
3505 save_PopAttrib(void)
3507 GET_CURRENT_CONTEXT(ctx
);
3508 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3509 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3510 if (ctx
->ExecuteFlag
) {
3511 CALL_PopAttrib(ctx
->Exec
, ());
3516 static void GLAPIENTRY
3517 save_PopMatrix(void)
3519 GET_CURRENT_CONTEXT(ctx
);
3520 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3521 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3522 if (ctx
->ExecuteFlag
) {
3523 CALL_PopMatrix(ctx
->Exec
, ());
3528 static void GLAPIENTRY
3531 GET_CURRENT_CONTEXT(ctx
);
3532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3533 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3534 if (ctx
->ExecuteFlag
) {
3535 CALL_PopName(ctx
->Exec
, ());
3540 static void GLAPIENTRY
3541 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3542 const GLclampf
* priorities
)
3544 GET_CURRENT_CONTEXT(ctx
);
3546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3548 for (i
= 0; i
< num
; i
++) {
3550 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3552 n
[1].ui
= textures
[i
];
3553 n
[2].f
= priorities
[i
];
3556 if (ctx
->ExecuteFlag
) {
3557 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3562 static void GLAPIENTRY
3563 save_PushAttrib(GLbitfield mask
)
3565 GET_CURRENT_CONTEXT(ctx
);
3567 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3568 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3572 if (ctx
->ExecuteFlag
) {
3573 CALL_PushAttrib(ctx
->Exec
, (mask
));
3578 static void GLAPIENTRY
3579 save_PushMatrix(void)
3581 GET_CURRENT_CONTEXT(ctx
);
3582 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3583 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3584 if (ctx
->ExecuteFlag
) {
3585 CALL_PushMatrix(ctx
->Exec
, ());
3590 static void GLAPIENTRY
3591 save_PushName(GLuint name
)
3593 GET_CURRENT_CONTEXT(ctx
);
3595 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3596 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3600 if (ctx
->ExecuteFlag
) {
3601 CALL_PushName(ctx
->Exec
, (name
));
3606 static void GLAPIENTRY
3607 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3609 GET_CURRENT_CONTEXT(ctx
);
3611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3612 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3619 if (ctx
->ExecuteFlag
) {
3620 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3624 static void GLAPIENTRY
3625 save_RasterPos2d(GLdouble x
, GLdouble y
)
3627 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3630 static void GLAPIENTRY
3631 save_RasterPos2f(GLfloat x
, GLfloat y
)
3633 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3636 static void GLAPIENTRY
3637 save_RasterPos2i(GLint x
, GLint y
)
3639 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3642 static void GLAPIENTRY
3643 save_RasterPos2s(GLshort x
, GLshort y
)
3645 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3648 static void GLAPIENTRY
3649 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3651 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3654 static void GLAPIENTRY
3655 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3657 save_RasterPos4f(x
, y
, z
, 1.0F
);
3660 static void GLAPIENTRY
3661 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3663 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3666 static void GLAPIENTRY
3667 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3669 save_RasterPos4f(x
, y
, z
, 1.0F
);
3672 static void GLAPIENTRY
3673 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3675 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3678 static void GLAPIENTRY
3679 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3681 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3684 static void GLAPIENTRY
3685 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3687 save_RasterPos4f(x
, y
, z
, w
);
3690 static void GLAPIENTRY
3691 save_RasterPos2dv(const GLdouble
* v
)
3693 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3696 static void GLAPIENTRY
3697 save_RasterPos2fv(const GLfloat
* v
)
3699 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3702 static void GLAPIENTRY
3703 save_RasterPos2iv(const GLint
* v
)
3705 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3708 static void GLAPIENTRY
3709 save_RasterPos2sv(const GLshort
* v
)
3711 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3714 static void GLAPIENTRY
3715 save_RasterPos3dv(const GLdouble
* v
)
3717 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3720 static void GLAPIENTRY
3721 save_RasterPos3fv(const GLfloat
* v
)
3723 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3726 static void GLAPIENTRY
3727 save_RasterPos3iv(const GLint
* v
)
3729 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3732 static void GLAPIENTRY
3733 save_RasterPos3sv(const GLshort
* v
)
3735 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3738 static void GLAPIENTRY
3739 save_RasterPos4dv(const GLdouble
* v
)
3741 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3742 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3745 static void GLAPIENTRY
3746 save_RasterPos4fv(const GLfloat
* v
)
3748 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3751 static void GLAPIENTRY
3752 save_RasterPos4iv(const GLint
* v
)
3754 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3755 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3758 static void GLAPIENTRY
3759 save_RasterPos4sv(const GLshort
* v
)
3761 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3765 static void GLAPIENTRY
3766 save_PassThrough(GLfloat token
)
3768 GET_CURRENT_CONTEXT(ctx
);
3770 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3771 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3775 if (ctx
->ExecuteFlag
) {
3776 CALL_PassThrough(ctx
->Exec
, (token
));
3781 static void GLAPIENTRY
3782 save_ReadBuffer(GLenum mode
)
3784 GET_CURRENT_CONTEXT(ctx
);
3786 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3787 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3791 if (ctx
->ExecuteFlag
) {
3792 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3797 static void GLAPIENTRY
3798 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3800 GET_CURRENT_CONTEXT(ctx
);
3802 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3803 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3810 if (ctx
->ExecuteFlag
) {
3811 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3816 static void GLAPIENTRY
3817 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3819 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3823 static void GLAPIENTRY
3824 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3826 GET_CURRENT_CONTEXT(ctx
);
3828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3829 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3835 if (ctx
->ExecuteFlag
) {
3836 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3841 static void GLAPIENTRY
3842 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3844 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3848 static void GLAPIENTRY
3849 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3851 GET_CURRENT_CONTEXT(ctx
);
3853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3854 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3861 if (ctx
->ExecuteFlag
) {
3862 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3867 static void GLAPIENTRY
3868 save_ShadeModel(GLenum mode
)
3870 GET_CURRENT_CONTEXT(ctx
);
3872 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3874 if (ctx
->ExecuteFlag
) {
3875 CALL_ShadeModel(ctx
->Exec
, (mode
));
3878 /* Don't compile this call if it's a no-op.
3879 * By avoiding this state change we have a better chance of
3880 * coalescing subsequent drawing commands into one batch.
3882 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3885 SAVE_FLUSH_VERTICES(ctx
);
3887 ctx
->ListState
.Current
.ShadeModel
= mode
;
3889 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3896 static void GLAPIENTRY
3897 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3899 GET_CURRENT_CONTEXT(ctx
);
3901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3902 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3908 if (ctx
->ExecuteFlag
) {
3909 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3914 static void GLAPIENTRY
3915 save_StencilMask(GLuint mask
)
3917 GET_CURRENT_CONTEXT(ctx
);
3919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3920 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3924 if (ctx
->ExecuteFlag
) {
3925 CALL_StencilMask(ctx
->Exec
, (mask
));
3930 static void GLAPIENTRY
3931 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3933 GET_CURRENT_CONTEXT(ctx
);
3935 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3936 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3942 if (ctx
->ExecuteFlag
) {
3943 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3948 static void GLAPIENTRY
3949 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3951 GET_CURRENT_CONTEXT(ctx
);
3953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3954 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3961 if (ctx
->ExecuteFlag
) {
3962 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3967 static void GLAPIENTRY
3968 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3971 GET_CURRENT_CONTEXT(ctx
);
3973 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3975 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3983 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3990 if (ctx
->ExecuteFlag
) {
3991 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3992 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3997 static void GLAPIENTRY
3998 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
4000 GET_CURRENT_CONTEXT(ctx
);
4002 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4003 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
4008 if (ctx
->ExecuteFlag
) {
4009 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
4014 static void GLAPIENTRY
4015 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
4017 GET_CURRENT_CONTEXT(ctx
);
4019 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4020 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
4027 if (ctx
->ExecuteFlag
) {
4028 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
4033 static void GLAPIENTRY
4034 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4036 GET_CURRENT_CONTEXT(ctx
);
4038 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4039 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
4043 if (pname
== GL_TEXTURE_ENV_COLOR
) {
4051 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
4054 if (ctx
->ExecuteFlag
) {
4055 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
4060 static void GLAPIENTRY
4061 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
4064 parray
[0] = (GLfloat
) param
;
4065 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4066 save_TexEnvfv(target
, pname
, parray
);
4070 static void GLAPIENTRY
4071 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
4074 p
[0] = (GLfloat
) param
;
4075 p
[1] = p
[2] = p
[3] = 0.0F
;
4076 save_TexEnvfv(target
, pname
, p
);
4080 static void GLAPIENTRY
4081 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
4084 if (pname
== GL_TEXTURE_ENV_COLOR
) {
4085 p
[0] = INT_TO_FLOAT(param
[0]);
4086 p
[1] = INT_TO_FLOAT(param
[1]);
4087 p
[2] = INT_TO_FLOAT(param
[2]);
4088 p
[3] = INT_TO_FLOAT(param
[3]);
4091 p
[0] = (GLfloat
) param
[0];
4092 p
[1] = p
[2] = p
[3] = 0.0F
;
4094 save_TexEnvfv(target
, pname
, p
);
4098 static void GLAPIENTRY
4099 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
4101 GET_CURRENT_CONTEXT(ctx
);
4103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4104 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
4113 if (ctx
->ExecuteFlag
) {
4114 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
4119 static void GLAPIENTRY
4120 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
4123 p
[0] = (GLfloat
) params
[0];
4124 p
[1] = (GLfloat
) params
[1];
4125 p
[2] = (GLfloat
) params
[2];
4126 p
[3] = (GLfloat
) params
[3];
4127 save_TexGenfv(coord
, pname
, p
);
4131 static void GLAPIENTRY
4132 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
4135 parray
[0] = (GLfloat
) param
;
4136 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4137 save_TexGenfv(coord
, pname
, parray
);
4141 static void GLAPIENTRY
4142 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
4145 p
[0] = (GLfloat
) params
[0];
4146 p
[1] = (GLfloat
) params
[1];
4147 p
[2] = (GLfloat
) params
[2];
4148 p
[3] = (GLfloat
) params
[3];
4149 save_TexGenfv(coord
, pname
, p
);
4153 static void GLAPIENTRY
4154 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
4158 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4159 save_TexGenfv(coord
, pname
, parray
);
4163 static void GLAPIENTRY
4164 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
4168 parray
[1] = parray
[2] = parray
[3] = 0;
4169 save_TexGeniv(coord
, pname
, parray
);
4173 static void GLAPIENTRY
4174 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4176 GET_CURRENT_CONTEXT(ctx
);
4178 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4179 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
4188 if (ctx
->ExecuteFlag
) {
4189 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
4194 static void GLAPIENTRY
4195 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
4199 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4200 save_TexParameterfv(target
, pname
, parray
);
4204 static void GLAPIENTRY
4205 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
4208 fparam
[0] = (GLfloat
) param
;
4209 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4210 save_TexParameterfv(target
, pname
, fparam
);
4214 static void GLAPIENTRY
4215 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
4218 fparam
[0] = (GLfloat
) params
[0];
4219 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4220 save_TexParameterfv(target
, pname
, fparam
);
4224 static void GLAPIENTRY
4225 save_TexImage1D(GLenum target
,
4226 GLint level
, GLint components
,
4227 GLsizei width
, GLint border
,
4228 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4230 GET_CURRENT_CONTEXT(ctx
);
4231 if (target
== GL_PROXY_TEXTURE_1D
) {
4232 /* don't compile, execute immediately */
4233 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4234 border
, format
, type
, pixels
));
4238 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4239 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
4243 n
[3].i
= components
;
4244 n
[4].i
= (GLint
) width
;
4249 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4250 pixels
, &ctx
->Unpack
));
4252 if (ctx
->ExecuteFlag
) {
4253 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4254 border
, format
, type
, pixels
));
4260 static void GLAPIENTRY
4261 save_TexImage2D(GLenum target
,
4262 GLint level
, GLint components
,
4263 GLsizei width
, GLsizei height
, GLint border
,
4264 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4266 GET_CURRENT_CONTEXT(ctx
);
4267 if (target
== GL_PROXY_TEXTURE_2D
) {
4268 /* don't compile, execute immediately */
4269 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4270 height
, border
, format
, type
, pixels
));
4274 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4275 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
4279 n
[3].i
= components
;
4280 n
[4].i
= (GLint
) width
;
4281 n
[5].i
= (GLint
) height
;
4286 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4287 pixels
, &ctx
->Unpack
));
4289 if (ctx
->ExecuteFlag
) {
4290 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4291 height
, border
, format
, type
, pixels
));
4297 static void GLAPIENTRY
4298 save_TexImage3D(GLenum target
,
4299 GLint level
, GLint internalFormat
,
4300 GLsizei width
, GLsizei height
, GLsizei depth
,
4302 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4304 GET_CURRENT_CONTEXT(ctx
);
4305 if (target
== GL_PROXY_TEXTURE_3D
) {
4306 /* don't compile, execute immediately */
4307 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4308 height
, depth
, border
, format
, type
,
4313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4314 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
4318 n
[3].i
= (GLint
) internalFormat
;
4319 n
[4].i
= (GLint
) width
;
4320 n
[5].i
= (GLint
) height
;
4321 n
[6].i
= (GLint
) depth
;
4325 save_pointer(&n
[10],
4326 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4327 pixels
, &ctx
->Unpack
));
4329 if (ctx
->ExecuteFlag
) {
4330 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4331 height
, depth
, border
, format
, type
,
4338 static void GLAPIENTRY
4339 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4340 GLsizei width
, GLenum format
, GLenum type
,
4341 const GLvoid
* pixels
)
4343 GET_CURRENT_CONTEXT(ctx
);
4346 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4348 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
4353 n
[4].i
= (GLint
) width
;
4357 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4358 pixels
, &ctx
->Unpack
));
4360 if (ctx
->ExecuteFlag
) {
4361 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4362 format
, type
, pixels
));
4367 static void GLAPIENTRY
4368 save_TexSubImage2D(GLenum target
, GLint level
,
4369 GLint xoffset
, GLint yoffset
,
4370 GLsizei width
, GLsizei height
,
4371 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4373 GET_CURRENT_CONTEXT(ctx
);
4376 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4378 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
4384 n
[5].i
= (GLint
) width
;
4385 n
[6].i
= (GLint
) height
;
4389 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4390 pixels
, &ctx
->Unpack
));
4392 if (ctx
->ExecuteFlag
) {
4393 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4394 width
, height
, format
, type
, pixels
));
4399 static void GLAPIENTRY
4400 save_TexSubImage3D(GLenum target
, GLint level
,
4401 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4402 GLsizei width
, GLsizei height
, GLsizei depth
,
4403 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4405 GET_CURRENT_CONTEXT(ctx
);
4408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4410 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4417 n
[6].i
= (GLint
) width
;
4418 n
[7].i
= (GLint
) height
;
4419 n
[8].i
= (GLint
) depth
;
4422 save_pointer(&n
[11],
4423 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4424 pixels
, &ctx
->Unpack
));
4426 if (ctx
->ExecuteFlag
) {
4427 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4428 xoffset
, yoffset
, zoffset
,
4429 width
, height
, depth
, format
, type
,
4435 static void GLAPIENTRY
4436 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4438 GET_CURRENT_CONTEXT(ctx
);
4440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4441 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4447 if (ctx
->ExecuteFlag
) {
4448 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4453 static void GLAPIENTRY
4454 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4456 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4461 static void GLAPIENTRY
4462 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4464 GET_CURRENT_CONTEXT(ctx
);
4466 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4467 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4471 n
[3].i
= (GLint
) width
;
4472 n
[4].i
= (GLint
) height
;
4474 if (ctx
->ExecuteFlag
) {
4475 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4480 static void GLAPIENTRY
4481 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4483 GET_CURRENT_CONTEXT(ctx
);
4485 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4486 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4493 if (ctx
->ExecuteFlag
) {
4494 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4498 static void GLAPIENTRY
4499 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4501 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4504 static void GLAPIENTRY
4505 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4507 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4510 static void GLAPIENTRY
4511 save_WindowPos2iMESA(GLint x
, GLint y
)
4513 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4516 static void GLAPIENTRY
4517 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4519 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4522 static void GLAPIENTRY
4523 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4525 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4528 static void GLAPIENTRY
4529 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4531 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4534 static void GLAPIENTRY
4535 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4537 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4540 static void GLAPIENTRY
4541 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4543 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4546 static void GLAPIENTRY
4547 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4549 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4552 static void GLAPIENTRY
4553 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4555 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4558 static void GLAPIENTRY
4559 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4561 save_WindowPos4fMESA(x
, y
, z
, w
);
4564 static void GLAPIENTRY
4565 save_WindowPos2dvMESA(const GLdouble
* v
)
4567 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4570 static void GLAPIENTRY
4571 save_WindowPos2fvMESA(const GLfloat
* v
)
4573 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4576 static void GLAPIENTRY
4577 save_WindowPos2ivMESA(const GLint
* v
)
4579 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4582 static void GLAPIENTRY
4583 save_WindowPos2svMESA(const GLshort
* v
)
4585 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4588 static void GLAPIENTRY
4589 save_WindowPos3dvMESA(const GLdouble
* v
)
4591 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4594 static void GLAPIENTRY
4595 save_WindowPos3fvMESA(const GLfloat
* v
)
4597 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4600 static void GLAPIENTRY
4601 save_WindowPos3ivMESA(const GLint
* v
)
4603 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4606 static void GLAPIENTRY
4607 save_WindowPos3svMESA(const GLshort
* v
)
4609 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4612 static void GLAPIENTRY
4613 save_WindowPos4dvMESA(const GLdouble
* v
)
4615 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4616 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4619 static void GLAPIENTRY
4620 save_WindowPos4fvMESA(const GLfloat
* v
)
4622 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4625 static void GLAPIENTRY
4626 save_WindowPos4ivMESA(const GLint
* v
)
4628 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4629 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4632 static void GLAPIENTRY
4633 save_WindowPos4svMESA(const GLshort
* v
)
4635 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4640 /* GL_ARB_multitexture */
4641 static void GLAPIENTRY
4642 save_ActiveTextureARB(GLenum target
)
4644 GET_CURRENT_CONTEXT(ctx
);
4646 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4647 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4651 if (ctx
->ExecuteFlag
) {
4652 CALL_ActiveTexture(ctx
->Exec
, (target
));
4657 /* GL_ARB_transpose_matrix */
4659 static void GLAPIENTRY
4660 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4663 _math_transposefd(tm
, m
);
4664 save_LoadMatrixf(tm
);
4668 static void GLAPIENTRY
4669 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4672 _math_transposef(tm
, m
);
4673 save_LoadMatrixf(tm
);
4677 static void GLAPIENTRY
4678 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4681 _math_transposefd(tm
, m
);
4682 save_MultMatrixf(tm
);
4686 static void GLAPIENTRY
4687 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4690 _math_transposef(tm
, m
);
4691 save_MultMatrixf(tm
);
4694 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4696 GET_CURRENT_CONTEXT(ctx
);
4702 image
= malloc(size
);
4704 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4707 memcpy(image
, data
, size
);
4713 /* GL_ARB_texture_compression */
4714 static void GLAPIENTRY
4715 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4716 GLenum internalFormat
, GLsizei width
,
4717 GLint border
, GLsizei imageSize
,
4718 const GLvoid
* data
)
4720 GET_CURRENT_CONTEXT(ctx
);
4721 if (target
== GL_PROXY_TEXTURE_1D
) {
4722 /* don't compile, execute immediately */
4723 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4724 width
, border
, imageSize
,
4729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4731 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4732 6 + POINTER_DWORDS
);
4736 n
[3].e
= internalFormat
;
4737 n
[4].i
= (GLint
) width
;
4741 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4743 if (ctx
->ExecuteFlag
) {
4744 CALL_CompressedTexImage1D(ctx
->Exec
,
4745 (target
, level
, internalFormat
, width
,
4746 border
, imageSize
, data
));
4752 static void GLAPIENTRY
4753 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4754 GLenum internalFormat
, GLsizei width
,
4755 GLsizei height
, GLint border
, GLsizei imageSize
,
4756 const GLvoid
* data
)
4758 GET_CURRENT_CONTEXT(ctx
);
4759 if (target
== GL_PROXY_TEXTURE_2D
) {
4760 /* don't compile, execute immediately */
4761 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4762 width
, height
, border
,
4767 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4769 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4770 7 + POINTER_DWORDS
);
4774 n
[3].e
= internalFormat
;
4775 n
[4].i
= (GLint
) width
;
4776 n
[5].i
= (GLint
) height
;
4780 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4782 if (ctx
->ExecuteFlag
) {
4783 CALL_CompressedTexImage2D(ctx
->Exec
,
4784 (target
, level
, internalFormat
, width
,
4785 height
, border
, imageSize
, data
));
4791 static void GLAPIENTRY
4792 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4793 GLenum internalFormat
, GLsizei width
,
4794 GLsizei height
, GLsizei depth
, GLint border
,
4795 GLsizei imageSize
, const GLvoid
* data
)
4797 GET_CURRENT_CONTEXT(ctx
);
4798 if (target
== GL_PROXY_TEXTURE_3D
) {
4799 /* don't compile, execute immediately */
4800 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4801 width
, height
, depth
, border
,
4806 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4808 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4809 8 + POINTER_DWORDS
);
4813 n
[3].e
= internalFormat
;
4814 n
[4].i
= (GLint
) width
;
4815 n
[5].i
= (GLint
) height
;
4816 n
[6].i
= (GLint
) depth
;
4820 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4822 if (ctx
->ExecuteFlag
) {
4823 CALL_CompressedTexImage3D(ctx
->Exec
,
4824 (target
, level
, internalFormat
, width
,
4825 height
, depth
, border
, imageSize
,
4832 static void GLAPIENTRY
4833 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4834 GLsizei width
, GLenum format
,
4835 GLsizei imageSize
, const GLvoid
* data
)
4838 GET_CURRENT_CONTEXT(ctx
);
4839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4841 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4842 6 + POINTER_DWORDS
);
4847 n
[4].i
= (GLint
) width
;
4851 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4853 if (ctx
->ExecuteFlag
) {
4854 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4855 width
, format
, imageSize
,
4861 static void GLAPIENTRY
4862 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4863 GLint yoffset
, GLsizei width
, GLsizei height
,
4864 GLenum format
, GLsizei imageSize
,
4865 const GLvoid
* data
)
4868 GET_CURRENT_CONTEXT(ctx
);
4869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4871 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4872 8 + POINTER_DWORDS
);
4878 n
[5].i
= (GLint
) width
;
4879 n
[6].i
= (GLint
) height
;
4883 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4885 if (ctx
->ExecuteFlag
) {
4886 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4887 (target
, level
, xoffset
, yoffset
, width
,
4888 height
, format
, imageSize
, data
));
4893 static void GLAPIENTRY
4894 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4895 GLint yoffset
, GLint zoffset
, GLsizei width
,
4896 GLsizei height
, GLsizei depth
, GLenum format
,
4897 GLsizei imageSize
, const GLvoid
* data
)
4900 GET_CURRENT_CONTEXT(ctx
);
4901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4903 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4904 10 + POINTER_DWORDS
);
4911 n
[6].i
= (GLint
) width
;
4912 n
[7].i
= (GLint
) height
;
4913 n
[8].i
= (GLint
) depth
;
4915 n
[10].i
= imageSize
;
4916 save_pointer(&n
[11],
4917 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4919 if (ctx
->ExecuteFlag
) {
4920 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4921 (target
, level
, xoffset
, yoffset
,
4922 zoffset
, width
, height
, depth
, format
,
4928 /* GL_ARB_multisample */
4929 static void GLAPIENTRY
4930 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4932 GET_CURRENT_CONTEXT(ctx
);
4934 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4935 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4940 if (ctx
->ExecuteFlag
) {
4941 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4947 * GL_ARB_vertex_program
4949 static void GLAPIENTRY
4950 save_BindProgramARB(GLenum target
, GLuint id
)
4952 GET_CURRENT_CONTEXT(ctx
);
4954 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4955 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_ARB
, 2);
4960 if (ctx
->ExecuteFlag
) {
4961 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4965 static void GLAPIENTRY
4966 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4967 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4969 GET_CURRENT_CONTEXT(ctx
);
4971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4972 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4981 if (ctx
->ExecuteFlag
) {
4982 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4987 static void GLAPIENTRY
4988 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4989 const GLfloat
*params
)
4991 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4992 params
[2], params
[3]);
4996 static void GLAPIENTRY
4997 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4998 const GLfloat
* params
)
5000 GET_CURRENT_CONTEXT(ctx
);
5002 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5006 const GLfloat
* p
= params
;
5008 for (i
= 0 ; i
< count
; i
++) {
5009 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
5022 if (ctx
->ExecuteFlag
) {
5023 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5028 static void GLAPIENTRY
5029 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
5030 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
5032 save_ProgramEnvParameter4fARB(target
, index
,
5034 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
5038 static void GLAPIENTRY
5039 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
5040 const GLdouble
*params
)
5042 save_ProgramEnvParameter4fARB(target
, index
,
5043 (GLfloat
) params
[0],
5044 (GLfloat
) params
[1],
5045 (GLfloat
) params
[2], (GLfloat
) params
[3]);
5049 static void GLAPIENTRY
5050 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
5051 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5053 GET_CURRENT_CONTEXT(ctx
);
5055 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5056 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5065 if (ctx
->ExecuteFlag
) {
5066 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5071 static void GLAPIENTRY
5072 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
5073 const GLfloat
*params
)
5075 GET_CURRENT_CONTEXT(ctx
);
5077 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5078 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5087 if (ctx
->ExecuteFlag
) {
5088 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
5093 static void GLAPIENTRY
5094 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
5095 const GLfloat
*params
)
5097 GET_CURRENT_CONTEXT(ctx
);
5099 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5103 const GLfloat
* p
= params
;
5105 for (i
= 0 ; i
< count
; i
++) {
5106 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5119 if (ctx
->ExecuteFlag
) {
5120 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5125 static void GLAPIENTRY
5126 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
5127 GLdouble x
, GLdouble y
,
5128 GLdouble z
, GLdouble w
)
5130 GET_CURRENT_CONTEXT(ctx
);
5132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5133 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5137 n
[3].f
= (GLfloat
) x
;
5138 n
[4].f
= (GLfloat
) y
;
5139 n
[5].f
= (GLfloat
) z
;
5140 n
[6].f
= (GLfloat
) w
;
5142 if (ctx
->ExecuteFlag
) {
5143 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5148 static void GLAPIENTRY
5149 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
5150 const GLdouble
*params
)
5152 GET_CURRENT_CONTEXT(ctx
);
5154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5155 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5159 n
[3].f
= (GLfloat
) params
[0];
5160 n
[4].f
= (GLfloat
) params
[1];
5161 n
[5].f
= (GLfloat
) params
[2];
5162 n
[6].f
= (GLfloat
) params
[3];
5164 if (ctx
->ExecuteFlag
) {
5165 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
5170 /* GL_EXT_stencil_two_side */
5171 static void GLAPIENTRY
5172 save_ActiveStencilFaceEXT(GLenum face
)
5174 GET_CURRENT_CONTEXT(ctx
);
5176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5177 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
5181 if (ctx
->ExecuteFlag
) {
5182 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
5187 /* GL_EXT_depth_bounds_test */
5188 static void GLAPIENTRY
5189 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
5191 GET_CURRENT_CONTEXT(ctx
);
5193 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5194 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
5196 n
[1].f
= (GLfloat
) zmin
;
5197 n
[2].f
= (GLfloat
) zmax
;
5199 if (ctx
->ExecuteFlag
) {
5200 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
5206 static void GLAPIENTRY
5207 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
5208 const GLvoid
* string
)
5210 GET_CURRENT_CONTEXT(ctx
);
5213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5215 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
5217 GLubyte
*programCopy
= malloc(len
);
5219 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
5222 memcpy(programCopy
, string
, len
);
5226 save_pointer(&n
[4], programCopy
);
5228 if (ctx
->ExecuteFlag
) {
5229 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
5234 static void GLAPIENTRY
5235 save_BeginQueryARB(GLenum target
, GLuint id
)
5237 GET_CURRENT_CONTEXT(ctx
);
5239 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5240 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
5245 if (ctx
->ExecuteFlag
) {
5246 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
5250 static void GLAPIENTRY
5251 save_EndQueryARB(GLenum target
)
5253 GET_CURRENT_CONTEXT(ctx
);
5255 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5256 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
5260 if (ctx
->ExecuteFlag
) {
5261 CALL_EndQuery(ctx
->Exec
, (target
));
5265 static void GLAPIENTRY
5266 save_QueryCounter(GLuint id
, GLenum target
)
5268 GET_CURRENT_CONTEXT(ctx
);
5270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5271 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
5276 if (ctx
->ExecuteFlag
) {
5277 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
5281 static void GLAPIENTRY
5282 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
5284 GET_CURRENT_CONTEXT(ctx
);
5286 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5287 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
5293 if (ctx
->ExecuteFlag
) {
5294 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5298 static void GLAPIENTRY
5299 save_EndQueryIndexed(GLenum target
, GLuint index
)
5301 GET_CURRENT_CONTEXT(ctx
);
5303 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5304 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5309 if (ctx
->ExecuteFlag
) {
5310 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5315 static void GLAPIENTRY
5316 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5318 GET_CURRENT_CONTEXT(ctx
);
5320 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5321 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5325 if (count
> MAX_DRAW_BUFFERS
)
5326 count
= MAX_DRAW_BUFFERS
;
5327 for (i
= 0; i
< count
; i
++) {
5328 n
[2 + i
].e
= buffers
[i
];
5331 if (ctx
->ExecuteFlag
) {
5332 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5336 static void GLAPIENTRY
5337 save_BindFragmentShaderATI(GLuint id
)
5339 GET_CURRENT_CONTEXT(ctx
);
5342 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5346 if (ctx
->ExecuteFlag
) {
5347 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5351 static void GLAPIENTRY
5352 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5354 GET_CURRENT_CONTEXT(ctx
);
5357 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5365 if (ctx
->ExecuteFlag
) {
5366 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5370 static void GLAPIENTRY
5371 save_Attr1fNV(GLenum attr
, GLfloat x
)
5373 GET_CURRENT_CONTEXT(ctx
);
5375 SAVE_FLUSH_VERTICES(ctx
);
5376 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5382 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5383 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5384 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5386 if (ctx
->ExecuteFlag
) {
5387 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5391 static void GLAPIENTRY
5392 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5394 GET_CURRENT_CONTEXT(ctx
);
5396 SAVE_FLUSH_VERTICES(ctx
);
5397 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5404 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5405 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5406 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5408 if (ctx
->ExecuteFlag
) {
5409 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5413 static void GLAPIENTRY
5414 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5416 GET_CURRENT_CONTEXT(ctx
);
5418 SAVE_FLUSH_VERTICES(ctx
);
5419 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5427 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5428 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5429 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5431 if (ctx
->ExecuteFlag
) {
5432 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5436 static void GLAPIENTRY
5437 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5439 GET_CURRENT_CONTEXT(ctx
);
5441 SAVE_FLUSH_VERTICES(ctx
);
5442 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5451 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5452 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5453 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5455 if (ctx
->ExecuteFlag
) {
5456 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5461 static void GLAPIENTRY
5462 save_Attr1fARB(GLenum attr
, GLfloat x
)
5464 GET_CURRENT_CONTEXT(ctx
);
5466 SAVE_FLUSH_VERTICES(ctx
);
5467 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5473 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5474 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5475 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5477 if (ctx
->ExecuteFlag
) {
5478 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5482 static void GLAPIENTRY
5483 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5485 GET_CURRENT_CONTEXT(ctx
);
5487 SAVE_FLUSH_VERTICES(ctx
);
5488 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5495 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5496 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5497 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5499 if (ctx
->ExecuteFlag
) {
5500 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5504 static void GLAPIENTRY
5505 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5507 GET_CURRENT_CONTEXT(ctx
);
5509 SAVE_FLUSH_VERTICES(ctx
);
5510 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5518 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5519 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5520 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5522 if (ctx
->ExecuteFlag
) {
5523 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5527 static void GLAPIENTRY
5528 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5530 GET_CURRENT_CONTEXT(ctx
);
5532 SAVE_FLUSH_VERTICES(ctx
);
5533 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5542 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5543 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5544 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5546 if (ctx
->ExecuteFlag
) {
5547 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5552 static void GLAPIENTRY
5553 save_EvalCoord1f(GLfloat x
)
5555 GET_CURRENT_CONTEXT(ctx
);
5557 SAVE_FLUSH_VERTICES(ctx
);
5558 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5562 if (ctx
->ExecuteFlag
) {
5563 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5567 static void GLAPIENTRY
5568 save_EvalCoord1fv(const GLfloat
* v
)
5570 save_EvalCoord1f(v
[0]);
5573 static void GLAPIENTRY
5574 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5576 GET_CURRENT_CONTEXT(ctx
);
5578 SAVE_FLUSH_VERTICES(ctx
);
5579 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5584 if (ctx
->ExecuteFlag
) {
5585 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5589 static void GLAPIENTRY
5590 save_EvalCoord2fv(const GLfloat
* v
)
5592 save_EvalCoord2f(v
[0], v
[1]);
5596 static void GLAPIENTRY
5597 save_EvalPoint1(GLint x
)
5599 GET_CURRENT_CONTEXT(ctx
);
5601 SAVE_FLUSH_VERTICES(ctx
);
5602 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5606 if (ctx
->ExecuteFlag
) {
5607 CALL_EvalPoint1(ctx
->Exec
, (x
));
5611 static void GLAPIENTRY
5612 save_EvalPoint2(GLint x
, GLint y
)
5614 GET_CURRENT_CONTEXT(ctx
);
5616 SAVE_FLUSH_VERTICES(ctx
);
5617 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5622 if (ctx
->ExecuteFlag
) {
5623 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5627 static void GLAPIENTRY
5628 save_Indexf(GLfloat x
)
5630 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5633 static void GLAPIENTRY
5634 save_Indexfv(const GLfloat
* v
)
5636 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5639 static void GLAPIENTRY
5640 save_EdgeFlag(GLboolean x
)
5642 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5647 * Compare 'count' elements of vectors 'a' and 'b'.
5648 * \return GL_TRUE if equal, GL_FALSE if different.
5650 static inline GLboolean
5651 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5653 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5658 * This glMaterial function is used for glMaterial calls that are outside
5659 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5661 static void GLAPIENTRY
5662 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5664 GET_CURRENT_CONTEXT(ctx
);
5672 case GL_FRONT_AND_BACK
:
5675 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5684 case GL_AMBIENT_AND_DIFFUSE
:
5690 case GL_COLOR_INDEXES
:
5694 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5698 if (ctx
->ExecuteFlag
) {
5699 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5702 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5704 /* Try to eliminate redundant statechanges. Because it is legal to
5705 * call glMaterial even inside begin/end calls, don't need to worry
5706 * about ctx->Driver.CurrentSavePrimitive here.
5708 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5709 if (bitmask
& (1 << i
)) {
5710 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5711 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5712 /* no change in material value */
5713 bitmask
&= ~(1 << i
);
5716 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5717 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5722 /* If this call has no effect, return early */
5726 SAVE_FLUSH_VERTICES(ctx
);
5728 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5732 for (i
= 0; i
< args
; i
++)
5733 n
[3 + i
].f
= param
[i
];
5737 static void GLAPIENTRY
5738 save_Begin(GLenum mode
)
5740 GET_CURRENT_CONTEXT(ctx
);
5742 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5743 /* compile this error into the display list */
5744 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5746 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5747 /* compile this error into the display list */
5748 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5751 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5753 vbo_save_NotifyBegin(ctx
, mode
);
5757 static void GLAPIENTRY
5760 GET_CURRENT_CONTEXT(ctx
);
5761 SAVE_FLUSH_VERTICES(ctx
);
5762 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5763 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5764 if (ctx
->ExecuteFlag
) {
5765 CALL_End(ctx
->Exec
, ());
5769 static void GLAPIENTRY
5770 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5772 GET_CURRENT_CONTEXT(ctx
);
5774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5775 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5782 if (ctx
->ExecuteFlag
) {
5783 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5788 static void GLAPIENTRY
5789 save_Vertex2f(GLfloat x
, GLfloat y
)
5791 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5794 static void GLAPIENTRY
5795 save_Vertex2fv(const GLfloat
* v
)
5797 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5800 static void GLAPIENTRY
5801 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5803 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5806 static void GLAPIENTRY
5807 save_Vertex3fv(const GLfloat
* v
)
5809 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5812 static void GLAPIENTRY
5813 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5815 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5818 static void GLAPIENTRY
5819 save_Vertex4fv(const GLfloat
* v
)
5821 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5824 static void GLAPIENTRY
5825 save_TexCoord1f(GLfloat x
)
5827 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5830 static void GLAPIENTRY
5831 save_TexCoord1fv(const GLfloat
* v
)
5833 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5836 static void GLAPIENTRY
5837 save_TexCoord2f(GLfloat x
, GLfloat y
)
5839 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5842 static void GLAPIENTRY
5843 save_TexCoord2fv(const GLfloat
* v
)
5845 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5848 static void GLAPIENTRY
5849 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5851 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5854 static void GLAPIENTRY
5855 save_TexCoord3fv(const GLfloat
* v
)
5857 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5860 static void GLAPIENTRY
5861 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5863 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5866 static void GLAPIENTRY
5867 save_TexCoord4fv(const GLfloat
* v
)
5869 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5872 static void GLAPIENTRY
5873 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5875 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5878 static void GLAPIENTRY
5879 save_Normal3fv(const GLfloat
* v
)
5881 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5884 static void GLAPIENTRY
5885 save_FogCoordfEXT(GLfloat x
)
5887 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5890 static void GLAPIENTRY
5891 save_FogCoordfvEXT(const GLfloat
* v
)
5893 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5896 static void GLAPIENTRY
5897 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5899 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5902 static void GLAPIENTRY
5903 save_Color3fv(const GLfloat
* v
)
5905 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5908 static void GLAPIENTRY
5909 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5911 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5914 static void GLAPIENTRY
5915 save_Color4fv(const GLfloat
* v
)
5917 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5920 static void GLAPIENTRY
5921 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5923 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5926 static void GLAPIENTRY
5927 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5929 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5933 /* Just call the respective ATTR for texcoord
5935 static void GLAPIENTRY
5936 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5938 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5939 save_Attr1fNV(attr
, x
);
5942 static void GLAPIENTRY
5943 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5945 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5946 save_Attr1fNV(attr
, v
[0]);
5949 static void GLAPIENTRY
5950 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5952 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5953 save_Attr2fNV(attr
, x
, y
);
5956 static void GLAPIENTRY
5957 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5959 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5960 save_Attr2fNV(attr
, v
[0], v
[1]);
5963 static void GLAPIENTRY
5964 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5966 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5967 save_Attr3fNV(attr
, x
, y
, z
);
5970 static void GLAPIENTRY
5971 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5973 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5974 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5977 static void GLAPIENTRY
5978 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5979 GLfloat z
, GLfloat w
)
5981 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5982 save_Attr4fNV(attr
, x
, y
, z
, w
);
5985 static void GLAPIENTRY
5986 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5988 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5989 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5994 * Record a GL_INVALID_VALUE error when an invalid vertex attribute
6000 GET_CURRENT_CONTEXT(ctx
);
6001 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
6006 static void GLAPIENTRY
6007 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
6009 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6010 save_Attr1fARB(index
, x
);
6015 static void GLAPIENTRY
6016 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
6018 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6019 save_Attr1fARB(index
, v
[0]);
6024 static void GLAPIENTRY
6025 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
6027 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6028 save_Attr2fARB(index
, x
, y
);
6033 static void GLAPIENTRY
6034 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
6036 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6037 save_Attr2fARB(index
, v
[0], v
[1]);
6042 static void GLAPIENTRY
6043 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
6045 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6046 save_Attr3fARB(index
, x
, y
, z
);
6051 static void GLAPIENTRY
6052 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
6054 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6055 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
6060 static void GLAPIENTRY
6061 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
6064 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6065 save_Attr4fARB(index
, x
, y
, z
, w
);
6070 static void GLAPIENTRY
6071 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
6073 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6074 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
6079 static void GLAPIENTRY
6080 save_PrimitiveRestartNV(void)
6082 /* Note: this is used when outside a glBegin/End pair in a display list */
6083 GET_CURRENT_CONTEXT(ctx
);
6084 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6085 (void) alloc_instruction(ctx
, OPCODE_PRIMITIVE_RESTART_NV
, 0);
6086 if (ctx
->ExecuteFlag
) {
6087 CALL_PrimitiveRestartNV(ctx
->Exec
, ());
6092 static void GLAPIENTRY
6093 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
6094 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
6095 GLbitfield mask
, GLenum filter
)
6097 GET_CURRENT_CONTEXT(ctx
);
6099 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6100 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
6113 if (ctx
->ExecuteFlag
) {
6114 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
6115 dstX0
, dstY0
, dstX1
, dstY1
,
6121 /** GL_EXT_provoking_vertex */
6122 static void GLAPIENTRY
6123 save_ProvokingVertexEXT(GLenum mode
)
6125 GET_CURRENT_CONTEXT(ctx
);
6127 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6128 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
6132 if (ctx
->ExecuteFlag
) {
6133 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6134 _mesa_ProvokingVertex(mode
);
6139 /** GL_EXT_transform_feedback */
6140 static void GLAPIENTRY
6141 save_BeginTransformFeedback(GLenum mode
)
6143 GET_CURRENT_CONTEXT(ctx
);
6145 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6146 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
6150 if (ctx
->ExecuteFlag
) {
6151 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
6156 /** GL_EXT_transform_feedback */
6157 static void GLAPIENTRY
6158 save_EndTransformFeedback(void)
6160 GET_CURRENT_CONTEXT(ctx
);
6161 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6162 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
6163 if (ctx
->ExecuteFlag
) {
6164 CALL_EndTransformFeedback(ctx
->Exec
, ());
6168 static void GLAPIENTRY
6169 save_BindTransformFeedback(GLenum target
, GLuint name
)
6171 GET_CURRENT_CONTEXT(ctx
);
6173 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6174 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
6179 if (ctx
->ExecuteFlag
) {
6180 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
6184 static void GLAPIENTRY
6185 save_PauseTransformFeedback(void)
6187 GET_CURRENT_CONTEXT(ctx
);
6188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6189 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
6190 if (ctx
->ExecuteFlag
) {
6191 CALL_PauseTransformFeedback(ctx
->Exec
, ());
6195 static void GLAPIENTRY
6196 save_ResumeTransformFeedback(void)
6198 GET_CURRENT_CONTEXT(ctx
);
6199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6200 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
6201 if (ctx
->ExecuteFlag
) {
6202 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
6206 static void GLAPIENTRY
6207 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
6209 GET_CURRENT_CONTEXT(ctx
);
6211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6212 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
6217 if (ctx
->ExecuteFlag
) {
6218 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
6222 static void GLAPIENTRY
6223 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
6225 GET_CURRENT_CONTEXT(ctx
);
6227 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6228 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
6234 if (ctx
->ExecuteFlag
) {
6235 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
6239 static void GLAPIENTRY
6240 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
6243 GET_CURRENT_CONTEXT(ctx
);
6245 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6246 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
6250 n
[3].si
= primcount
;
6252 if (ctx
->ExecuteFlag
) {
6253 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
6257 static void GLAPIENTRY
6258 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
6259 GLuint stream
, GLsizei primcount
)
6261 GET_CURRENT_CONTEXT(ctx
);
6263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6264 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
6269 n
[4].si
= primcount
;
6271 if (ctx
->ExecuteFlag
) {
6272 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
6277 static void GLAPIENTRY
6278 save_UseProgram(GLuint program
)
6280 GET_CURRENT_CONTEXT(ctx
);
6282 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6283 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
6287 if (ctx
->ExecuteFlag
) {
6288 CALL_UseProgram(ctx
->Exec
, (program
));
6293 static void GLAPIENTRY
6294 save_Uniform1fARB(GLint location
, GLfloat x
)
6296 GET_CURRENT_CONTEXT(ctx
);
6298 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6299 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6304 if (ctx
->ExecuteFlag
) {
6305 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6310 static void GLAPIENTRY
6311 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6313 GET_CURRENT_CONTEXT(ctx
);
6315 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6316 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6322 if (ctx
->ExecuteFlag
) {
6323 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6328 static void GLAPIENTRY
6329 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6331 GET_CURRENT_CONTEXT(ctx
);
6333 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6334 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6341 if (ctx
->ExecuteFlag
) {
6342 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6347 static void GLAPIENTRY
6348 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6350 GET_CURRENT_CONTEXT(ctx
);
6352 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6353 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6361 if (ctx
->ExecuteFlag
) {
6362 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6367 static void GLAPIENTRY
6368 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6370 GET_CURRENT_CONTEXT(ctx
);
6372 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6373 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
6377 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6379 if (ctx
->ExecuteFlag
) {
6380 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6384 static void GLAPIENTRY
6385 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6387 GET_CURRENT_CONTEXT(ctx
);
6389 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6390 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6394 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6396 if (ctx
->ExecuteFlag
) {
6397 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6401 static void GLAPIENTRY
6402 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6404 GET_CURRENT_CONTEXT(ctx
);
6406 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6407 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6411 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6413 if (ctx
->ExecuteFlag
) {
6414 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6418 static void GLAPIENTRY
6419 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6421 GET_CURRENT_CONTEXT(ctx
);
6423 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6424 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6428 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6430 if (ctx
->ExecuteFlag
) {
6431 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6436 static void GLAPIENTRY
6437 save_Uniform1iARB(GLint location
, GLint x
)
6439 GET_CURRENT_CONTEXT(ctx
);
6441 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6442 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6447 if (ctx
->ExecuteFlag
) {
6448 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6452 static void GLAPIENTRY
6453 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6455 GET_CURRENT_CONTEXT(ctx
);
6457 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6458 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6464 if (ctx
->ExecuteFlag
) {
6465 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6469 static void GLAPIENTRY
6470 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6472 GET_CURRENT_CONTEXT(ctx
);
6474 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6475 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6482 if (ctx
->ExecuteFlag
) {
6483 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6487 static void GLAPIENTRY
6488 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6490 GET_CURRENT_CONTEXT(ctx
);
6492 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6493 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6501 if (ctx
->ExecuteFlag
) {
6502 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6508 static void GLAPIENTRY
6509 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6511 GET_CURRENT_CONTEXT(ctx
);
6513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6514 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6518 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6520 if (ctx
->ExecuteFlag
) {
6521 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6525 static void GLAPIENTRY
6526 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6528 GET_CURRENT_CONTEXT(ctx
);
6530 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6531 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6535 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6537 if (ctx
->ExecuteFlag
) {
6538 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6542 static void GLAPIENTRY
6543 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6545 GET_CURRENT_CONTEXT(ctx
);
6547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6548 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6552 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6554 if (ctx
->ExecuteFlag
) {
6555 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6559 static void GLAPIENTRY
6560 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6562 GET_CURRENT_CONTEXT(ctx
);
6564 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6565 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6569 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6571 if (ctx
->ExecuteFlag
) {
6572 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6578 static void GLAPIENTRY
6579 save_Uniform1ui(GLint location
, GLuint x
)
6581 GET_CURRENT_CONTEXT(ctx
);
6583 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6584 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6589 if (ctx
->ExecuteFlag
) {
6590 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6594 static void GLAPIENTRY
6595 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6597 GET_CURRENT_CONTEXT(ctx
);
6599 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6600 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6606 if (ctx
->ExecuteFlag
) {
6607 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6611 static void GLAPIENTRY
6612 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6614 GET_CURRENT_CONTEXT(ctx
);
6616 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6617 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6624 if (ctx
->ExecuteFlag
) {
6625 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6629 static void GLAPIENTRY
6630 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6632 GET_CURRENT_CONTEXT(ctx
);
6634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6635 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6643 if (ctx
->ExecuteFlag
) {
6644 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6650 static void GLAPIENTRY
6651 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6653 GET_CURRENT_CONTEXT(ctx
);
6655 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6656 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6660 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6662 if (ctx
->ExecuteFlag
) {
6663 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6667 static void GLAPIENTRY
6668 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6670 GET_CURRENT_CONTEXT(ctx
);
6672 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6673 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6677 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6679 if (ctx
->ExecuteFlag
) {
6680 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6684 static void GLAPIENTRY
6685 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6687 GET_CURRENT_CONTEXT(ctx
);
6689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6690 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6694 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6696 if (ctx
->ExecuteFlag
) {
6697 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6701 static void GLAPIENTRY
6702 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6704 GET_CURRENT_CONTEXT(ctx
);
6706 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6707 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6711 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6713 if (ctx
->ExecuteFlag
) {
6714 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6720 static void GLAPIENTRY
6721 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6724 GET_CURRENT_CONTEXT(ctx
);
6726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6727 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6732 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6734 if (ctx
->ExecuteFlag
) {
6735 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6739 static void GLAPIENTRY
6740 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6743 GET_CURRENT_CONTEXT(ctx
);
6745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6746 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6751 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6753 if (ctx
->ExecuteFlag
) {
6754 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6758 static void GLAPIENTRY
6759 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6762 GET_CURRENT_CONTEXT(ctx
);
6764 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6765 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6770 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6772 if (ctx
->ExecuteFlag
) {
6773 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6778 static void GLAPIENTRY
6779 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6782 GET_CURRENT_CONTEXT(ctx
);
6784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6785 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6790 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6792 if (ctx
->ExecuteFlag
) {
6793 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6797 static void GLAPIENTRY
6798 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6801 GET_CURRENT_CONTEXT(ctx
);
6803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6804 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6809 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6811 if (ctx
->ExecuteFlag
) {
6812 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6817 static void GLAPIENTRY
6818 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6821 GET_CURRENT_CONTEXT(ctx
);
6823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6824 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6829 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6831 if (ctx
->ExecuteFlag
) {
6832 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6836 static void GLAPIENTRY
6837 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6840 GET_CURRENT_CONTEXT(ctx
);
6842 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6843 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6848 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6850 if (ctx
->ExecuteFlag
) {
6851 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6856 static void GLAPIENTRY
6857 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6860 GET_CURRENT_CONTEXT(ctx
);
6862 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6863 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6868 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6870 if (ctx
->ExecuteFlag
) {
6871 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6875 static void GLAPIENTRY
6876 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6879 GET_CURRENT_CONTEXT(ctx
);
6881 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6882 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6887 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6889 if (ctx
->ExecuteFlag
) {
6890 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6894 static void GLAPIENTRY
6895 save_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
6897 GET_CURRENT_CONTEXT(ctx
);
6899 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6900 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM_STAGES
, 3);
6906 if (ctx
->ExecuteFlag
) {
6907 CALL_UseProgramStages(ctx
->Exec
, (pipeline
, stages
, program
));
6911 static void GLAPIENTRY
6912 save_ProgramUniform1f(GLuint program
, GLint location
, GLfloat x
)
6914 GET_CURRENT_CONTEXT(ctx
);
6916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6917 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1F
, 3);
6923 if (ctx
->ExecuteFlag
) {
6924 CALL_ProgramUniform1f(ctx
->Exec
, (program
, location
, x
));
6928 static void GLAPIENTRY
6929 save_ProgramUniform2f(GLuint program
, GLint location
, GLfloat x
, GLfloat y
)
6931 GET_CURRENT_CONTEXT(ctx
);
6933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6934 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2F
, 4);
6941 if (ctx
->ExecuteFlag
) {
6942 CALL_ProgramUniform2f(ctx
->Exec
, (program
, location
, x
, y
));
6946 static void GLAPIENTRY
6947 save_ProgramUniform3f(GLuint program
, GLint location
,
6948 GLfloat x
, GLfloat y
, GLfloat z
)
6950 GET_CURRENT_CONTEXT(ctx
);
6952 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6953 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3F
, 5);
6961 if (ctx
->ExecuteFlag
) {
6962 CALL_ProgramUniform3f(ctx
->Exec
, (program
, location
, x
, y
, z
));
6966 static void GLAPIENTRY
6967 save_ProgramUniform4f(GLuint program
, GLint location
,
6968 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6970 GET_CURRENT_CONTEXT(ctx
);
6972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6973 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4F
, 6);
6982 if (ctx
->ExecuteFlag
) {
6983 CALL_ProgramUniform4f(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6987 static void GLAPIENTRY
6988 save_ProgramUniform1fv(GLuint program
, GLint location
, GLsizei count
,
6991 GET_CURRENT_CONTEXT(ctx
);
6993 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6994 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1FV
, 3 + POINTER_DWORDS
);
6999 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLfloat
)));
7001 if (ctx
->ExecuteFlag
) {
7002 CALL_ProgramUniform1fv(ctx
->Exec
, (program
, location
, count
, v
));
7006 static void GLAPIENTRY
7007 save_ProgramUniform2fv(GLuint program
, GLint location
, GLsizei count
,
7010 GET_CURRENT_CONTEXT(ctx
);
7012 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7013 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2FV
, 3 + POINTER_DWORDS
);
7018 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLfloat
)));
7020 if (ctx
->ExecuteFlag
) {
7021 CALL_ProgramUniform2fv(ctx
->Exec
, (program
, location
, count
, v
));
7025 static void GLAPIENTRY
7026 save_ProgramUniform3fv(GLuint program
, GLint location
, GLsizei count
,
7029 GET_CURRENT_CONTEXT(ctx
);
7031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7032 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3FV
, 3 + POINTER_DWORDS
);
7037 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLfloat
)));
7039 if (ctx
->ExecuteFlag
) {
7040 CALL_ProgramUniform3fv(ctx
->Exec
, (program
, location
, count
, v
));
7044 static void GLAPIENTRY
7045 save_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
7048 GET_CURRENT_CONTEXT(ctx
);
7050 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7051 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4FV
, 3 + POINTER_DWORDS
);
7056 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLfloat
)));
7058 if (ctx
->ExecuteFlag
) {
7059 CALL_ProgramUniform4fv(ctx
->Exec
, (program
, location
, count
, v
));
7063 static void GLAPIENTRY
7064 save_ProgramUniform1i(GLuint program
, GLint location
, GLint x
)
7066 GET_CURRENT_CONTEXT(ctx
);
7068 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7069 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1I
, 3);
7075 if (ctx
->ExecuteFlag
) {
7076 CALL_ProgramUniform1i(ctx
->Exec
, (program
, location
, x
));
7080 static void GLAPIENTRY
7081 save_ProgramUniform2i(GLuint program
, GLint location
, GLint x
, GLint y
)
7083 GET_CURRENT_CONTEXT(ctx
);
7085 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7086 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2I
, 4);
7093 if (ctx
->ExecuteFlag
) {
7094 CALL_ProgramUniform2i(ctx
->Exec
, (program
, location
, x
, y
));
7098 static void GLAPIENTRY
7099 save_ProgramUniform3i(GLuint program
, GLint location
,
7100 GLint x
, GLint y
, GLint z
)
7102 GET_CURRENT_CONTEXT(ctx
);
7104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7105 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3I
, 5);
7113 if (ctx
->ExecuteFlag
) {
7114 CALL_ProgramUniform3i(ctx
->Exec
, (program
, location
, x
, y
, z
));
7118 static void GLAPIENTRY
7119 save_ProgramUniform4i(GLuint program
, GLint location
,
7120 GLint x
, GLint y
, GLint z
, GLint w
)
7122 GET_CURRENT_CONTEXT(ctx
);
7124 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7125 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4I
, 6);
7134 if (ctx
->ExecuteFlag
) {
7135 CALL_ProgramUniform4i(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7139 static void GLAPIENTRY
7140 save_ProgramUniform1iv(GLuint program
, GLint location
, GLsizei count
,
7143 GET_CURRENT_CONTEXT(ctx
);
7145 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7146 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1IV
, 3 + POINTER_DWORDS
);
7151 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLint
)));
7153 if (ctx
->ExecuteFlag
) {
7154 CALL_ProgramUniform1iv(ctx
->Exec
, (program
, location
, count
, v
));
7158 static void GLAPIENTRY
7159 save_ProgramUniform2iv(GLuint program
, GLint location
, GLsizei count
,
7162 GET_CURRENT_CONTEXT(ctx
);
7164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7165 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2IV
, 3 + POINTER_DWORDS
);
7170 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLint
)));
7172 if (ctx
->ExecuteFlag
) {
7173 CALL_ProgramUniform2iv(ctx
->Exec
, (program
, location
, count
, v
));
7177 static void GLAPIENTRY
7178 save_ProgramUniform3iv(GLuint program
, GLint location
, GLsizei count
,
7181 GET_CURRENT_CONTEXT(ctx
);
7183 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7184 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3IV
, 3 + POINTER_DWORDS
);
7189 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLint
)));
7191 if (ctx
->ExecuteFlag
) {
7192 CALL_ProgramUniform3iv(ctx
->Exec
, (program
, location
, count
, v
));
7196 static void GLAPIENTRY
7197 save_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
7200 GET_CURRENT_CONTEXT(ctx
);
7202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7203 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4IV
, 3 + POINTER_DWORDS
);
7208 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLint
)));
7210 if (ctx
->ExecuteFlag
) {
7211 CALL_ProgramUniform4iv(ctx
->Exec
, (program
, location
, count
, v
));
7215 static void GLAPIENTRY
7216 save_ProgramUniform1ui(GLuint program
, GLint location
, GLuint x
)
7218 GET_CURRENT_CONTEXT(ctx
);
7220 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7221 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UI
, 3);
7227 if (ctx
->ExecuteFlag
) {
7228 CALL_ProgramUniform1ui(ctx
->Exec
, (program
, location
, x
));
7232 static void GLAPIENTRY
7233 save_ProgramUniform2ui(GLuint program
, GLint location
, GLuint x
, GLuint y
)
7235 GET_CURRENT_CONTEXT(ctx
);
7237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7238 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UI
, 4);
7245 if (ctx
->ExecuteFlag
) {
7246 CALL_ProgramUniform2ui(ctx
->Exec
, (program
, location
, x
, y
));
7250 static void GLAPIENTRY
7251 save_ProgramUniform3ui(GLuint program
, GLint location
,
7252 GLuint x
, GLuint y
, GLuint z
)
7254 GET_CURRENT_CONTEXT(ctx
);
7256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7257 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UI
, 5);
7265 if (ctx
->ExecuteFlag
) {
7266 CALL_ProgramUniform3ui(ctx
->Exec
, (program
, location
, x
, y
, z
));
7270 static void GLAPIENTRY
7271 save_ProgramUniform4ui(GLuint program
, GLint location
,
7272 GLuint x
, GLuint y
, GLuint z
, GLuint w
)
7274 GET_CURRENT_CONTEXT(ctx
);
7276 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7277 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UI
, 6);
7286 if (ctx
->ExecuteFlag
) {
7287 CALL_ProgramUniform4ui(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7291 static void GLAPIENTRY
7292 save_ProgramUniform1uiv(GLuint program
, GLint location
, GLsizei count
,
7295 GET_CURRENT_CONTEXT(ctx
);
7297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7298 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UIV
, 3 + POINTER_DWORDS
);
7303 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLuint
)));
7305 if (ctx
->ExecuteFlag
) {
7306 CALL_ProgramUniform1uiv(ctx
->Exec
, (program
, location
, count
, v
));
7310 static void GLAPIENTRY
7311 save_ProgramUniform2uiv(GLuint program
, GLint location
, GLsizei count
,
7314 GET_CURRENT_CONTEXT(ctx
);
7316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7317 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UIV
, 3 + POINTER_DWORDS
);
7322 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLuint
)));
7324 if (ctx
->ExecuteFlag
) {
7325 CALL_ProgramUniform2uiv(ctx
->Exec
, (program
, location
, count
, v
));
7329 static void GLAPIENTRY
7330 save_ProgramUniform3uiv(GLuint program
, GLint location
, GLsizei count
,
7333 GET_CURRENT_CONTEXT(ctx
);
7335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7336 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UIV
, 3 + POINTER_DWORDS
);
7341 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLuint
)));
7343 if (ctx
->ExecuteFlag
) {
7344 CALL_ProgramUniform3uiv(ctx
->Exec
, (program
, location
, count
, v
));
7348 static void GLAPIENTRY
7349 save_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
7352 GET_CURRENT_CONTEXT(ctx
);
7354 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7355 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UIV
, 3 + POINTER_DWORDS
);
7360 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLuint
)));
7362 if (ctx
->ExecuteFlag
) {
7363 CALL_ProgramUniform4uiv(ctx
->Exec
, (program
, location
, count
, v
));
7367 static void GLAPIENTRY
7368 save_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
7369 GLboolean transpose
, const GLfloat
*v
)
7371 GET_CURRENT_CONTEXT(ctx
);
7373 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7374 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
7375 4 + POINTER_DWORDS
);
7381 save_pointer(&n
[5], memdup(v
, count
* 2 * 2 * sizeof(GLfloat
)));
7383 if (ctx
->ExecuteFlag
) {
7384 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
7385 (program
, location
, count
, transpose
, v
));
7389 static void GLAPIENTRY
7390 save_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
7391 GLboolean transpose
, const GLfloat
*v
)
7393 GET_CURRENT_CONTEXT(ctx
);
7395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7396 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
7397 4 + POINTER_DWORDS
);
7403 save_pointer(&n
[5], memdup(v
, count
* 2 * 3 * sizeof(GLfloat
)));
7405 if (ctx
->ExecuteFlag
) {
7406 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
7407 (program
, location
, count
, transpose
, v
));
7411 static void GLAPIENTRY
7412 save_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
7413 GLboolean transpose
, const GLfloat
*v
)
7415 GET_CURRENT_CONTEXT(ctx
);
7417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7418 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
7419 4 + POINTER_DWORDS
);
7425 save_pointer(&n
[5], memdup(v
, count
* 2 * 4 * sizeof(GLfloat
)));
7427 if (ctx
->ExecuteFlag
) {
7428 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
7429 (program
, location
, count
, transpose
, v
));
7433 static void GLAPIENTRY
7434 save_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
7435 GLboolean transpose
, const GLfloat
*v
)
7437 GET_CURRENT_CONTEXT(ctx
);
7439 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7440 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
7441 4 + POINTER_DWORDS
);
7447 save_pointer(&n
[5], memdup(v
, count
* 3 * 2 * sizeof(GLfloat
)));
7449 if (ctx
->ExecuteFlag
) {
7450 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
7451 (program
, location
, count
, transpose
, v
));
7455 static void GLAPIENTRY
7456 save_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
7457 GLboolean transpose
, const GLfloat
*v
)
7459 GET_CURRENT_CONTEXT(ctx
);
7461 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7462 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
7463 4 + POINTER_DWORDS
);
7469 save_pointer(&n
[5], memdup(v
, count
* 3 * 3 * sizeof(GLfloat
)));
7471 if (ctx
->ExecuteFlag
) {
7472 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
7473 (program
, location
, count
, transpose
, v
));
7477 static void GLAPIENTRY
7478 save_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
7479 GLboolean transpose
, const GLfloat
*v
)
7481 GET_CURRENT_CONTEXT(ctx
);
7483 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7484 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
7485 4 + POINTER_DWORDS
);
7491 save_pointer(&n
[5], memdup(v
, count
* 3 * 4 * sizeof(GLfloat
)));
7493 if (ctx
->ExecuteFlag
) {
7494 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
7495 (program
, location
, count
, transpose
, v
));
7499 static void GLAPIENTRY
7500 save_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
7501 GLboolean transpose
, const GLfloat
*v
)
7503 GET_CURRENT_CONTEXT(ctx
);
7505 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7506 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
7507 4 + POINTER_DWORDS
);
7513 save_pointer(&n
[5], memdup(v
, count
* 4 * 2 * sizeof(GLfloat
)));
7515 if (ctx
->ExecuteFlag
) {
7516 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
7517 (program
, location
, count
, transpose
, v
));
7521 static void GLAPIENTRY
7522 save_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
7523 GLboolean transpose
, const GLfloat
*v
)
7525 GET_CURRENT_CONTEXT(ctx
);
7527 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7528 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
7529 4 + POINTER_DWORDS
);
7535 save_pointer(&n
[5], memdup(v
, count
* 4 * 3 * sizeof(GLfloat
)));
7537 if (ctx
->ExecuteFlag
) {
7538 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
7539 (program
, location
, count
, transpose
, v
));
7543 static void GLAPIENTRY
7544 save_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
7545 GLboolean transpose
, const GLfloat
*v
)
7547 GET_CURRENT_CONTEXT(ctx
);
7549 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7550 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
7551 4 + POINTER_DWORDS
);
7557 save_pointer(&n
[5], memdup(v
, count
* 4 * 4 * sizeof(GLfloat
)));
7559 if (ctx
->ExecuteFlag
) {
7560 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
7561 (program
, location
, count
, transpose
, v
));
7565 static void GLAPIENTRY
7566 save_ClipControl(GLenum origin
, GLenum depth
)
7568 GET_CURRENT_CONTEXT(ctx
);
7570 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7571 n
= alloc_instruction(ctx
, OPCODE_CLIP_CONTROL
, 2);
7576 if (ctx
->ExecuteFlag
) {
7577 CALL_ClipControl(ctx
->Exec
, (origin
, depth
));
7581 static void GLAPIENTRY
7582 save_ClampColorARB(GLenum target
, GLenum clamp
)
7584 GET_CURRENT_CONTEXT(ctx
);
7586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7587 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
7592 if (ctx
->ExecuteFlag
) {
7593 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
7597 /** GL_EXT_texture_integer */
7598 static void GLAPIENTRY
7599 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
7601 GET_CURRENT_CONTEXT(ctx
);
7603 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7604 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
7611 if (ctx
->ExecuteFlag
) {
7612 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7616 /** GL_EXT_texture_integer */
7617 static void GLAPIENTRY
7618 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
7620 GET_CURRENT_CONTEXT(ctx
);
7622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7623 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
7630 if (ctx
->ExecuteFlag
) {
7631 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7635 /** GL_EXT_texture_integer */
7636 static void GLAPIENTRY
7637 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
7639 GET_CURRENT_CONTEXT(ctx
);
7641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7642 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
7651 if (ctx
->ExecuteFlag
) {
7652 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
7656 /** GL_EXT_texture_integer */
7657 static void GLAPIENTRY
7658 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
7660 GET_CURRENT_CONTEXT(ctx
);
7662 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7663 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
7667 n
[3].ui
= params
[0];
7668 n
[4].ui
= params
[1];
7669 n
[5].ui
= params
[2];
7670 n
[6].ui
= params
[3];
7672 if (ctx
->ExecuteFlag
) {
7673 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
7677 /* GL_ARB_instanced_arrays */
7678 static void GLAPIENTRY
7679 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
7681 GET_CURRENT_CONTEXT(ctx
);
7683 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7684 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
7689 if (ctx
->ExecuteFlag
) {
7690 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
7695 /* GL_NV_texture_barrier */
7696 static void GLAPIENTRY
7697 save_TextureBarrierNV(void)
7699 GET_CURRENT_CONTEXT(ctx
);
7700 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7701 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
7702 if (ctx
->ExecuteFlag
) {
7703 CALL_TextureBarrierNV(ctx
->Exec
, ());
7708 /* GL_ARB_sampler_objects */
7709 static void GLAPIENTRY
7710 save_BindSampler(GLuint unit
, GLuint sampler
)
7713 GET_CURRENT_CONTEXT(ctx
);
7714 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7715 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
7720 if (ctx
->ExecuteFlag
) {
7721 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
7725 static void GLAPIENTRY
7726 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7729 GET_CURRENT_CONTEXT(ctx
);
7730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7731 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7736 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7742 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7745 if (ctx
->ExecuteFlag
) {
7746 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7750 static void GLAPIENTRY
7751 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7755 parray
[1] = parray
[2] = parray
[3] = 0;
7756 save_SamplerParameteriv(sampler
, pname
, parray
);
7759 static void GLAPIENTRY
7760 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7763 GET_CURRENT_CONTEXT(ctx
);
7764 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7765 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7770 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7776 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7779 if (ctx
->ExecuteFlag
) {
7780 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7784 static void GLAPIENTRY
7785 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7789 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7790 save_SamplerParameterfv(sampler
, pname
, parray
);
7793 static void GLAPIENTRY
7794 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7797 GET_CURRENT_CONTEXT(ctx
);
7798 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7799 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7804 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7810 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7813 if (ctx
->ExecuteFlag
) {
7814 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7818 static void GLAPIENTRY
7819 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7822 GET_CURRENT_CONTEXT(ctx
);
7823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7824 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7828 n
[3].ui
= params
[0];
7829 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7830 n
[4].ui
= params
[1];
7831 n
[5].ui
= params
[2];
7832 n
[6].ui
= params
[3];
7835 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7838 if (ctx
->ExecuteFlag
) {
7839 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7843 static void GLAPIENTRY
7844 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7847 GET_CURRENT_CONTEXT(ctx
);
7848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7849 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7851 union uint64_pair p
;
7854 n
[2].ui
= p
.uint32
[0];
7855 n
[3].ui
= p
.uint32
[1];
7856 save_pointer(&n
[4], sync
);
7858 if (ctx
->ExecuteFlag
) {
7859 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7864 /** GL_NV_conditional_render */
7865 static void GLAPIENTRY
7866 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7868 GET_CURRENT_CONTEXT(ctx
);
7870 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7871 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7876 if (ctx
->ExecuteFlag
) {
7877 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7881 static void GLAPIENTRY
7882 save_EndConditionalRender(void)
7884 GET_CURRENT_CONTEXT(ctx
);
7885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7886 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7887 if (ctx
->ExecuteFlag
) {
7888 CALL_EndConditionalRender(ctx
->Exec
, ());
7892 static void GLAPIENTRY
7893 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7895 GET_CURRENT_CONTEXT(ctx
);
7897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7898 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7904 if (ctx
->ExecuteFlag
) {
7905 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7909 /** GL_EXT_window_rectangles */
7910 static void GLAPIENTRY
7911 save_WindowRectanglesEXT(GLenum mode
, GLsizei count
, const GLint
*box
)
7913 GET_CURRENT_CONTEXT(ctx
);
7915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7916 n
= alloc_instruction(ctx
, OPCODE_WINDOW_RECTANGLES
, 2 + POINTER_DWORDS
);
7918 GLint
*box_copy
= NULL
;
7921 box_copy
= memdup(box
, sizeof(GLint
) * 4 * count
);
7924 save_pointer(&n
[3], box_copy
);
7926 if (ctx
->ExecuteFlag
) {
7927 CALL_WindowRectanglesEXT(ctx
->Exec
, (mode
, count
, box
));
7932 * Save an error-generating command into display list.
7934 * KW: Will appear in the list before the vertex buffer containing the
7935 * command that provoked the error. I don't see this as a problem.
7938 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7941 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
7944 save_pointer(&n
[2], (void *) s
);
7945 /* note: the data/string here doesn't have to be freed in
7946 * _mesa_delete_list() since the string is never dynamically
7954 * Compile an error into current display list.
7957 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7959 if (ctx
->CompileFlag
)
7960 save_error(ctx
, error
, s
);
7961 if (ctx
->ExecuteFlag
)
7962 _mesa_error(ctx
, error
, "%s", s
);
7967 * Test if ID names a display list.
7970 islist(struct gl_context
*ctx
, GLuint list
)
7972 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
7982 /**********************************************************************/
7983 /* Display list execution */
7984 /**********************************************************************/
7988 * Execute a display list. Note that the ListBase offset must have already
7989 * been added before calling this function. I.e. the list argument is
7990 * the absolute list number, not relative to ListBase.
7991 * \param list - display list number
7994 execute_list(struct gl_context
*ctx
, GLuint list
)
7996 struct gl_display_list
*dlist
;
8000 if (list
== 0 || !islist(ctx
, list
))
8003 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
8004 /* raise an error? */
8008 dlist
= _mesa_lookup_list(ctx
, list
);
8012 ctx
->ListState
.CallDepth
++;
8014 vbo_save_BeginCallList(ctx
, dlist
);
8020 const OpCode opcode
= n
[0].opcode
;
8022 if (is_ext_opcode(opcode
)) {
8023 n
+= ext_opcode_execute(ctx
, n
);
8028 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
8031 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8033 case OPCODE_ALPHA_FUNC
:
8034 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8036 case OPCODE_BIND_TEXTURE
:
8037 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8041 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8042 ctx
->Unpack
= ctx
->DefaultPacking
;
8043 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
8044 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
8045 get_pointer(&n
[7])));
8046 ctx
->Unpack
= save
; /* restore */
8049 case OPCODE_BLEND_COLOR
:
8050 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8052 case OPCODE_BLEND_EQUATION
:
8053 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
8055 case OPCODE_BLEND_EQUATION_SEPARATE
:
8056 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8058 case OPCODE_BLEND_FUNC_SEPARATE
:
8059 CALL_BlendFuncSeparate(ctx
->Exec
,
8060 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8063 case OPCODE_BLEND_FUNC_I
:
8064 /* GL_ARB_draw_buffers_blend */
8065 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
8067 case OPCODE_BLEND_FUNC_SEPARATE_I
:
8068 /* GL_ARB_draw_buffers_blend */
8069 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
8072 case OPCODE_BLEND_EQUATION_I
:
8073 /* GL_ARB_draw_buffers_blend */
8074 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8076 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
8077 /* GL_ARB_draw_buffers_blend */
8078 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
8079 (n
[1].ui
, n
[2].e
, n
[3].e
));
8082 case OPCODE_CALL_LIST
:
8083 /* Generated by glCallList(), don't add ListBase */
8084 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
8085 execute_list(ctx
, n
[1].ui
);
8088 case OPCODE_CALL_LISTS
:
8089 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
8090 CALL_CallLists(ctx
->Exec
, (n
[1].i
, n
[2].e
, get_pointer(&n
[3])));
8094 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
8096 case OPCODE_CLEAR_BUFFER_IV
:
8103 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8106 case OPCODE_CLEAR_BUFFER_UIV
:
8113 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8116 case OPCODE_CLEAR_BUFFER_FV
:
8123 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8126 case OPCODE_CLEAR_BUFFER_FI
:
8127 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
8129 case OPCODE_CLEAR_COLOR
:
8130 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8132 case OPCODE_CLEAR_ACCUM
:
8133 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8135 case OPCODE_CLEAR_DEPTH
:
8136 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
8138 case OPCODE_CLEAR_INDEX
:
8139 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
8141 case OPCODE_CLEAR_STENCIL
:
8142 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
8144 case OPCODE_CLIP_PLANE
:
8151 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
8154 case OPCODE_COLOR_MASK
:
8155 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
8157 case OPCODE_COLOR_MASK_INDEXED
:
8158 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
8161 case OPCODE_COLOR_MATERIAL
:
8162 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8164 case OPCODE_COPY_PIXELS
:
8165 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8166 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
8169 case OPCODE_COPY_TEX_IMAGE1D
:
8170 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
8171 n
[5].i
, n
[6].i
, n
[7].i
));
8173 case OPCODE_COPY_TEX_IMAGE2D
:
8174 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
8175 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
8177 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
8178 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8179 n
[4].i
, n
[5].i
, n
[6].i
));
8181 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
8182 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8183 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8186 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
8187 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8188 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8191 case OPCODE_CULL_FACE
:
8192 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
8194 case OPCODE_DEPTH_FUNC
:
8195 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
8197 case OPCODE_DEPTH_MASK
:
8198 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
8200 case OPCODE_DEPTH_RANGE
:
8201 CALL_DepthRange(ctx
->Exec
,
8202 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
8204 case OPCODE_DISABLE
:
8205 CALL_Disable(ctx
->Exec
, (n
[1].e
));
8207 case OPCODE_DISABLE_INDEXED
:
8208 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8210 case OPCODE_DRAW_BUFFER
:
8211 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
8213 case OPCODE_DRAW_PIXELS
:
8215 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8216 ctx
->Unpack
= ctx
->DefaultPacking
;
8217 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
8218 get_pointer(&n
[5])));
8219 ctx
->Unpack
= save
; /* restore */
8223 CALL_Enable(ctx
->Exec
, (n
[1].e
));
8225 case OPCODE_ENABLE_INDEXED
:
8226 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8228 case OPCODE_EVALMESH1
:
8229 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
8231 case OPCODE_EVALMESH2
:
8232 CALL_EvalMesh2(ctx
->Exec
,
8233 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8242 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
8245 case OPCODE_FRONT_FACE
:
8246 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
8248 case OPCODE_FRUSTUM
:
8249 CALL_Frustum(ctx
->Exec
,
8250 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8253 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8255 case OPCODE_INDEX_MASK
:
8256 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
8258 case OPCODE_INIT_NAMES
:
8259 CALL_InitNames(ctx
->Exec
, ());
8268 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
8271 case OPCODE_LIGHT_MODEL
:
8278 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
8281 case OPCODE_LINE_STIPPLE
:
8282 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
8284 case OPCODE_LINE_WIDTH
:
8285 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
8287 case OPCODE_LIST_BASE
:
8288 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
8290 case OPCODE_LOAD_IDENTITY
:
8291 CALL_LoadIdentity(ctx
->Exec
, ());
8293 case OPCODE_LOAD_MATRIX
:
8294 STATIC_ASSERT(sizeof(Node
) == sizeof(GLfloat
));
8295 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
8297 case OPCODE_LOAD_NAME
:
8298 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
8300 case OPCODE_LOGIC_OP
:
8301 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
8305 GLenum target
= n
[1].e
;
8306 GLint ustride
= _mesa_evaluator_components(target
);
8307 GLint uorder
= n
[5].i
;
8308 GLfloat u1
= n
[2].f
;
8309 GLfloat u2
= n
[3].f
;
8310 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8311 (GLfloat
*) get_pointer(&n
[6])));
8316 GLenum target
= n
[1].e
;
8317 GLfloat u1
= n
[2].f
;
8318 GLfloat u2
= n
[3].f
;
8319 GLfloat v1
= n
[4].f
;
8320 GLfloat v2
= n
[5].f
;
8321 GLint ustride
= n
[6].i
;
8322 GLint vstride
= n
[7].i
;
8323 GLint uorder
= n
[8].i
;
8324 GLint vorder
= n
[9].i
;
8325 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8326 v1
, v2
, vstride
, vorder
,
8327 (GLfloat
*) get_pointer(&n
[10])));
8330 case OPCODE_MAPGRID1
:
8331 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8333 case OPCODE_MAPGRID2
:
8334 CALL_MapGrid2f(ctx
->Exec
,
8335 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
8337 case OPCODE_MATRIX_MODE
:
8338 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
8340 case OPCODE_MULT_MATRIX
:
8341 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
8344 CALL_Ortho(ctx
->Exec
,
8345 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8347 case OPCODE_PASSTHROUGH
:
8348 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
8350 case OPCODE_PIXEL_MAP
:
8351 CALL_PixelMapfv(ctx
->Exec
,
8352 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
8354 case OPCODE_PIXEL_TRANSFER
:
8355 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8357 case OPCODE_PIXEL_ZOOM
:
8358 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8360 case OPCODE_POINT_SIZE
:
8361 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
8363 case OPCODE_POINT_PARAMETERS
:
8369 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8372 case OPCODE_POLYGON_MODE
:
8373 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8375 case OPCODE_POLYGON_STIPPLE
:
8377 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8378 ctx
->Unpack
= ctx
->DefaultPacking
;
8379 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
8380 ctx
->Unpack
= save
; /* restore */
8383 case OPCODE_POLYGON_OFFSET
:
8384 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8386 case OPCODE_POLYGON_OFFSET_CLAMP
:
8387 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8389 case OPCODE_POP_ATTRIB
:
8390 CALL_PopAttrib(ctx
->Exec
, ());
8392 case OPCODE_POP_MATRIX
:
8393 CALL_PopMatrix(ctx
->Exec
, ());
8395 case OPCODE_POP_NAME
:
8396 CALL_PopName(ctx
->Exec
, ());
8398 case OPCODE_PRIORITIZE_TEXTURE
:
8399 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
8401 case OPCODE_PUSH_ATTRIB
:
8402 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
8404 case OPCODE_PUSH_MATRIX
:
8405 CALL_PushMatrix(ctx
->Exec
, ());
8407 case OPCODE_PUSH_NAME
:
8408 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
8410 case OPCODE_RASTER_POS
:
8411 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8413 case OPCODE_READ_BUFFER
:
8414 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
8417 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8420 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8422 case OPCODE_SCISSOR
:
8423 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8425 case OPCODE_SHADE_MODEL
:
8426 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
8428 case OPCODE_PROVOKING_VERTEX
:
8429 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
8431 case OPCODE_STENCIL_FUNC
:
8432 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
8434 case OPCODE_STENCIL_MASK
:
8435 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
8437 case OPCODE_STENCIL_OP
:
8438 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
8440 case OPCODE_STENCIL_FUNC_SEPARATE
:
8441 CALL_StencilFuncSeparate(ctx
->Exec
,
8442 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
8444 case OPCODE_STENCIL_MASK_SEPARATE
:
8445 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8447 case OPCODE_STENCIL_OP_SEPARATE
:
8448 CALL_StencilOpSeparate(ctx
->Exec
,
8449 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8458 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8468 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8471 case OPCODE_TEXPARAMETER
:
8478 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8481 case OPCODE_TEX_IMAGE1D
:
8483 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8484 ctx
->Unpack
= ctx
->DefaultPacking
;
8485 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
8487 n
[3].i
, /* components */
8489 n
[5].e
, /* border */
8490 n
[6].e
, /* format */
8492 get_pointer(&n
[8])));
8493 ctx
->Unpack
= save
; /* restore */
8496 case OPCODE_TEX_IMAGE2D
:
8498 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8499 ctx
->Unpack
= ctx
->DefaultPacking
;
8500 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
8502 n
[3].i
, /* components */
8504 n
[5].i
, /* height */
8505 n
[6].e
, /* border */
8506 n
[7].e
, /* format */
8508 get_pointer(&n
[9])));
8509 ctx
->Unpack
= save
; /* restore */
8512 case OPCODE_TEX_IMAGE3D
:
8514 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8515 ctx
->Unpack
= ctx
->DefaultPacking
;
8516 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
8518 n
[3].i
, /* components */
8520 n
[5].i
, /* height */
8522 n
[7].e
, /* border */
8523 n
[8].e
, /* format */
8525 get_pointer(&n
[10])));
8526 ctx
->Unpack
= save
; /* restore */
8529 case OPCODE_TEX_SUB_IMAGE1D
:
8531 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8532 ctx
->Unpack
= ctx
->DefaultPacking
;
8533 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8535 n
[6].e
, get_pointer(&n
[7])));
8536 ctx
->Unpack
= save
; /* restore */
8539 case OPCODE_TEX_SUB_IMAGE2D
:
8541 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8542 ctx
->Unpack
= ctx
->DefaultPacking
;
8543 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8545 n
[6].i
, n
[7].e
, n
[8].e
,
8546 get_pointer(&n
[9])));
8547 ctx
->Unpack
= save
; /* restore */
8550 case OPCODE_TEX_SUB_IMAGE3D
:
8552 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8553 ctx
->Unpack
= ctx
->DefaultPacking
;
8554 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8555 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8556 n
[8].i
, n
[9].e
, n
[10].e
,
8557 get_pointer(&n
[11])));
8558 ctx
->Unpack
= save
; /* restore */
8561 case OPCODE_TRANSLATE
:
8562 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8564 case OPCODE_VIEWPORT
:
8565 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8566 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8568 case OPCODE_WINDOW_POS
:
8569 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8571 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8572 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8574 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8575 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8576 n
[4].i
, n
[5].i
, n
[6].i
,
8577 get_pointer(&n
[7])));
8579 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8580 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8581 n
[4].i
, n
[5].i
, n
[6].i
,
8582 n
[7].i
, get_pointer(&n
[8])));
8584 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8585 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8586 n
[4].i
, n
[5].i
, n
[6].i
,
8588 get_pointer(&n
[9])));
8590 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8591 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8592 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8594 get_pointer(&n
[7])));
8596 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8597 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8598 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8599 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8600 get_pointer(&n
[9])));
8602 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8603 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8604 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8605 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8607 get_pointer(&n
[11])));
8609 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8610 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8612 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8613 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8615 case OPCODE_BIND_PROGRAM_ARB
: /* GL_ARB_vertex_program */
8616 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8618 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8619 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8620 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8623 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8624 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8626 case OPCODE_DEPTH_BOUNDS_EXT
:
8627 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8629 case OPCODE_PROGRAM_STRING_ARB
:
8630 CALL_ProgramStringARB(ctx
->Exec
,
8631 (n
[1].e
, n
[2].e
, n
[3].i
,
8632 get_pointer(&n
[4])));
8634 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8635 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8639 case OPCODE_BEGIN_QUERY_ARB
:
8640 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8642 case OPCODE_END_QUERY_ARB
:
8643 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8645 case OPCODE_QUERY_COUNTER
:
8646 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8648 case OPCODE_BEGIN_QUERY_INDEXED
:
8649 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8651 case OPCODE_END_QUERY_INDEXED
:
8652 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8654 case OPCODE_DRAW_BUFFERS_ARB
:
8656 GLenum buffers
[MAX_DRAW_BUFFERS
];
8657 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8658 for (i
= 0; i
< count
; i
++)
8659 buffers
[i
] = n
[2 + i
].e
;
8660 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8663 case OPCODE_BLIT_FRAMEBUFFER
:
8664 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8665 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8668 case OPCODE_PRIMITIVE_RESTART_NV
:
8669 CALL_PrimitiveRestartNV(ctx
->Exec
, ());
8672 case OPCODE_USE_PROGRAM
:
8673 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8675 case OPCODE_UNIFORM_1F
:
8676 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8678 case OPCODE_UNIFORM_2F
:
8679 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8681 case OPCODE_UNIFORM_3F
:
8682 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8684 case OPCODE_UNIFORM_4F
:
8685 CALL_Uniform4f(ctx
->Exec
,
8686 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8688 case OPCODE_UNIFORM_1FV
:
8689 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8691 case OPCODE_UNIFORM_2FV
:
8692 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8694 case OPCODE_UNIFORM_3FV
:
8695 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8697 case OPCODE_UNIFORM_4FV
:
8698 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8700 case OPCODE_UNIFORM_1I
:
8701 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8703 case OPCODE_UNIFORM_2I
:
8704 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8706 case OPCODE_UNIFORM_3I
:
8707 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8709 case OPCODE_UNIFORM_4I
:
8710 CALL_Uniform4i(ctx
->Exec
,
8711 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8713 case OPCODE_UNIFORM_1IV
:
8714 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8716 case OPCODE_UNIFORM_2IV
:
8717 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8719 case OPCODE_UNIFORM_3IV
:
8720 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8722 case OPCODE_UNIFORM_4IV
:
8723 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8725 case OPCODE_UNIFORM_1UI
:
8726 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8728 case OPCODE_UNIFORM_2UI
:
8729 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8731 case OPCODE_UNIFORM_3UI
:
8732 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8734 case OPCODE_UNIFORM_4UI
:
8735 /*CALL_Uniform4uiARB(ctx->Exec,
8736 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8739 case OPCODE_UNIFORM_1UIV
:
8740 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
8741 get_pointer(&n[3])));*/
8743 case OPCODE_UNIFORM_2UIV
:
8744 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
8745 get_pointer(&n[3])));*/
8747 case OPCODE_UNIFORM_3UIV
:
8748 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
8749 get_pointer(&n[3])));*/
8751 case OPCODE_UNIFORM_4UIV
:
8752 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
8753 get_pointer(&n[3])));*/
8755 case OPCODE_UNIFORM_MATRIX22
:
8756 CALL_UniformMatrix2fv(ctx
->Exec
,
8757 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8759 case OPCODE_UNIFORM_MATRIX33
:
8760 CALL_UniformMatrix3fv(ctx
->Exec
,
8761 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8763 case OPCODE_UNIFORM_MATRIX44
:
8764 CALL_UniformMatrix4fv(ctx
->Exec
,
8765 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8767 case OPCODE_UNIFORM_MATRIX23
:
8768 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8769 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8771 case OPCODE_UNIFORM_MATRIX32
:
8772 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8773 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8775 case OPCODE_UNIFORM_MATRIX24
:
8776 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8777 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8779 case OPCODE_UNIFORM_MATRIX42
:
8780 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8781 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8783 case OPCODE_UNIFORM_MATRIX34
:
8784 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8785 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8787 case OPCODE_UNIFORM_MATRIX43
:
8788 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8789 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8792 case OPCODE_USE_PROGRAM_STAGES
:
8793 CALL_UseProgramStages(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8795 case OPCODE_PROGRAM_UNIFORM_1F
:
8796 CALL_ProgramUniform1f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
));
8798 case OPCODE_PROGRAM_UNIFORM_2F
:
8799 CALL_ProgramUniform2f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
, n
[4].f
));
8801 case OPCODE_PROGRAM_UNIFORM_3F
:
8802 CALL_ProgramUniform3f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8803 n
[3].f
, n
[4].f
, n
[5].f
));
8805 case OPCODE_PROGRAM_UNIFORM_4F
:
8806 CALL_ProgramUniform4f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8807 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8809 case OPCODE_PROGRAM_UNIFORM_1FV
:
8810 CALL_ProgramUniform1fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8811 get_pointer(&n
[4])));
8813 case OPCODE_PROGRAM_UNIFORM_2FV
:
8814 CALL_ProgramUniform2fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8815 get_pointer(&n
[4])));
8817 case OPCODE_PROGRAM_UNIFORM_3FV
:
8818 CALL_ProgramUniform3fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8819 get_pointer(&n
[4])));
8821 case OPCODE_PROGRAM_UNIFORM_4FV
:
8822 CALL_ProgramUniform4fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8823 get_pointer(&n
[4])));
8825 case OPCODE_PROGRAM_UNIFORM_1I
:
8826 CALL_ProgramUniform1i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
));
8828 case OPCODE_PROGRAM_UNIFORM_2I
:
8829 CALL_ProgramUniform2i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].i
));
8831 case OPCODE_PROGRAM_UNIFORM_3I
:
8832 CALL_ProgramUniform3i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8833 n
[3].i
, n
[4].i
, n
[5].i
));
8835 case OPCODE_PROGRAM_UNIFORM_4I
:
8836 CALL_ProgramUniform4i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8837 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
));
8839 case OPCODE_PROGRAM_UNIFORM_1IV
:
8840 CALL_ProgramUniform1iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8841 get_pointer(&n
[4])));
8843 case OPCODE_PROGRAM_UNIFORM_2IV
:
8844 CALL_ProgramUniform2iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8845 get_pointer(&n
[4])));
8847 case OPCODE_PROGRAM_UNIFORM_3IV
:
8848 CALL_ProgramUniform3iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8849 get_pointer(&n
[4])));
8851 case OPCODE_PROGRAM_UNIFORM_4IV
:
8852 CALL_ProgramUniform4iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8853 get_pointer(&n
[4])));
8855 case OPCODE_PROGRAM_UNIFORM_1UI
:
8856 CALL_ProgramUniform1ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].ui
));
8858 case OPCODE_PROGRAM_UNIFORM_2UI
:
8859 CALL_ProgramUniform2ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8862 case OPCODE_PROGRAM_UNIFORM_3UI
:
8863 CALL_ProgramUniform3ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8864 n
[3].ui
, n
[4].ui
, n
[5].ui
));
8866 case OPCODE_PROGRAM_UNIFORM_4UI
:
8867 CALL_ProgramUniform4ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8869 n
[4].ui
, n
[5].ui
, n
[6].ui
));
8871 case OPCODE_PROGRAM_UNIFORM_1UIV
:
8872 CALL_ProgramUniform1uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8873 get_pointer(&n
[4])));
8875 case OPCODE_PROGRAM_UNIFORM_2UIV
:
8876 CALL_ProgramUniform2uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8877 get_pointer(&n
[4])));
8879 case OPCODE_PROGRAM_UNIFORM_3UIV
:
8880 CALL_ProgramUniform3uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8881 get_pointer(&n
[4])));
8883 case OPCODE_PROGRAM_UNIFORM_4UIV
:
8884 CALL_ProgramUniform4uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8885 get_pointer(&n
[4])));
8887 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
8888 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
8889 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8890 get_pointer(&n
[5])));
8892 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
8893 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
8894 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8895 get_pointer(&n
[5])));
8897 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
8898 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
8899 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8900 get_pointer(&n
[5])));
8902 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
8903 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
8904 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8905 get_pointer(&n
[5])));
8907 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
8908 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
8909 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8910 get_pointer(&n
[5])));
8912 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
8913 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
8914 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8915 get_pointer(&n
[5])));
8917 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
8918 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
8919 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8920 get_pointer(&n
[5])));
8922 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
8923 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
8924 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8925 get_pointer(&n
[5])));
8927 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
8928 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
8929 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8930 get_pointer(&n
[5])));
8933 case OPCODE_CLIP_CONTROL
:
8934 CALL_ClipControl(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8937 case OPCODE_CLAMP_COLOR
:
8938 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8941 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8942 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8944 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8945 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (n
[1].ui
, &n
[2].f
));
8947 case OPCODE_ATTR_1F_NV
:
8948 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8950 case OPCODE_ATTR_2F_NV
:
8951 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8953 case OPCODE_ATTR_3F_NV
:
8954 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8956 case OPCODE_ATTR_4F_NV
:
8957 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8959 case OPCODE_ATTR_1F_ARB
:
8960 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8962 case OPCODE_ATTR_2F_ARB
:
8963 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8965 case OPCODE_ATTR_3F_ARB
:
8966 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8968 case OPCODE_ATTR_4F_ARB
:
8969 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8971 case OPCODE_MATERIAL
:
8972 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8975 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8978 CALL_End(ctx
->Exec
, ());
8981 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8983 case OPCODE_EVAL_C1
:
8984 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8986 case OPCODE_EVAL_C2
:
8987 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8989 case OPCODE_EVAL_P1
:
8990 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8992 case OPCODE_EVAL_P2
:
8993 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8996 /* GL_EXT_texture_integer */
8997 case OPCODE_CLEARCOLOR_I
:
8998 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
9000 case OPCODE_CLEARCOLOR_UI
:
9001 CALL_ClearColorIuiEXT(ctx
->Exec
,
9002 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
9004 case OPCODE_TEXPARAMETER_I
:
9011 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
9014 case OPCODE_TEXPARAMETER_UI
:
9017 params
[0] = n
[3].ui
;
9018 params
[1] = n
[4].ui
;
9019 params
[2] = n
[5].ui
;
9020 params
[3] = n
[6].ui
;
9021 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
9025 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
9026 /* GL_ARB_instanced_arrays */
9027 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
9030 case OPCODE_TEXTURE_BARRIER_NV
:
9031 CALL_TextureBarrierNV(ctx
->Exec
, ());
9034 /* GL_EXT/ARB_transform_feedback */
9035 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
9036 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
9038 case OPCODE_END_TRANSFORM_FEEDBACK
:
9039 CALL_EndTransformFeedback(ctx
->Exec
, ());
9041 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
9042 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
9044 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
9045 CALL_PauseTransformFeedback(ctx
->Exec
, ());
9047 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
9048 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
9050 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
9051 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
9053 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
9054 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
9055 (n
[1].e
, n
[2].ui
, n
[3].ui
));
9057 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
9058 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
9059 (n
[1].e
, n
[2].ui
, n
[3].si
));
9061 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
9062 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
9063 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
9067 case OPCODE_BIND_SAMPLER
:
9068 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
9070 case OPCODE_SAMPLER_PARAMETERIV
:
9077 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9080 case OPCODE_SAMPLER_PARAMETERFV
:
9087 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9090 case OPCODE_SAMPLER_PARAMETERIIV
:
9097 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9100 case OPCODE_SAMPLER_PARAMETERUIV
:
9103 params
[0] = n
[3].ui
;
9104 params
[1] = n
[4].ui
;
9105 params
[2] = n
[5].ui
;
9106 params
[3] = n
[6].ui
;
9107 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9112 case OPCODE_WAIT_SYNC
:
9114 union uint64_pair p
;
9115 p
.uint32
[0] = n
[2].ui
;
9116 p
.uint32
[1] = n
[3].ui
;
9117 CALL_WaitSync(ctx
->Exec
,
9118 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
9122 /* GL_NV_conditional_render */
9123 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
9124 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
9126 case OPCODE_END_CONDITIONAL_RENDER
:
9127 CALL_EndConditionalRender(ctx
->Exec
, ());
9130 case OPCODE_UNIFORM_BLOCK_BINDING
:
9131 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
9134 /* GL_EXT_window_rectangles */
9135 case OPCODE_WINDOW_RECTANGLES
:
9136 CALL_WindowRectanglesEXT(
9137 ctx
->Exec
, (n
[1].e
, n
[2].si
, get_pointer(&n
[3])));
9140 case OPCODE_CONTINUE
:
9141 n
= (Node
*) get_pointer(&n
[1]);
9146 case OPCODE_END_OF_LIST
:
9152 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
9154 _mesa_problem(ctx
, "%s", msg
);
9159 /* increment n to point to next compiled command */
9160 if (opcode
!= OPCODE_CONTINUE
) {
9161 assert(InstSize
[opcode
] > 0);
9162 n
+= InstSize
[opcode
];
9167 vbo_save_EndCallList(ctx
);
9169 ctx
->ListState
.CallDepth
--;
9174 /**********************************************************************/
9176 /**********************************************************************/
9179 * Test if a display list number is valid.
9181 GLboolean GLAPIENTRY
9182 _mesa_IsList(GLuint list
)
9184 GET_CURRENT_CONTEXT(ctx
);
9185 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9186 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
9187 return islist(ctx
, list
);
9192 * Delete a sequence of consecutive display lists.
9195 _mesa_DeleteLists(GLuint list
, GLsizei range
)
9197 GET_CURRENT_CONTEXT(ctx
);
9199 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9200 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9203 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
9208 /* We may be deleting a set of bitmap lists. See if there's a
9209 * bitmap atlas to free.
9211 struct gl_bitmap_atlas
*atlas
= lookup_bitmap_atlas(ctx
, list
);
9213 _mesa_delete_bitmap_atlas(ctx
, atlas
);
9214 _mesa_HashRemove(ctx
->Shared
->BitmapAtlas
, list
);
9218 for (i
= list
; i
< list
+ range
; i
++) {
9219 destroy_list(ctx
, i
);
9225 * Return a display list number, n, such that lists n through n+range-1
9229 _mesa_GenLists(GLsizei range
)
9231 GET_CURRENT_CONTEXT(ctx
);
9233 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9234 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
9237 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
9245 * Make this an atomic operation
9247 _mesa_HashLockMutex(ctx
->Shared
->DisplayList
);
9249 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
9251 /* reserve the list IDs by with empty/dummy lists */
9253 for (i
= 0; i
< range
; i
++) {
9254 _mesa_HashInsertLocked(ctx
->Shared
->DisplayList
, base
+ i
,
9255 make_list(base
+ i
, 1));
9259 if (USE_BITMAP_ATLAS
&&
9261 ctx
->Driver
.DrawAtlasBitmaps
) {
9262 /* "range > 16" is a rough heuristic to guess when glGenLists might be
9263 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
9264 * Create the empty atlas now.
9266 struct gl_bitmap_atlas
*atlas
= lookup_bitmap_atlas(ctx
, base
);
9268 atlas
= alloc_bitmap_atlas(ctx
, base
);
9271 /* Atlas _should_ be new/empty now, but clobbering is OK */
9272 assert(atlas
->numBitmaps
== 0);
9273 atlas
->numBitmaps
= range
;
9277 _mesa_HashUnlockMutex(ctx
->Shared
->DisplayList
);
9284 * Begin a new display list.
9287 _mesa_NewList(GLuint name
, GLenum mode
)
9289 GET_CURRENT_CONTEXT(ctx
);
9291 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
9292 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9294 if (MESA_VERBOSE
& VERBOSE_API
)
9295 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
9296 _mesa_enum_to_string(mode
));
9299 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
9303 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
9304 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
9308 if (ctx
->ListState
.CurrentList
) {
9309 /* already compiling a display list */
9310 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
9314 ctx
->CompileFlag
= GL_TRUE
;
9315 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
9317 /* Reset accumulated list state */
9318 invalidate_saved_current_state( ctx
);
9320 /* Allocate new display list */
9321 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
9322 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
9323 ctx
->ListState
.CurrentPos
= 0;
9325 vbo_save_NewList(ctx
, name
, mode
);
9327 ctx
->CurrentServerDispatch
= ctx
->Save
;
9328 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9329 if (ctx
->MarshalExec
== NULL
) {
9330 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9336 * End definition of current display list.
9341 GET_CURRENT_CONTEXT(ctx
);
9342 SAVE_FLUSH_VERTICES(ctx
);
9343 FLUSH_VERTICES(ctx
, 0);
9345 if (MESA_VERBOSE
& VERBOSE_API
)
9346 _mesa_debug(ctx
, "glEndList\n");
9348 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
9349 _mesa_error(ctx
, GL_INVALID_OPERATION
,
9350 "glEndList() called inside glBegin/End");
9353 /* Check that a list is under construction */
9354 if (!ctx
->ListState
.CurrentList
) {
9355 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
9359 /* Call before emitting END_OF_LIST, in case the driver wants to
9360 * emit opcodes itself.
9362 vbo_save_EndList(ctx
);
9364 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
9368 /* Destroy old list, if any */
9369 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
9371 /* Install the new list */
9372 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
9373 ctx
->ListState
.CurrentList
->Name
,
9374 ctx
->ListState
.CurrentList
);
9377 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
9378 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
9380 ctx
->ListState
.CurrentList
= NULL
;
9381 ctx
->ListState
.CurrentBlock
= NULL
;
9382 ctx
->ListState
.CurrentPos
= 0;
9383 ctx
->ExecuteFlag
= GL_TRUE
;
9384 ctx
->CompileFlag
= GL_FALSE
;
9386 ctx
->CurrentServerDispatch
= ctx
->Exec
;
9387 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9388 if (ctx
->MarshalExec
== NULL
) {
9389 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9395 _mesa_CallList(GLuint list
)
9397 GLboolean save_compile_flag
;
9398 GET_CURRENT_CONTEXT(ctx
);
9399 FLUSH_CURRENT(ctx
, 0);
9401 if (MESA_VERBOSE
& VERBOSE_API
)
9402 _mesa_debug(ctx
, "glCallList %d\n", list
);
9405 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
9410 mesa_print_display_list( list
);
9412 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9413 * execute the display list, and restore the CompileFlag.
9415 save_compile_flag
= ctx
->CompileFlag
;
9416 if (save_compile_flag
) {
9417 ctx
->CompileFlag
= GL_FALSE
;
9420 execute_list(ctx
, list
);
9421 ctx
->CompileFlag
= save_compile_flag
;
9423 /* also restore API function pointers to point to "save" versions */
9424 if (save_compile_flag
) {
9425 ctx
->CurrentServerDispatch
= ctx
->Save
;
9426 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9427 if (ctx
->MarshalExec
== NULL
) {
9428 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9435 * Try to execute a glCallLists() command where the display lists contain
9436 * glBitmap commands with a texture atlas.
9437 * \return true for success, false otherwise
9440 render_bitmap_atlas(struct gl_context
*ctx
, GLsizei n
, GLenum type
,
9443 struct gl_bitmap_atlas
*atlas
;
9446 if (!USE_BITMAP_ATLAS
||
9447 !ctx
->Current
.RasterPosValid
||
9448 ctx
->List
.ListBase
== 0 ||
9449 type
!= GL_UNSIGNED_BYTE
||
9450 !ctx
->Driver
.DrawAtlasBitmaps
) {
9455 atlas
= lookup_bitmap_atlas(ctx
, ctx
->List
.ListBase
);
9458 /* Even if glGenLists wasn't called, we can still try to create
9461 atlas
= alloc_bitmap_atlas(ctx
, ctx
->List
.ListBase
);
9464 if (atlas
&& !atlas
->complete
&& !atlas
->incomplete
) {
9465 /* Try to build the bitmap atlas now.
9466 * If the atlas was created in glGenLists, we'll have recorded the
9467 * number of lists (bitmaps). Otherwise, take a guess at 256.
9469 if (atlas
->numBitmaps
== 0)
9470 atlas
->numBitmaps
= 256;
9471 build_bitmap_atlas(ctx
, atlas
, ctx
->List
.ListBase
);
9474 if (!atlas
|| !atlas
->complete
) {
9478 /* check that all display list IDs are in the atlas */
9479 for (i
= 0; i
< n
; i
++) {
9480 const GLubyte
*ids
= (const GLubyte
*) lists
;
9482 if (ids
[i
] >= atlas
->numBitmaps
) {
9487 ctx
->Driver
.DrawAtlasBitmaps(ctx
, atlas
, n
, (const GLubyte
*) lists
);
9494 * Execute glCallLists: call multiple display lists.
9497 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
9499 GET_CURRENT_CONTEXT(ctx
);
9501 GLboolean save_compile_flag
;
9503 if (MESA_VERBOSE
& VERBOSE_API
)
9504 _mesa_debug(ctx
, "glCallLists %d\n", n
);
9508 case GL_UNSIGNED_BYTE
:
9510 case GL_UNSIGNED_SHORT
:
9512 case GL_UNSIGNED_INT
:
9520 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
9525 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallLists(n < 0)");
9527 } else if (n
== 0 || lists
== NULL
) {
9532 if (render_bitmap_atlas(ctx
, n
, type
, lists
)) {
9536 /* Save the CompileFlag status, turn it off, execute display list,
9537 * and restore the CompileFlag.
9539 save_compile_flag
= ctx
->CompileFlag
;
9540 ctx
->CompileFlag
= GL_FALSE
;
9542 for (i
= 0; i
< n
; i
++) {
9543 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
9544 execute_list(ctx
, list
);
9547 ctx
->CompileFlag
= save_compile_flag
;
9549 /* also restore API function pointers to point to "save" versions */
9550 if (save_compile_flag
) {
9551 ctx
->CurrentServerDispatch
= ctx
->Save
;
9552 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9553 if (ctx
->MarshalExec
== NULL
) {
9554 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9561 * Set the offset added to list numbers in glCallLists.
9564 _mesa_ListBase(GLuint base
)
9566 GET_CURRENT_CONTEXT(ctx
);
9567 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9568 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9569 ctx
->List
.ListBase
= base
;
9573 * Setup the given dispatch table to point to Mesa's display list
9574 * building functions.
9576 * This does not include any of the tnl functions - they are
9577 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9581 _mesa_initialize_save_table(const struct gl_context
*ctx
)
9583 struct _glapi_table
*table
= ctx
->Save
;
9584 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
9586 /* Initially populate the dispatch table with the contents of the
9587 * normal-execution dispatch table. This lets us skip populating functions
9588 * that should be called directly instead of compiled into display lists.
9590 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
9592 _mesa_loopback_init_api_table(ctx
, table
);
9595 vbo_initialize_save_dispatch(ctx
, table
);
9598 SET_Accum(table
, save_Accum
);
9599 SET_AlphaFunc(table
, save_AlphaFunc
);
9600 SET_Bitmap(table
, save_Bitmap
);
9601 SET_BlendFunc(table
, save_BlendFunc
);
9602 SET_CallList(table
, save_CallList
);
9603 SET_CallLists(table
, save_CallLists
);
9604 SET_Clear(table
, save_Clear
);
9605 SET_ClearAccum(table
, save_ClearAccum
);
9606 SET_ClearColor(table
, save_ClearColor
);
9607 SET_ClearDepth(table
, save_ClearDepth
);
9608 SET_ClearIndex(table
, save_ClearIndex
);
9609 SET_ClearStencil(table
, save_ClearStencil
);
9610 SET_ClipPlane(table
, save_ClipPlane
);
9611 SET_ColorMask(table
, save_ColorMask
);
9612 SET_ColorMaski(table
, save_ColorMaskIndexed
);
9613 SET_ColorMaterial(table
, save_ColorMaterial
);
9614 SET_CopyPixels(table
, save_CopyPixels
);
9615 SET_CullFace(table
, save_CullFace
);
9616 SET_DepthFunc(table
, save_DepthFunc
);
9617 SET_DepthMask(table
, save_DepthMask
);
9618 SET_DepthRange(table
, save_DepthRange
);
9619 SET_Disable(table
, save_Disable
);
9620 SET_Disablei(table
, save_DisableIndexed
);
9621 SET_DrawBuffer(table
, save_DrawBuffer
);
9622 SET_DrawPixels(table
, save_DrawPixels
);
9623 SET_Enable(table
, save_Enable
);
9624 SET_Enablei(table
, save_EnableIndexed
);
9625 SET_EvalMesh1(table
, save_EvalMesh1
);
9626 SET_EvalMesh2(table
, save_EvalMesh2
);
9627 SET_Fogf(table
, save_Fogf
);
9628 SET_Fogfv(table
, save_Fogfv
);
9629 SET_Fogi(table
, save_Fogi
);
9630 SET_Fogiv(table
, save_Fogiv
);
9631 SET_FrontFace(table
, save_FrontFace
);
9632 SET_Frustum(table
, save_Frustum
);
9633 SET_Hint(table
, save_Hint
);
9634 SET_IndexMask(table
, save_IndexMask
);
9635 SET_InitNames(table
, save_InitNames
);
9636 SET_LightModelf(table
, save_LightModelf
);
9637 SET_LightModelfv(table
, save_LightModelfv
);
9638 SET_LightModeli(table
, save_LightModeli
);
9639 SET_LightModeliv(table
, save_LightModeliv
);
9640 SET_Lightf(table
, save_Lightf
);
9641 SET_Lightfv(table
, save_Lightfv
);
9642 SET_Lighti(table
, save_Lighti
);
9643 SET_Lightiv(table
, save_Lightiv
);
9644 SET_LineStipple(table
, save_LineStipple
);
9645 SET_LineWidth(table
, save_LineWidth
);
9646 SET_ListBase(table
, save_ListBase
);
9647 SET_LoadIdentity(table
, save_LoadIdentity
);
9648 SET_LoadMatrixd(table
, save_LoadMatrixd
);
9649 SET_LoadMatrixf(table
, save_LoadMatrixf
);
9650 SET_LoadName(table
, save_LoadName
);
9651 SET_LogicOp(table
, save_LogicOp
);
9652 SET_Map1d(table
, save_Map1d
);
9653 SET_Map1f(table
, save_Map1f
);
9654 SET_Map2d(table
, save_Map2d
);
9655 SET_Map2f(table
, save_Map2f
);
9656 SET_MapGrid1d(table
, save_MapGrid1d
);
9657 SET_MapGrid1f(table
, save_MapGrid1f
);
9658 SET_MapGrid2d(table
, save_MapGrid2d
);
9659 SET_MapGrid2f(table
, save_MapGrid2f
);
9660 SET_MatrixMode(table
, save_MatrixMode
);
9661 SET_MultMatrixd(table
, save_MultMatrixd
);
9662 SET_MultMatrixf(table
, save_MultMatrixf
);
9663 SET_NewList(table
, save_NewList
);
9664 SET_Ortho(table
, save_Ortho
);
9665 SET_PassThrough(table
, save_PassThrough
);
9666 SET_PixelMapfv(table
, save_PixelMapfv
);
9667 SET_PixelMapuiv(table
, save_PixelMapuiv
);
9668 SET_PixelMapusv(table
, save_PixelMapusv
);
9669 SET_PixelTransferf(table
, save_PixelTransferf
);
9670 SET_PixelTransferi(table
, save_PixelTransferi
);
9671 SET_PixelZoom(table
, save_PixelZoom
);
9672 SET_PointSize(table
, save_PointSize
);
9673 SET_PolygonMode(table
, save_PolygonMode
);
9674 SET_PolygonOffset(table
, save_PolygonOffset
);
9675 SET_PolygonStipple(table
, save_PolygonStipple
);
9676 SET_PopAttrib(table
, save_PopAttrib
);
9677 SET_PopMatrix(table
, save_PopMatrix
);
9678 SET_PopName(table
, save_PopName
);
9679 SET_PushAttrib(table
, save_PushAttrib
);
9680 SET_PushMatrix(table
, save_PushMatrix
);
9681 SET_PushName(table
, save_PushName
);
9682 SET_RasterPos2d(table
, save_RasterPos2d
);
9683 SET_RasterPos2dv(table
, save_RasterPos2dv
);
9684 SET_RasterPos2f(table
, save_RasterPos2f
);
9685 SET_RasterPos2fv(table
, save_RasterPos2fv
);
9686 SET_RasterPos2i(table
, save_RasterPos2i
);
9687 SET_RasterPos2iv(table
, save_RasterPos2iv
);
9688 SET_RasterPos2s(table
, save_RasterPos2s
);
9689 SET_RasterPos2sv(table
, save_RasterPos2sv
);
9690 SET_RasterPos3d(table
, save_RasterPos3d
);
9691 SET_RasterPos3dv(table
, save_RasterPos3dv
);
9692 SET_RasterPos3f(table
, save_RasterPos3f
);
9693 SET_RasterPos3fv(table
, save_RasterPos3fv
);
9694 SET_RasterPos3i(table
, save_RasterPos3i
);
9695 SET_RasterPos3iv(table
, save_RasterPos3iv
);
9696 SET_RasterPos3s(table
, save_RasterPos3s
);
9697 SET_RasterPos3sv(table
, save_RasterPos3sv
);
9698 SET_RasterPos4d(table
, save_RasterPos4d
);
9699 SET_RasterPos4dv(table
, save_RasterPos4dv
);
9700 SET_RasterPos4f(table
, save_RasterPos4f
);
9701 SET_RasterPos4fv(table
, save_RasterPos4fv
);
9702 SET_RasterPos4i(table
, save_RasterPos4i
);
9703 SET_RasterPos4iv(table
, save_RasterPos4iv
);
9704 SET_RasterPos4s(table
, save_RasterPos4s
);
9705 SET_RasterPos4sv(table
, save_RasterPos4sv
);
9706 SET_ReadBuffer(table
, save_ReadBuffer
);
9707 SET_Rectf(table
, save_Rectf
);
9708 SET_Rotated(table
, save_Rotated
);
9709 SET_Rotatef(table
, save_Rotatef
);
9710 SET_Scaled(table
, save_Scaled
);
9711 SET_Scalef(table
, save_Scalef
);
9712 SET_Scissor(table
, save_Scissor
);
9713 SET_ShadeModel(table
, save_ShadeModel
);
9714 SET_StencilFunc(table
, save_StencilFunc
);
9715 SET_StencilMask(table
, save_StencilMask
);
9716 SET_StencilOp(table
, save_StencilOp
);
9717 SET_TexEnvf(table
, save_TexEnvf
);
9718 SET_TexEnvfv(table
, save_TexEnvfv
);
9719 SET_TexEnvi(table
, save_TexEnvi
);
9720 SET_TexEnviv(table
, save_TexEnviv
);
9721 SET_TexGend(table
, save_TexGend
);
9722 SET_TexGendv(table
, save_TexGendv
);
9723 SET_TexGenf(table
, save_TexGenf
);
9724 SET_TexGenfv(table
, save_TexGenfv
);
9725 SET_TexGeni(table
, save_TexGeni
);
9726 SET_TexGeniv(table
, save_TexGeniv
);
9727 SET_TexImage1D(table
, save_TexImage1D
);
9728 SET_TexImage2D(table
, save_TexImage2D
);
9729 SET_TexParameterf(table
, save_TexParameterf
);
9730 SET_TexParameterfv(table
, save_TexParameterfv
);
9731 SET_TexParameteri(table
, save_TexParameteri
);
9732 SET_TexParameteriv(table
, save_TexParameteriv
);
9733 SET_Translated(table
, save_Translated
);
9734 SET_Translatef(table
, save_Translatef
);
9735 SET_Viewport(table
, save_Viewport
);
9738 SET_BindTexture(table
, save_BindTexture
);
9739 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
9740 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
9741 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
9742 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
9743 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
9744 SET_TexSubImage1D(table
, save_TexSubImage1D
);
9745 SET_TexSubImage2D(table
, save_TexSubImage2D
);
9748 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
9749 SET_TexImage3D(table
, save_TexImage3D
);
9750 SET_TexSubImage3D(table
, save_TexSubImage3D
);
9753 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
9754 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
9755 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
9757 /* ATI_separate_stencil */
9758 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
9760 /* GL_ARB_imaging */
9761 /* Not all are supported */
9762 SET_BlendColor(table
, save_BlendColor
);
9763 SET_BlendEquation(table
, save_BlendEquation
);
9765 /* 2. GL_EXT_blend_color */
9767 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9770 /* 3. GL_EXT_polygon_offset */
9771 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9773 /* 6. GL_EXT_texture3d */
9775 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9776 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9777 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9780 /* 37. GL_EXT_blend_minmax */
9782 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9785 /* 54. GL_EXT_point_parameters */
9786 SET_PointParameterf(table
, save_PointParameterfEXT
);
9787 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9789 /* 173. GL_EXT_blend_func_separate */
9790 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9792 /* 197. GL_MESA_window_pos */
9793 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9794 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9795 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9796 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9797 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9798 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9799 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9800 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9801 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9802 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9803 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9804 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9805 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9806 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9807 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9808 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9809 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9810 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9811 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9812 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9813 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9814 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9815 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9816 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9818 /* 245. GL_ATI_fragment_shader */
9819 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9820 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9822 /* 262. GL_NV_point_sprite */
9823 SET_PointParameteri(table
, save_PointParameteriNV
);
9824 SET_PointParameteriv(table
, save_PointParameterivNV
);
9826 /* 268. GL_EXT_stencil_two_side */
9827 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9829 /* ???. GL_EXT_depth_bounds_test */
9830 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9832 /* ARB 1. GL_ARB_multitexture */
9833 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9835 /* ARB 3. GL_ARB_transpose_matrix */
9836 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9837 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9838 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9839 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9841 /* ARB 5. GL_ARB_multisample */
9842 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9844 /* ARB 12. GL_ARB_texture_compression */
9845 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9846 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9847 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9848 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9849 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9850 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9852 /* ARB 14. GL_ARB_point_parameters */
9853 /* aliased with EXT_point_parameters functions */
9855 /* ARB 25. GL_ARB_window_pos */
9856 /* aliased with MESA_window_pos functions */
9858 /* ARB 26. GL_ARB_vertex_program */
9859 /* ARB 27. GL_ARB_fragment_program */
9860 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9861 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9862 SET_BindProgramARB(table
, save_BindProgramARB
);
9863 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9864 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9865 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9866 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9867 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9868 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9869 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9870 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9872 SET_BeginQuery(table
, save_BeginQueryARB
);
9873 SET_EndQuery(table
, save_EndQueryARB
);
9874 SET_QueryCounter(table
, save_QueryCounter
);
9876 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9878 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9880 SET_UseProgram(table
, save_UseProgram
);
9881 SET_Uniform1f(table
, save_Uniform1fARB
);
9882 SET_Uniform2f(table
, save_Uniform2fARB
);
9883 SET_Uniform3f(table
, save_Uniform3fARB
);
9884 SET_Uniform4f(table
, save_Uniform4fARB
);
9885 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9886 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9887 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9888 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9889 SET_Uniform1i(table
, save_Uniform1iARB
);
9890 SET_Uniform2i(table
, save_Uniform2iARB
);
9891 SET_Uniform3i(table
, save_Uniform3iARB
);
9892 SET_Uniform4i(table
, save_Uniform4iARB
);
9893 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9894 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9895 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9896 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9897 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9898 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9899 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9900 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9901 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9902 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9903 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9904 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9905 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9907 /* 299. GL_EXT_blend_equation_separate */
9908 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9910 /* GL_EXT_gpu_program_parameters */
9911 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9912 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9914 /* 364. GL_EXT_provoking_vertex */
9915 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9917 /* GL_EXT_texture_integer */
9918 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9919 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9920 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9921 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9923 /* GL_ARB_clip_control */
9924 SET_ClipControl(table
, save_ClipControl
);
9926 /* GL_ARB_color_buffer_float */
9927 SET_ClampColor(table
, save_ClampColorARB
);
9930 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9931 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9932 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9933 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9935 SET_Uniform1ui(table
, save_Uniform1ui
);
9936 SET_Uniform2ui(table
, save_Uniform2ui
);
9937 SET_Uniform3ui(table
, save_Uniform3ui
);
9938 SET_Uniform4ui(table
, save_Uniform4ui
);
9939 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9940 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9941 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9942 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9944 (void) save_Uniform1ui
;
9945 (void) save_Uniform2ui
;
9946 (void) save_Uniform3ui
;
9947 (void) save_Uniform4ui
;
9948 (void) save_Uniform1uiv
;
9949 (void) save_Uniform2uiv
;
9950 (void) save_Uniform3uiv
;
9951 (void) save_Uniform4uiv
;
9955 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9956 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9957 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9958 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9959 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9960 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9961 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9962 SET_DrawTransformFeedbackInstanced(table
,
9963 save_DrawTransformFeedbackInstanced
);
9964 SET_DrawTransformFeedbackStreamInstanced(table
,
9965 save_DrawTransformFeedbackStreamInstanced
);
9966 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9967 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9969 /* GL_ARB_instanced_arrays */
9970 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9972 /* GL_NV_texture_barrier */
9973 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9975 SET_BindSampler(table
, save_BindSampler
);
9976 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9977 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9978 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9979 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9980 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9981 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9983 /* GL_ARB_draw_buffer_blend */
9984 SET_BlendFunciARB(table
, save_BlendFunci
);
9985 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9986 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9987 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9989 /* GL_NV_conditional_render */
9990 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9991 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9994 SET_WaitSync(table
, save_WaitSync
);
9996 /* GL_ARB_uniform_buffer_object */
9997 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9999 /* GL_ARB_draw_instanced */
10000 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
10001 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
10003 /* GL_ARB_draw_elements_base_vertex */
10004 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
10006 /* GL_ARB_base_instance */
10007 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
10008 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
10009 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
10011 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
10012 SET_UseProgramStages(table
, save_UseProgramStages
);
10013 SET_ProgramUniform1f(table
, save_ProgramUniform1f
);
10014 SET_ProgramUniform2f(table
, save_ProgramUniform2f
);
10015 SET_ProgramUniform3f(table
, save_ProgramUniform3f
);
10016 SET_ProgramUniform4f(table
, save_ProgramUniform4f
);
10017 SET_ProgramUniform1fv(table
, save_ProgramUniform1fv
);
10018 SET_ProgramUniform2fv(table
, save_ProgramUniform2fv
);
10019 SET_ProgramUniform3fv(table
, save_ProgramUniform3fv
);
10020 SET_ProgramUniform4fv(table
, save_ProgramUniform4fv
);
10021 SET_ProgramUniform1i(table
, save_ProgramUniform1i
);
10022 SET_ProgramUniform2i(table
, save_ProgramUniform2i
);
10023 SET_ProgramUniform3i(table
, save_ProgramUniform3i
);
10024 SET_ProgramUniform4i(table
, save_ProgramUniform4i
);
10025 SET_ProgramUniform1iv(table
, save_ProgramUniform1iv
);
10026 SET_ProgramUniform2iv(table
, save_ProgramUniform2iv
);
10027 SET_ProgramUniform3iv(table
, save_ProgramUniform3iv
);
10028 SET_ProgramUniform4iv(table
, save_ProgramUniform4iv
);
10029 SET_ProgramUniform1ui(table
, save_ProgramUniform1ui
);
10030 SET_ProgramUniform2ui(table
, save_ProgramUniform2ui
);
10031 SET_ProgramUniform3ui(table
, save_ProgramUniform3ui
);
10032 SET_ProgramUniform4ui(table
, save_ProgramUniform4ui
);
10033 SET_ProgramUniform1uiv(table
, save_ProgramUniform1uiv
);
10034 SET_ProgramUniform2uiv(table
, save_ProgramUniform2uiv
);
10035 SET_ProgramUniform3uiv(table
, save_ProgramUniform3uiv
);
10036 SET_ProgramUniform4uiv(table
, save_ProgramUniform4uiv
);
10037 SET_ProgramUniformMatrix2fv(table
, save_ProgramUniformMatrix2fv
);
10038 SET_ProgramUniformMatrix3fv(table
, save_ProgramUniformMatrix3fv
);
10039 SET_ProgramUniformMatrix4fv(table
, save_ProgramUniformMatrix4fv
);
10040 SET_ProgramUniformMatrix2x3fv(table
, save_ProgramUniformMatrix2x3fv
);
10041 SET_ProgramUniformMatrix3x2fv(table
, save_ProgramUniformMatrix3x2fv
);
10042 SET_ProgramUniformMatrix2x4fv(table
, save_ProgramUniformMatrix2x4fv
);
10043 SET_ProgramUniformMatrix4x2fv(table
, save_ProgramUniformMatrix4x2fv
);
10044 SET_ProgramUniformMatrix3x4fv(table
, save_ProgramUniformMatrix3x4fv
);
10045 SET_ProgramUniformMatrix4x3fv(table
, save_ProgramUniformMatrix4x3fv
);
10047 /* GL_{ARB,EXT}_polygon_offset_clamp */
10048 SET_PolygonOffsetClampEXT(table
, save_PolygonOffsetClampEXT
);
10050 /* GL_EXT_window_rectangles */
10051 SET_WindowRectanglesEXT(table
, save_WindowRectanglesEXT
);
10056 static const char *
10057 enum_string(GLenum k
)
10059 return _mesa_enum_to_string(k
);
10064 * Print the commands in a display list. For debugging only.
10065 * TODO: many commands aren't handled yet.
10066 * \param fname filename to write display list to. If null, use stdout.
10068 static void GLAPIENTRY
10069 print_list(struct gl_context
*ctx
, GLuint list
, const char *fname
)
10071 struct gl_display_list
*dlist
;
10077 f
= fopen(fname
, "w");
10082 if (!islist(ctx
, list
)) {
10083 fprintf(f
, "%u is not a display list ID\n", list
);
10087 dlist
= _mesa_lookup_list(ctx
, list
);
10094 fprintf(f
, "START-LIST %u, address %p\n", list
, (void *) n
);
10096 done
= n
? GL_FALSE
: GL_TRUE
;
10098 const OpCode opcode
= n
[0].opcode
;
10100 if (is_ext_opcode(opcode
)) {
10101 n
+= ext_opcode_print(ctx
, n
, f
);
10106 fprintf(f
, "Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
10108 case OPCODE_ACTIVE_TEXTURE
:
10109 fprintf(f
, "ActiveTexture(%s)\n", enum_string(n
[1].e
));
10111 case OPCODE_BITMAP
:
10112 fprintf(f
, "Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
10113 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
10114 get_pointer(&n
[7]));
10116 case OPCODE_BLEND_COLOR
:
10117 fprintf(f
, "BlendColor %f, %f, %f, %f\n",
10118 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10120 case OPCODE_BLEND_EQUATION
:
10121 fprintf(f
, "BlendEquation %s\n",
10122 enum_string(n
[1].e
));
10124 case OPCODE_BLEND_EQUATION_SEPARATE
:
10125 fprintf(f
, "BlendEquationSeparate %s, %s\n",
10126 enum_string(n
[1].e
),
10127 enum_string(n
[2].e
));
10129 case OPCODE_BLEND_FUNC_SEPARATE
:
10130 fprintf(f
, "BlendFuncSeparate %s, %s, %s, %s\n",
10131 enum_string(n
[1].e
),
10132 enum_string(n
[2].e
),
10133 enum_string(n
[3].e
),
10134 enum_string(n
[4].e
));
10136 case OPCODE_BLEND_EQUATION_I
:
10137 fprintf(f
, "BlendEquationi %u, %s\n",
10138 n
[1].ui
, enum_string(n
[2].e
));
10140 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
10141 fprintf(f
, "BlendEquationSeparatei %u, %s, %s\n",
10142 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
10144 case OPCODE_BLEND_FUNC_I
:
10145 fprintf(f
, "BlendFunci %u, %s, %s\n",
10146 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
10148 case OPCODE_BLEND_FUNC_SEPARATE_I
:
10149 fprintf(f
, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
10151 enum_string(n
[2].e
),
10152 enum_string(n
[3].e
),
10153 enum_string(n
[4].e
),
10154 enum_string(n
[5].e
));
10156 case OPCODE_CALL_LIST
:
10157 fprintf(f
, "CallList %d\n", (int) n
[1].ui
);
10159 case OPCODE_CALL_LISTS
:
10160 fprintf(f
, "CallLists %d, %s\n", n
[1].i
, enum_string(n
[1].e
));
10162 case OPCODE_DISABLE
:
10163 fprintf(f
, "Disable %s\n", enum_string(n
[1].e
));
10165 case OPCODE_ENABLE
:
10166 fprintf(f
, "Enable %s\n", enum_string(n
[1].e
));
10168 case OPCODE_FRUSTUM
:
10169 fprintf(f
, "Frustum %g %g %g %g %g %g\n",
10170 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10172 case OPCODE_LINE_STIPPLE
:
10173 fprintf(f
, "LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
10175 case OPCODE_LINE_WIDTH
:
10176 fprintf(f
, "LineWidth %f\n", n
[1].f
);
10178 case OPCODE_LOAD_IDENTITY
:
10179 fprintf(f
, "LoadIdentity\n");
10181 case OPCODE_LOAD_MATRIX
:
10182 fprintf(f
, "LoadMatrix\n");
10183 fprintf(f
, " %8f %8f %8f %8f\n",
10184 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
10185 fprintf(f
, " %8f %8f %8f %8f\n",
10186 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
10187 fprintf(f
, " %8f %8f %8f %8f\n",
10188 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
10189 fprintf(f
, " %8f %8f %8f %8f\n",
10190 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
10192 case OPCODE_MULT_MATRIX
:
10193 fprintf(f
, "MultMatrix (or Rotate)\n");
10194 fprintf(f
, " %8f %8f %8f %8f\n",
10195 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
10196 fprintf(f
, " %8f %8f %8f %8f\n",
10197 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
10198 fprintf(f
, " %8f %8f %8f %8f\n",
10199 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
10200 fprintf(f
, " %8f %8f %8f %8f\n",
10201 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
10204 fprintf(f
, "Ortho %g %g %g %g %g %g\n",
10205 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10207 case OPCODE_POINT_SIZE
:
10208 fprintf(f
, "PointSize %f\n", n
[1].f
);
10210 case OPCODE_POP_ATTRIB
:
10211 fprintf(f
, "PopAttrib\n");
10213 case OPCODE_POP_MATRIX
:
10214 fprintf(f
, "PopMatrix\n");
10216 case OPCODE_POP_NAME
:
10217 fprintf(f
, "PopName\n");
10219 case OPCODE_PUSH_ATTRIB
:
10220 fprintf(f
, "PushAttrib %x\n", n
[1].bf
);
10222 case OPCODE_PUSH_MATRIX
:
10223 fprintf(f
, "PushMatrix\n");
10225 case OPCODE_PUSH_NAME
:
10226 fprintf(f
, "PushName %d\n", (int) n
[1].ui
);
10228 case OPCODE_RASTER_POS
:
10229 fprintf(f
, "RasterPos %g %g %g %g\n",
10230 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10232 case OPCODE_ROTATE
:
10233 fprintf(f
, "Rotate %g %g %g %g\n",
10234 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10237 fprintf(f
, "Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
10239 case OPCODE_TRANSLATE
:
10240 fprintf(f
, "Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
10242 case OPCODE_BIND_TEXTURE
:
10243 fprintf(f
, "BindTexture %s %d\n",
10244 _mesa_enum_to_string(n
[1].ui
), n
[2].ui
);
10246 case OPCODE_SHADE_MODEL
:
10247 fprintf(f
, "ShadeModel %s\n", _mesa_enum_to_string(n
[1].ui
));
10250 fprintf(f
, "Map1 %s %.3f %.3f %d %d\n",
10251 _mesa_enum_to_string(n
[1].ui
),
10252 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
10255 fprintf(f
, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
10256 _mesa_enum_to_string(n
[1].ui
),
10257 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
10258 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
10260 case OPCODE_MAPGRID1
:
10261 fprintf(f
, "MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
10263 case OPCODE_MAPGRID2
:
10264 fprintf(f
, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
10265 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
10267 case OPCODE_EVALMESH1
:
10268 fprintf(f
, "EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
10270 case OPCODE_EVALMESH2
:
10271 fprintf(f
, "EvalMesh2 %d %d %d %d\n",
10272 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
10275 case OPCODE_ATTR_1F_NV
:
10276 fprintf(f
, "ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
10278 case OPCODE_ATTR_2F_NV
:
10279 fprintf(f
, "ATTR_2F_NV attr %d: %f %f\n",
10280 n
[1].i
, n
[2].f
, n
[3].f
);
10282 case OPCODE_ATTR_3F_NV
:
10283 fprintf(f
, "ATTR_3F_NV attr %d: %f %f %f\n",
10284 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
10286 case OPCODE_ATTR_4F_NV
:
10287 fprintf(f
, "ATTR_4F_NV attr %d: %f %f %f %f\n",
10288 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
10290 case OPCODE_ATTR_1F_ARB
:
10291 fprintf(f
, "ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
10293 case OPCODE_ATTR_2F_ARB
:
10294 fprintf(f
, "ATTR_2F_ARB attr %d: %f %f\n",
10295 n
[1].i
, n
[2].f
, n
[3].f
);
10297 case OPCODE_ATTR_3F_ARB
:
10298 fprintf(f
, "ATTR_3F_ARB attr %d: %f %f %f\n",
10299 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
10301 case OPCODE_ATTR_4F_ARB
:
10302 fprintf(f
, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
10303 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
10306 case OPCODE_MATERIAL
:
10307 fprintf(f
, "MATERIAL %x %x: %f %f %f %f\n",
10308 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10311 fprintf(f
, "BEGIN %x\n", n
[1].i
);
10314 fprintf(f
, "END\n");
10317 fprintf(f
, "RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
10320 case OPCODE_EVAL_C1
:
10321 fprintf(f
, "EVAL_C1 %f\n", n
[1].f
);
10323 case OPCODE_EVAL_C2
:
10324 fprintf(f
, "EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
10326 case OPCODE_EVAL_P1
:
10327 fprintf(f
, "EVAL_P1 %d\n", n
[1].i
);
10329 case OPCODE_EVAL_P2
:
10330 fprintf(f
, "EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
10333 case OPCODE_PROVOKING_VERTEX
:
10334 fprintf(f
, "ProvokingVertex %s\n",
10335 _mesa_enum_to_string(n
[1].ui
));
10339 * meta opcodes/commands
10342 fprintf(f
, "Error: %s %s\n", enum_string(n
[1].e
),
10343 (const char *) get_pointer(&n
[2]));
10345 case OPCODE_CONTINUE
:
10346 fprintf(f
, "DISPLAY-LIST-CONTINUE\n");
10347 n
= (Node
*) get_pointer(&n
[1]);
10350 fprintf(f
, "NOP\n");
10352 case OPCODE_END_OF_LIST
:
10353 fprintf(f
, "END-LIST %u\n", list
);
10357 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
10359 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
10360 opcode
, (void *) n
);
10364 fprintf(f
, "command %d, %u operands\n", opcode
,
10368 /* increment n to point to next compiled command */
10369 if (opcode
!= OPCODE_CONTINUE
) {
10370 assert(InstSize
[opcode
] > 0);
10371 n
+= InstSize
[opcode
];
10385 * Clients may call this function to help debug display list problems.
10386 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
10387 * changed, or break in the future without notice.
10390 mesa_print_display_list(GLuint list
)
10392 GET_CURRENT_CONTEXT(ctx
);
10393 print_list(ctx
, list
, NULL
);
10397 /**********************************************************************/
10398 /***** Initialization *****/
10399 /**********************************************************************/
10402 save_vtxfmt_init(GLvertexformat
* vfmt
)
10404 vfmt
->ArrayElement
= _ae_ArrayElement
;
10406 vfmt
->Begin
= save_Begin
;
10408 vfmt
->CallList
= save_CallList
;
10409 vfmt
->CallLists
= save_CallLists
;
10411 vfmt
->Color3f
= save_Color3f
;
10412 vfmt
->Color3fv
= save_Color3fv
;
10413 vfmt
->Color4f
= save_Color4f
;
10414 vfmt
->Color4fv
= save_Color4fv
;
10415 vfmt
->EdgeFlag
= save_EdgeFlag
;
10416 vfmt
->End
= save_End
;
10418 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
10419 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
10420 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
10421 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
10422 vfmt
->EvalPoint1
= save_EvalPoint1
;
10423 vfmt
->EvalPoint2
= save_EvalPoint2
;
10425 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
10426 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
10427 vfmt
->Indexf
= save_Indexf
;
10428 vfmt
->Indexfv
= save_Indexfv
;
10429 vfmt
->Materialfv
= save_Materialfv
;
10430 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
10431 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
10432 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
10433 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
10434 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
10435 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
10436 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
10437 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
10438 vfmt
->Normal3f
= save_Normal3f
;
10439 vfmt
->Normal3fv
= save_Normal3fv
;
10440 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
10441 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
10442 vfmt
->TexCoord1f
= save_TexCoord1f
;
10443 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
10444 vfmt
->TexCoord2f
= save_TexCoord2f
;
10445 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
10446 vfmt
->TexCoord3f
= save_TexCoord3f
;
10447 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
10448 vfmt
->TexCoord4f
= save_TexCoord4f
;
10449 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
10450 vfmt
->Vertex2f
= save_Vertex2f
;
10451 vfmt
->Vertex2fv
= save_Vertex2fv
;
10452 vfmt
->Vertex3f
= save_Vertex3f
;
10453 vfmt
->Vertex3fv
= save_Vertex3fv
;
10454 vfmt
->Vertex4f
= save_Vertex4f
;
10455 vfmt
->Vertex4fv
= save_Vertex4fv
;
10456 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
10457 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
10458 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
10459 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
10460 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
10461 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
10462 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
10463 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
10465 vfmt
->PrimitiveRestartNV
= save_PrimitiveRestartNV
;
10470 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
10471 const GLvertexformat
*vfmt
)
10473 SET_CallList(disp
, vfmt
->CallList
);
10474 SET_CallLists(disp
, vfmt
->CallLists
);
10479 * Initialize display list state for given context.
10482 _mesa_init_display_list(struct gl_context
*ctx
)
10484 static GLboolean tableInitialized
= GL_FALSE
;
10486 /* zero-out the instruction size table, just once */
10487 if (!tableInitialized
) {
10488 memset(InstSize
, 0, sizeof(InstSize
));
10489 tableInitialized
= GL_TRUE
;
10492 /* extension info */
10493 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
10496 ctx
->ListState
.CallDepth
= 0;
10497 ctx
->ExecuteFlag
= GL_TRUE
;
10498 ctx
->CompileFlag
= GL_FALSE
;
10499 ctx
->ListState
.CurrentBlock
= NULL
;
10500 ctx
->ListState
.CurrentPos
= 0;
10502 /* Display List group */
10503 ctx
->List
.ListBase
= 0;
10505 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
10507 InstSize
[OPCODE_NOP
] = 1;
10512 _mesa_free_display_list_data(struct gl_context
*ctx
)
10514 free(ctx
->ListExt
);
10515 ctx
->ListExt
= NULL
;