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]));
964 n
+= InstSize
[n
[0].opcode
];
967 free(get_pointer(&n
[10]));
968 n
+= InstSize
[n
[0].opcode
];
970 case OPCODE_CALL_LISTS
:
971 free(get_pointer(&n
[3]));
972 n
+= InstSize
[n
[0].opcode
];
974 case OPCODE_DRAW_PIXELS
:
975 free(get_pointer(&n
[5]));
976 n
+= InstSize
[n
[0].opcode
];
979 free(get_pointer(&n
[7]));
980 n
+= InstSize
[n
[0].opcode
];
982 case OPCODE_POLYGON_STIPPLE
:
983 free(get_pointer(&n
[1]));
984 n
+= InstSize
[n
[0].opcode
];
986 case OPCODE_TEX_IMAGE1D
:
987 free(get_pointer(&n
[8]));
988 n
+= InstSize
[n
[0].opcode
];
990 case OPCODE_TEX_IMAGE2D
:
991 free(get_pointer(&n
[9]));
992 n
+= InstSize
[n
[0].opcode
];
994 case OPCODE_TEX_IMAGE3D
:
995 free(get_pointer(&n
[10]));
996 n
+= InstSize
[n
[0].opcode
];
998 case OPCODE_TEX_SUB_IMAGE1D
:
999 free(get_pointer(&n
[7]));
1000 n
+= InstSize
[n
[0].opcode
];
1002 case OPCODE_TEX_SUB_IMAGE2D
:
1003 free(get_pointer(&n
[9]));
1004 n
+= InstSize
[n
[0].opcode
];
1006 case OPCODE_TEX_SUB_IMAGE3D
:
1007 free(get_pointer(&n
[11]));
1008 n
+= InstSize
[n
[0].opcode
];
1010 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
1011 free(get_pointer(&n
[7]));
1012 n
+= InstSize
[n
[0].opcode
];
1014 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
1015 free(get_pointer(&n
[8]));
1016 n
+= InstSize
[n
[0].opcode
];
1018 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
1019 free(get_pointer(&n
[9]));
1020 n
+= InstSize
[n
[0].opcode
];
1022 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
1023 free(get_pointer(&n
[7]));
1024 n
+= InstSize
[n
[0].opcode
];
1026 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
1027 free(get_pointer(&n
[9]));
1028 n
+= InstSize
[n
[0].opcode
];
1030 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
1031 free(get_pointer(&n
[11]));
1032 n
+= InstSize
[n
[0].opcode
];
1034 case OPCODE_PROGRAM_STRING_ARB
:
1035 free(get_pointer(&n
[4])); /* program string */
1036 n
+= InstSize
[n
[0].opcode
];
1038 case OPCODE_UNIFORM_1FV
:
1039 case OPCODE_UNIFORM_2FV
:
1040 case OPCODE_UNIFORM_3FV
:
1041 case OPCODE_UNIFORM_4FV
:
1042 case OPCODE_UNIFORM_1IV
:
1043 case OPCODE_UNIFORM_2IV
:
1044 case OPCODE_UNIFORM_3IV
:
1045 case OPCODE_UNIFORM_4IV
:
1046 case OPCODE_UNIFORM_1UIV
:
1047 case OPCODE_UNIFORM_2UIV
:
1048 case OPCODE_UNIFORM_3UIV
:
1049 case OPCODE_UNIFORM_4UIV
:
1050 free(get_pointer(&n
[3]));
1051 n
+= InstSize
[n
[0].opcode
];
1053 case OPCODE_UNIFORM_MATRIX22
:
1054 case OPCODE_UNIFORM_MATRIX33
:
1055 case OPCODE_UNIFORM_MATRIX44
:
1056 case OPCODE_UNIFORM_MATRIX24
:
1057 case OPCODE_UNIFORM_MATRIX42
:
1058 case OPCODE_UNIFORM_MATRIX23
:
1059 case OPCODE_UNIFORM_MATRIX32
:
1060 case OPCODE_UNIFORM_MATRIX34
:
1061 case OPCODE_UNIFORM_MATRIX43
:
1062 free(get_pointer(&n
[4]));
1063 n
+= InstSize
[n
[0].opcode
];
1065 case OPCODE_PROGRAM_UNIFORM_1FV
:
1066 case OPCODE_PROGRAM_UNIFORM_2FV
:
1067 case OPCODE_PROGRAM_UNIFORM_3FV
:
1068 case OPCODE_PROGRAM_UNIFORM_4FV
:
1069 case OPCODE_PROGRAM_UNIFORM_1IV
:
1070 case OPCODE_PROGRAM_UNIFORM_2IV
:
1071 case OPCODE_PROGRAM_UNIFORM_3IV
:
1072 case OPCODE_PROGRAM_UNIFORM_4IV
:
1073 case OPCODE_PROGRAM_UNIFORM_1UIV
:
1074 case OPCODE_PROGRAM_UNIFORM_2UIV
:
1075 case OPCODE_PROGRAM_UNIFORM_3UIV
:
1076 case OPCODE_PROGRAM_UNIFORM_4UIV
:
1077 free(get_pointer(&n
[4]));
1078 n
+= InstSize
[n
[0].opcode
];
1080 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
1081 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
1082 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
1083 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
1084 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
1085 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
1086 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
1087 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
1088 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
1089 free(get_pointer(&n
[5]));
1090 n
+= InstSize
[n
[0].opcode
];
1092 case OPCODE_PIXEL_MAP
:
1093 free(get_pointer(&n
[3]));
1094 n
+= InstSize
[n
[0].opcode
];
1096 case OPCODE_WINDOW_RECTANGLES
:
1097 free(get_pointer(&n
[3]));
1098 n
+= InstSize
[n
[0].opcode
];
1100 case OPCODE_CONTINUE
:
1101 n
= (Node
*) get_pointer(&n
[1]);
1105 case OPCODE_END_OF_LIST
:
1110 /* Most frequent case */
1111 n
+= InstSize
[n
[0].opcode
];
1123 * Called by _mesa_HashWalk() to check if a display list which is being
1124 * deleted belongs to a bitmap texture atlas.
1127 check_atlas_for_deleted_list(GLuint atlas_id
, void *data
, void *userData
)
1129 struct gl_bitmap_atlas
*atlas
= (struct gl_bitmap_atlas
*) data
;
1130 GLuint list_id
= *((GLuint
*) userData
); /* the list being deleted */
1132 /* See if the list_id falls in the range contained in this texture atlas */
1133 if (atlas
->complete
&&
1134 list_id
>= atlas_id
&&
1135 list_id
< atlas_id
+ atlas
->numBitmaps
) {
1136 /* Mark the atlas as incomplete so it doesn't get used. But don't
1137 * delete it yet since we don't want to try to recreate it in the next
1140 atlas
->complete
= false;
1141 atlas
->incomplete
= true;
1147 * Destroy a display list and remove from hash table.
1148 * \param list - display list number
1151 destroy_list(struct gl_context
*ctx
, GLuint list
)
1153 struct gl_display_list
*dlist
;
1158 dlist
= _mesa_lookup_list(ctx
, list
);
1162 if (is_bitmap_list(dlist
)) {
1163 /* If we're destroying a simple glBitmap display list, there's a
1164 * chance that we're destroying a bitmap image that's in a texture
1165 * atlas. Examine all atlases to see if that's the case. There's
1166 * usually few (if any) atlases so this isn't expensive.
1168 _mesa_HashWalk(ctx
->Shared
->BitmapAtlas
,
1169 check_atlas_for_deleted_list
, &list
);
1172 _mesa_delete_list(ctx
, dlist
);
1173 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
1178 * Translate the nth element of list from <type> to GLint.
1181 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
1193 bptr
= (GLbyte
*) list
;
1194 return (GLint
) bptr
[n
];
1195 case GL_UNSIGNED_BYTE
:
1196 ubptr
= (GLubyte
*) list
;
1197 return (GLint
) ubptr
[n
];
1199 sptr
= (GLshort
*) list
;
1200 return (GLint
) sptr
[n
];
1201 case GL_UNSIGNED_SHORT
:
1202 usptr
= (GLushort
*) list
;
1203 return (GLint
) usptr
[n
];
1205 iptr
= (GLint
*) list
;
1207 case GL_UNSIGNED_INT
:
1208 uiptr
= (GLuint
*) list
;
1209 return (GLint
) uiptr
[n
];
1211 fptr
= (GLfloat
*) list
;
1212 return (GLint
) floorf(fptr
[n
]);
1214 ubptr
= ((GLubyte
*) list
) + 2 * n
;
1215 return (GLint
) ubptr
[0] * 256
1218 ubptr
= ((GLubyte
*) list
) + 3 * n
;
1219 return (GLint
) ubptr
[0] * 65536
1220 + (GLint
) ubptr
[1] * 256
1223 ubptr
= ((GLubyte
*) list
) + 4 * n
;
1224 return (GLint
) ubptr
[0] * 16777216
1225 + (GLint
) ubptr
[1] * 65536
1226 + (GLint
) ubptr
[2] * 256
1235 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1236 * If width < 0 or height < 0 or format or type are invalid we'll just
1237 * return NULL. We will not generate an error since OpenGL command
1238 * arguments aren't error-checked until the command is actually executed
1239 * (not when they're compiled).
1240 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1243 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
1244 GLsizei width
, GLsizei height
, GLsizei depth
,
1245 GLenum format
, GLenum type
, const GLvoid
* pixels
,
1246 const struct gl_pixelstore_attrib
*unpack
)
1248 if (width
<= 0 || height
<= 0) {
1252 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
1253 /* bad format and/or type */
1257 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
1261 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
1262 format
, type
, pixels
, unpack
);
1263 if (pixels
&& !image
) {
1264 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1268 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
1269 depth
, format
, type
, INT_MAX
, pixels
)) {
1270 const GLubyte
*map
, *src
;
1274 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
1275 GL_MAP_READ_BIT
, unpack
->BufferObj
,
1278 /* unable to map src buffer! */
1279 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
1283 src
= ADD_POINTERS(map
, pixels
);
1284 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
1285 format
, type
, src
, unpack
);
1287 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
, MAP_INTERNAL
);
1290 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1296 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
1301 /** Return copy of memory */
1303 memdup(const void *src
, GLsizei bytes
)
1305 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
1307 memcpy(b
, src
, bytes
);
1313 * Allocate space for a display list instruction (opcode + payload space).
1314 * \param opcode the instruction opcode (OPCODE_* value)
1315 * \param bytes instruction payload size (not counting opcode)
1316 * \param align8 does the payload need to be 8-byte aligned?
1317 * This is only relevant in 64-bit environments.
1318 * \return pointer to allocated memory (the payload will be at pointer+1)
1321 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
, bool align8
)
1323 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
1324 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
1328 if (opcode
< OPCODE_EXT_0
) {
1329 if (InstSize
[opcode
] == 0) {
1330 /* save instruction size now */
1331 InstSize
[opcode
] = numNodes
;
1334 /* make sure instruction size agrees */
1335 assert(numNodes
== InstSize
[opcode
]);
1339 if (sizeof(void *) > sizeof(Node
) && align8
1340 && ctx
->ListState
.CurrentPos
% 2 == 0) {
1341 /* The opcode would get placed at node[0] and the payload would start
1342 * at node[1]. But the payload needs to be at an even offset (8-byte
1351 if (ctx
->ListState
.CurrentPos
+ nopNode
+ numNodes
+ contNodes
1353 /* This block is full. Allocate a new block and chain to it */
1355 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1356 n
[0].opcode
= OPCODE_CONTINUE
;
1357 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
1359 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
1363 /* a fresh block should be 8-byte aligned on 64-bit systems */
1364 assert(((GLintptr
) newblock
) % sizeof(void *) == 0);
1366 save_pointer(&n
[1], newblock
);
1367 ctx
->ListState
.CurrentBlock
= newblock
;
1368 ctx
->ListState
.CurrentPos
= 0;
1370 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1371 * we have to insert a NOP so that the payload of the real opcode lands
1372 * on an even location:
1373 * node[0] = OPCODE_NOP
1374 * node[1] = OPCODE_x;
1375 * node[2] = start of payload
1377 nopNode
= sizeof(void *) > sizeof(Node
) && align8
;
1380 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1382 assert(ctx
->ListState
.CurrentPos
% 2 == 0); /* even value */
1383 n
[0].opcode
= OPCODE_NOP
;
1385 /* The "real" opcode will now be at an odd location and the payload
1386 * will be at an even location.
1389 ctx
->ListState
.CurrentPos
+= nopNode
+ numNodes
;
1391 n
[0].opcode
= opcode
;
1399 * Allocate space for a display list instruction. Used by callers outside
1400 * this file for things like VBO vertex data.
1402 * \param opcode the instruction opcode (OPCODE_* value)
1403 * \param bytes instruction size in bytes, not counting opcode.
1404 * \return pointer to the usable data area (not including the internal
1408 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1410 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, false);
1412 return n
+ 1; /* return pointer to payload area, after opcode */
1419 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1420 * aligned in 64-bit environments, 4-byte aligned otherwise.
1423 _mesa_dlist_alloc_aligned(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1425 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, true);
1427 return n
+ 1; /* return pointer to payload area, after opcode */
1434 * This function allows modules and drivers to get their own opcodes
1435 * for extending display list functionality.
1436 * \param ctx the rendering context
1437 * \param size number of bytes for storing the new display list command
1438 * \param execute function to execute the new display list command
1439 * \param destroy function to destroy the new display list command
1440 * \param print function to print the new display list command
1441 * \return the new opcode number or -1 if error
1444 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1446 void (*execute
) (struct gl_context
*, void *),
1447 void (*destroy
) (struct gl_context
*, void *),
1448 void (*print
) (struct gl_context
*, void *, FILE *))
1450 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1451 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1452 ctx
->ListExt
->Opcode
[i
].Size
=
1453 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1454 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1455 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1456 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1457 return i
+ OPCODE_EXT_0
;
1464 * Allocate space for a display list instruction. The space is basically
1465 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1466 * function parameter, node[2] is the second parameter, etc.
1468 * \param opcode one of OPCODE_x
1469 * \param nparams number of function parameters
1470 * \return pointer to start of instruction space
1472 static inline Node
*
1473 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1475 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
), false);
1480 * Called by EndList to try to reduce memory used for the list.
1483 trim_list(struct gl_context
*ctx
)
1485 /* If the list we're ending only has one allocated block of nodes/tokens
1486 * and its size isn't a full block size, realloc the block to use less
1487 * memory. This is important for apps that create many small display
1488 * lists and apps that use glXUseXFont (many lists each containing one
1490 * Note: we currently only trim display lists that allocated one block
1491 * of tokens. That hits the short list case which is what we're mainly
1492 * concerned with. Trimming longer lists would involve traversing the
1493 * linked list of blocks.
1495 struct gl_dlist_state
*list
= &ctx
->ListState
;
1497 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1498 (list
->CurrentPos
< BLOCK_SIZE
)) {
1499 /* There's only one block and it's not full, so realloc */
1500 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1501 list
->CurrentList
->Head
=
1502 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1503 if (!list
->CurrentBlock
) {
1504 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1512 * Display List compilation functions
1514 static void GLAPIENTRY
1515 save_Accum(GLenum op
, GLfloat value
)
1517 GET_CURRENT_CONTEXT(ctx
);
1519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1520 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1525 if (ctx
->ExecuteFlag
) {
1526 CALL_Accum(ctx
->Exec
, (op
, value
));
1531 static void GLAPIENTRY
1532 save_AlphaFunc(GLenum func
, GLclampf ref
)
1534 GET_CURRENT_CONTEXT(ctx
);
1536 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1537 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1540 n
[2].f
= (GLfloat
) ref
;
1542 if (ctx
->ExecuteFlag
) {
1543 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1548 static void GLAPIENTRY
1549 save_BindTexture(GLenum target
, GLuint texture
)
1551 GET_CURRENT_CONTEXT(ctx
);
1553 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1554 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1559 if (ctx
->ExecuteFlag
) {
1560 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1565 static void GLAPIENTRY
1566 save_Bitmap(GLsizei width
, GLsizei height
,
1567 GLfloat xorig
, GLfloat yorig
,
1568 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1570 GET_CURRENT_CONTEXT(ctx
);
1572 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1573 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1575 n
[1].i
= (GLint
) width
;
1576 n
[2].i
= (GLint
) height
;
1582 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1583 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1585 if (ctx
->ExecuteFlag
) {
1586 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1587 xorig
, yorig
, xmove
, ymove
, pixels
));
1592 static void GLAPIENTRY
1593 save_BlendEquation(GLenum mode
)
1595 GET_CURRENT_CONTEXT(ctx
);
1597 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1598 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1602 if (ctx
->ExecuteFlag
) {
1603 CALL_BlendEquation(ctx
->Exec
, (mode
));
1608 static void GLAPIENTRY
1609 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1611 GET_CURRENT_CONTEXT(ctx
);
1613 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1614 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1619 if (ctx
->ExecuteFlag
) {
1620 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1625 static void GLAPIENTRY
1626 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1627 GLenum sfactorA
, GLenum dfactorA
)
1629 GET_CURRENT_CONTEXT(ctx
);
1631 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1632 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1634 n
[1].e
= sfactorRGB
;
1635 n
[2].e
= dfactorRGB
;
1639 if (ctx
->ExecuteFlag
) {
1640 CALL_BlendFuncSeparate(ctx
->Exec
,
1641 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1646 static void GLAPIENTRY
1647 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1649 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1653 static void GLAPIENTRY
1654 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1656 GET_CURRENT_CONTEXT(ctx
);
1658 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1659 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1666 if (ctx
->ExecuteFlag
) {
1667 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1671 /* GL_ARB_draw_buffers_blend */
1672 static void GLAPIENTRY
1673 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1674 GLenum sfactorA
, GLenum dfactorA
)
1676 GET_CURRENT_CONTEXT(ctx
);
1678 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1679 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1682 n
[2].e
= sfactorRGB
;
1683 n
[3].e
= dfactorRGB
;
1687 if (ctx
->ExecuteFlag
) {
1688 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1689 sfactorA
, dfactorA
));
1693 /* GL_ARB_draw_buffers_blend */
1694 static void GLAPIENTRY
1695 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1697 GET_CURRENT_CONTEXT(ctx
);
1699 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1700 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_I
, 3);
1706 if (ctx
->ExecuteFlag
) {
1707 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1711 /* GL_ARB_draw_buffers_blend */
1712 static void GLAPIENTRY
1713 save_BlendEquationi(GLuint buf
, GLenum mode
)
1715 GET_CURRENT_CONTEXT(ctx
);
1717 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1718 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1723 if (ctx
->ExecuteFlag
) {
1724 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1728 /* GL_ARB_draw_buffers_blend */
1729 static void GLAPIENTRY
1730 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1732 GET_CURRENT_CONTEXT(ctx
);
1734 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1735 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1741 if (ctx
->ExecuteFlag
) {
1742 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1747 /* GL_ARB_draw_instanced. */
1748 static void GLAPIENTRY
1749 save_DrawArraysInstancedARB(UNUSED GLenum mode
,
1751 UNUSED GLsizei count
,
1752 UNUSED GLsizei primcount
)
1754 GET_CURRENT_CONTEXT(ctx
);
1755 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1756 "glDrawArraysInstanced() during display list compile");
1759 static void GLAPIENTRY
1760 save_DrawElementsInstancedARB(UNUSED GLenum mode
,
1761 UNUSED GLsizei count
,
1763 UNUSED
const GLvoid
*indices
,
1764 UNUSED GLsizei primcount
)
1766 GET_CURRENT_CONTEXT(ctx
);
1767 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1768 "glDrawElementsInstanced() during display list compile");
1771 static void GLAPIENTRY
1772 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode
,
1773 UNUSED GLsizei count
,
1775 UNUSED
const GLvoid
*indices
,
1776 UNUSED GLsizei primcount
,
1777 UNUSED GLint basevertex
)
1779 GET_CURRENT_CONTEXT(ctx
);
1780 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1781 "glDrawElementsInstancedBaseVertex() during display list compile");
1784 /* GL_ARB_base_instance. */
1785 static void GLAPIENTRY
1786 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode
,
1788 UNUSED GLsizei count
,
1789 UNUSED GLsizei primcount
,
1790 UNUSED GLuint baseinstance
)
1792 GET_CURRENT_CONTEXT(ctx
);
1793 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1794 "glDrawArraysInstancedBaseInstance() during display list compile");
1797 static void APIENTRY
1798 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode
,
1799 UNUSED GLsizei count
,
1801 UNUSED
const void *indices
,
1802 UNUSED GLsizei primcount
,
1803 UNUSED GLuint baseinstance
)
1805 GET_CURRENT_CONTEXT(ctx
);
1806 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1807 "glDrawElementsInstancedBaseInstance() during display list compile");
1810 static void APIENTRY
1811 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode
,
1812 UNUSED GLsizei count
,
1814 UNUSED
const void *indices
,
1815 UNUSED GLsizei primcount
,
1816 UNUSED GLint basevertex
,
1817 UNUSED GLuint baseinstance
)
1819 GET_CURRENT_CONTEXT(ctx
);
1820 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1821 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1826 * While building a display list we cache some OpenGL state.
1827 * Under some circumstances we need to invalidate that state (immediately
1828 * when we start compiling a list, or after glCallList(s)).
1831 invalidate_saved_current_state(struct gl_context
*ctx
)
1835 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1836 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1838 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1839 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1841 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1843 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1847 static void GLAPIENTRY
1848 save_CallList(GLuint list
)
1850 GET_CURRENT_CONTEXT(ctx
);
1852 SAVE_FLUSH_VERTICES(ctx
);
1854 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1859 /* After this, we don't know what state we're in. Invalidate all
1860 * cached information previously gathered:
1862 invalidate_saved_current_state( ctx
);
1864 if (ctx
->ExecuteFlag
) {
1865 _mesa_CallList(list
);
1870 static void GLAPIENTRY
1871 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1873 GET_CURRENT_CONTEXT(ctx
);
1878 SAVE_FLUSH_VERTICES(ctx
);
1882 case GL_UNSIGNED_BYTE
:
1886 case GL_UNSIGNED_SHORT
:
1894 case GL_UNSIGNED_INT
:
1903 if (num
> 0 && type_size
> 0) {
1904 /* create a copy of the array of list IDs to save in the display list */
1905 lists_copy
= memdup(lists
, num
* type_size
);
1910 n
= alloc_instruction(ctx
, OPCODE_CALL_LISTS
, 2 + POINTER_DWORDS
);
1914 save_pointer(&n
[3], lists_copy
);
1917 /* After this, we don't know what state we're in. Invalidate all
1918 * cached information previously gathered:
1920 invalidate_saved_current_state( ctx
);
1922 if (ctx
->ExecuteFlag
) {
1923 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1928 static void GLAPIENTRY
1929 save_Clear(GLbitfield mask
)
1931 GET_CURRENT_CONTEXT(ctx
);
1933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1934 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1938 if (ctx
->ExecuteFlag
) {
1939 CALL_Clear(ctx
->Exec
, (mask
));
1944 static void GLAPIENTRY
1945 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1947 GET_CURRENT_CONTEXT(ctx
);
1949 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1950 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1953 n
[2].i
= drawbuffer
;
1955 if (buffer
== GL_COLOR
) {
1966 if (ctx
->ExecuteFlag
) {
1967 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1972 static void GLAPIENTRY
1973 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1975 GET_CURRENT_CONTEXT(ctx
);
1977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1978 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1981 n
[2].i
= drawbuffer
;
1983 if (buffer
== GL_COLOR
) {
1994 if (ctx
->ExecuteFlag
) {
1995 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
2000 static void GLAPIENTRY
2001 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
2003 GET_CURRENT_CONTEXT(ctx
);
2005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2006 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
2009 n
[2].i
= drawbuffer
;
2011 if (buffer
== GL_COLOR
) {
2022 if (ctx
->ExecuteFlag
) {
2023 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
2028 static void GLAPIENTRY
2029 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
2030 GLfloat depth
, GLint stencil
)
2032 GET_CURRENT_CONTEXT(ctx
);
2034 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2035 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
2038 n
[2].i
= drawbuffer
;
2042 if (ctx
->ExecuteFlag
) {
2043 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
2048 static void GLAPIENTRY
2049 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
2051 GET_CURRENT_CONTEXT(ctx
);
2053 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2054 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
2061 if (ctx
->ExecuteFlag
) {
2062 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
2067 static void GLAPIENTRY
2068 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
2070 GET_CURRENT_CONTEXT(ctx
);
2072 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2073 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
2080 if (ctx
->ExecuteFlag
) {
2081 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
2086 static void GLAPIENTRY
2087 save_ClearDepth(GLclampd depth
)
2089 GET_CURRENT_CONTEXT(ctx
);
2091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2092 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
2094 n
[1].f
= (GLfloat
) depth
;
2096 if (ctx
->ExecuteFlag
) {
2097 CALL_ClearDepth(ctx
->Exec
, (depth
));
2102 static void GLAPIENTRY
2103 save_ClearIndex(GLfloat c
)
2105 GET_CURRENT_CONTEXT(ctx
);
2107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2108 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
2112 if (ctx
->ExecuteFlag
) {
2113 CALL_ClearIndex(ctx
->Exec
, (c
));
2118 static void GLAPIENTRY
2119 save_ClearStencil(GLint s
)
2121 GET_CURRENT_CONTEXT(ctx
);
2123 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2124 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
2128 if (ctx
->ExecuteFlag
) {
2129 CALL_ClearStencil(ctx
->Exec
, (s
));
2134 static void GLAPIENTRY
2135 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
2137 GET_CURRENT_CONTEXT(ctx
);
2139 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2140 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
2143 n
[2].f
= (GLfloat
) equ
[0];
2144 n
[3].f
= (GLfloat
) equ
[1];
2145 n
[4].f
= (GLfloat
) equ
[2];
2146 n
[5].f
= (GLfloat
) equ
[3];
2148 if (ctx
->ExecuteFlag
) {
2149 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
2155 static void GLAPIENTRY
2156 save_ColorMask(GLboolean red
, GLboolean green
,
2157 GLboolean blue
, GLboolean alpha
)
2159 GET_CURRENT_CONTEXT(ctx
);
2161 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2162 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
2169 if (ctx
->ExecuteFlag
) {
2170 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
2175 static void GLAPIENTRY
2176 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
2177 GLboolean blue
, GLboolean alpha
)
2179 GET_CURRENT_CONTEXT(ctx
);
2181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2182 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
2190 if (ctx
->ExecuteFlag
) {
2191 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2196 static void GLAPIENTRY
2197 save_ColorMaterial(GLenum face
, GLenum mode
)
2199 GET_CURRENT_CONTEXT(ctx
);
2201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2203 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
2208 if (ctx
->ExecuteFlag
) {
2209 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
2214 static void GLAPIENTRY
2215 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
2217 GET_CURRENT_CONTEXT(ctx
);
2219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2220 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
2224 n
[3].i
= (GLint
) width
;
2225 n
[4].i
= (GLint
) height
;
2228 if (ctx
->ExecuteFlag
) {
2229 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
2235 static void GLAPIENTRY
2236 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
2237 GLint x
, GLint y
, GLsizei width
, GLint border
)
2239 GET_CURRENT_CONTEXT(ctx
);
2241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2242 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
2246 n
[3].e
= internalformat
;
2252 if (ctx
->ExecuteFlag
) {
2253 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
2254 x
, y
, width
, border
));
2259 static void GLAPIENTRY
2260 save_CopyTexImage2D(GLenum target
, GLint level
,
2261 GLenum internalformat
,
2262 GLint x
, GLint y
, GLsizei width
,
2263 GLsizei height
, GLint border
)
2265 GET_CURRENT_CONTEXT(ctx
);
2267 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2268 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
2272 n
[3].e
= internalformat
;
2279 if (ctx
->ExecuteFlag
) {
2280 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
2281 x
, y
, width
, height
, border
));
2287 static void GLAPIENTRY
2288 save_CopyTexSubImage1D(GLenum target
, GLint level
,
2289 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
2291 GET_CURRENT_CONTEXT(ctx
);
2293 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2294 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
2303 if (ctx
->ExecuteFlag
) {
2304 CALL_CopyTexSubImage1D(ctx
->Exec
,
2305 (target
, level
, xoffset
, x
, y
, width
));
2310 static void GLAPIENTRY
2311 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2312 GLint xoffset
, GLint yoffset
,
2313 GLint x
, GLint y
, GLsizei width
, GLint height
)
2315 GET_CURRENT_CONTEXT(ctx
);
2317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2318 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2329 if (ctx
->ExecuteFlag
) {
2330 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2331 x
, y
, width
, height
));
2336 static void GLAPIENTRY
2337 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2338 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2339 GLint x
, GLint y
, GLsizei width
, GLint height
)
2341 GET_CURRENT_CONTEXT(ctx
);
2343 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2344 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2356 if (ctx
->ExecuteFlag
) {
2357 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2358 xoffset
, yoffset
, zoffset
,
2359 x
, y
, width
, height
));
2364 static void GLAPIENTRY
2365 save_CullFace(GLenum mode
)
2367 GET_CURRENT_CONTEXT(ctx
);
2369 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2370 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2374 if (ctx
->ExecuteFlag
) {
2375 CALL_CullFace(ctx
->Exec
, (mode
));
2380 static void GLAPIENTRY
2381 save_DepthFunc(GLenum func
)
2383 GET_CURRENT_CONTEXT(ctx
);
2385 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2386 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2390 if (ctx
->ExecuteFlag
) {
2391 CALL_DepthFunc(ctx
->Exec
, (func
));
2396 static void GLAPIENTRY
2397 save_DepthMask(GLboolean mask
)
2399 GET_CURRENT_CONTEXT(ctx
);
2401 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2402 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2406 if (ctx
->ExecuteFlag
) {
2407 CALL_DepthMask(ctx
->Exec
, (mask
));
2412 static void GLAPIENTRY
2413 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2415 GET_CURRENT_CONTEXT(ctx
);
2417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2418 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2420 n
[1].f
= (GLfloat
) nearval
;
2421 n
[2].f
= (GLfloat
) farval
;
2423 if (ctx
->ExecuteFlag
) {
2424 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2429 static void GLAPIENTRY
2430 save_Disable(GLenum cap
)
2432 GET_CURRENT_CONTEXT(ctx
);
2434 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2435 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2439 if (ctx
->ExecuteFlag
) {
2440 CALL_Disable(ctx
->Exec
, (cap
));
2445 static void GLAPIENTRY
2446 save_DisableIndexed(GLuint index
, GLenum cap
)
2448 GET_CURRENT_CONTEXT(ctx
);
2450 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2451 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2456 if (ctx
->ExecuteFlag
) {
2457 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2462 static void GLAPIENTRY
2463 save_DrawBuffer(GLenum mode
)
2465 GET_CURRENT_CONTEXT(ctx
);
2467 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2468 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2472 if (ctx
->ExecuteFlag
) {
2473 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2478 static void GLAPIENTRY
2479 save_DrawPixels(GLsizei width
, GLsizei height
,
2480 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2482 GET_CURRENT_CONTEXT(ctx
);
2485 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2487 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2494 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2495 pixels
, &ctx
->Unpack
));
2497 if (ctx
->ExecuteFlag
) {
2498 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2504 static void GLAPIENTRY
2505 save_Enable(GLenum cap
)
2507 GET_CURRENT_CONTEXT(ctx
);
2509 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2510 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2514 if (ctx
->ExecuteFlag
) {
2515 CALL_Enable(ctx
->Exec
, (cap
));
2521 static void GLAPIENTRY
2522 save_EnableIndexed(GLuint index
, GLenum cap
)
2524 GET_CURRENT_CONTEXT(ctx
);
2526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2527 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2532 if (ctx
->ExecuteFlag
) {
2533 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2539 static void GLAPIENTRY
2540 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2542 GET_CURRENT_CONTEXT(ctx
);
2544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2545 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2551 if (ctx
->ExecuteFlag
) {
2552 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2557 static void GLAPIENTRY
2558 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2560 GET_CURRENT_CONTEXT(ctx
);
2562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2563 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2571 if (ctx
->ExecuteFlag
) {
2572 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2579 static void GLAPIENTRY
2580 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2582 GET_CURRENT_CONTEXT(ctx
);
2584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2585 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2593 if (ctx
->ExecuteFlag
) {
2594 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2599 static void GLAPIENTRY
2600 save_Fogf(GLenum pname
, GLfloat param
)
2604 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2605 save_Fogfv(pname
, parray
);
2609 static void GLAPIENTRY
2610 save_Fogiv(GLenum pname
, const GLint
*params
)
2615 case GL_FOG_DENSITY
:
2619 p
[0] = (GLfloat
) *params
;
2625 p
[0] = INT_TO_FLOAT(params
[0]);
2626 p
[1] = INT_TO_FLOAT(params
[1]);
2627 p
[2] = INT_TO_FLOAT(params
[2]);
2628 p
[3] = INT_TO_FLOAT(params
[3]);
2631 /* Error will be caught later in gl_Fogfv */
2632 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2634 save_Fogfv(pname
, p
);
2638 static void GLAPIENTRY
2639 save_Fogi(GLenum pname
, GLint param
)
2643 parray
[1] = parray
[2] = parray
[3] = 0;
2644 save_Fogiv(pname
, parray
);
2648 static void GLAPIENTRY
2649 save_FrontFace(GLenum mode
)
2651 GET_CURRENT_CONTEXT(ctx
);
2653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2654 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2658 if (ctx
->ExecuteFlag
) {
2659 CALL_FrontFace(ctx
->Exec
, (mode
));
2664 static void GLAPIENTRY
2665 save_Frustum(GLdouble left
, GLdouble right
,
2666 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2668 GET_CURRENT_CONTEXT(ctx
);
2670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2671 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2673 n
[1].f
= (GLfloat
) left
;
2674 n
[2].f
= (GLfloat
) right
;
2675 n
[3].f
= (GLfloat
) bottom
;
2676 n
[4].f
= (GLfloat
) top
;
2677 n
[5].f
= (GLfloat
) nearval
;
2678 n
[6].f
= (GLfloat
) farval
;
2680 if (ctx
->ExecuteFlag
) {
2681 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2686 static void GLAPIENTRY
2687 save_Hint(GLenum target
, GLenum mode
)
2689 GET_CURRENT_CONTEXT(ctx
);
2691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2692 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2697 if (ctx
->ExecuteFlag
) {
2698 CALL_Hint(ctx
->Exec
, (target
, mode
));
2703 static void GLAPIENTRY
2704 save_IndexMask(GLuint mask
)
2706 GET_CURRENT_CONTEXT(ctx
);
2708 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2709 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2713 if (ctx
->ExecuteFlag
) {
2714 CALL_IndexMask(ctx
->Exec
, (mask
));
2719 static void GLAPIENTRY
2720 save_InitNames(void)
2722 GET_CURRENT_CONTEXT(ctx
);
2723 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2724 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2725 if (ctx
->ExecuteFlag
) {
2726 CALL_InitNames(ctx
->Exec
, ());
2731 static void GLAPIENTRY
2732 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2734 GET_CURRENT_CONTEXT(ctx
);
2736 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2737 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2755 case GL_SPOT_DIRECTION
:
2758 case GL_SPOT_EXPONENT
:
2761 case GL_SPOT_CUTOFF
:
2764 case GL_CONSTANT_ATTENUATION
:
2767 case GL_LINEAR_ATTENUATION
:
2770 case GL_QUADRATIC_ATTENUATION
:
2776 for (i
= 0; i
< nParams
; i
++) {
2777 n
[3 + i
].f
= params
[i
];
2780 if (ctx
->ExecuteFlag
) {
2781 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2786 static void GLAPIENTRY
2787 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2791 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2792 save_Lightfv(light
, pname
, parray
);
2796 static void GLAPIENTRY
2797 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2804 fparam
[0] = INT_TO_FLOAT(params
[0]);
2805 fparam
[1] = INT_TO_FLOAT(params
[1]);
2806 fparam
[2] = INT_TO_FLOAT(params
[2]);
2807 fparam
[3] = INT_TO_FLOAT(params
[3]);
2810 fparam
[0] = (GLfloat
) params
[0];
2811 fparam
[1] = (GLfloat
) params
[1];
2812 fparam
[2] = (GLfloat
) params
[2];
2813 fparam
[3] = (GLfloat
) params
[3];
2815 case GL_SPOT_DIRECTION
:
2816 fparam
[0] = (GLfloat
) params
[0];
2817 fparam
[1] = (GLfloat
) params
[1];
2818 fparam
[2] = (GLfloat
) params
[2];
2820 case GL_SPOT_EXPONENT
:
2821 case GL_SPOT_CUTOFF
:
2822 case GL_CONSTANT_ATTENUATION
:
2823 case GL_LINEAR_ATTENUATION
:
2824 case GL_QUADRATIC_ATTENUATION
:
2825 fparam
[0] = (GLfloat
) params
[0];
2828 /* error will be caught later in gl_Lightfv */
2831 save_Lightfv(light
, pname
, fparam
);
2835 static void GLAPIENTRY
2836 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2840 parray
[1] = parray
[2] = parray
[3] = 0;
2841 save_Lightiv(light
, pname
, parray
);
2845 static void GLAPIENTRY
2846 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2848 GET_CURRENT_CONTEXT(ctx
);
2850 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2851 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2859 if (ctx
->ExecuteFlag
) {
2860 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2865 static void GLAPIENTRY
2866 save_LightModelf(GLenum pname
, GLfloat param
)
2870 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2871 save_LightModelfv(pname
, parray
);
2875 static void GLAPIENTRY
2876 save_LightModeliv(GLenum pname
, const GLint
*params
)
2880 case GL_LIGHT_MODEL_AMBIENT
:
2881 fparam
[0] = INT_TO_FLOAT(params
[0]);
2882 fparam
[1] = INT_TO_FLOAT(params
[1]);
2883 fparam
[2] = INT_TO_FLOAT(params
[2]);
2884 fparam
[3] = INT_TO_FLOAT(params
[3]);
2886 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2887 case GL_LIGHT_MODEL_TWO_SIDE
:
2888 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2889 fparam
[0] = (GLfloat
) params
[0];
2895 /* Error will be caught later in gl_LightModelfv */
2896 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2898 save_LightModelfv(pname
, fparam
);
2902 static void GLAPIENTRY
2903 save_LightModeli(GLenum pname
, GLint param
)
2907 parray
[1] = parray
[2] = parray
[3] = 0;
2908 save_LightModeliv(pname
, parray
);
2912 static void GLAPIENTRY
2913 save_LineStipple(GLint factor
, GLushort pattern
)
2915 GET_CURRENT_CONTEXT(ctx
);
2917 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2918 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2923 if (ctx
->ExecuteFlag
) {
2924 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2929 static void GLAPIENTRY
2930 save_LineWidth(GLfloat width
)
2932 GET_CURRENT_CONTEXT(ctx
);
2934 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2935 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2939 if (ctx
->ExecuteFlag
) {
2940 CALL_LineWidth(ctx
->Exec
, (width
));
2945 static void GLAPIENTRY
2946 save_ListBase(GLuint base
)
2948 GET_CURRENT_CONTEXT(ctx
);
2950 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2951 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2955 if (ctx
->ExecuteFlag
) {
2956 CALL_ListBase(ctx
->Exec
, (base
));
2961 static void GLAPIENTRY
2962 save_LoadIdentity(void)
2964 GET_CURRENT_CONTEXT(ctx
);
2965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2966 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2967 if (ctx
->ExecuteFlag
) {
2968 CALL_LoadIdentity(ctx
->Exec
, ());
2973 static void GLAPIENTRY
2974 save_LoadMatrixf(const GLfloat
* m
)
2976 GET_CURRENT_CONTEXT(ctx
);
2978 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2979 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2982 for (i
= 0; i
< 16; i
++) {
2986 if (ctx
->ExecuteFlag
) {
2987 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2992 static void GLAPIENTRY
2993 save_LoadMatrixd(const GLdouble
* m
)
2997 for (i
= 0; i
< 16; i
++) {
2998 f
[i
] = (GLfloat
) m
[i
];
3000 save_LoadMatrixf(f
);
3004 static void GLAPIENTRY
3005 save_LoadName(GLuint name
)
3007 GET_CURRENT_CONTEXT(ctx
);
3009 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3010 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
3014 if (ctx
->ExecuteFlag
) {
3015 CALL_LoadName(ctx
->Exec
, (name
));
3020 static void GLAPIENTRY
3021 save_LogicOp(GLenum opcode
)
3023 GET_CURRENT_CONTEXT(ctx
);
3025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3026 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
3030 if (ctx
->ExecuteFlag
) {
3031 CALL_LogicOp(ctx
->Exec
, (opcode
));
3036 static void GLAPIENTRY
3037 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
3038 GLint order
, const GLdouble
* points
)
3040 GET_CURRENT_CONTEXT(ctx
);
3042 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3043 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
3045 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
3047 n
[2].f
= (GLfloat
) u1
;
3048 n
[3].f
= (GLfloat
) u2
;
3049 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
3051 save_pointer(&n
[6], pnts
);
3053 if (ctx
->ExecuteFlag
) {
3054 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
3058 static void GLAPIENTRY
3059 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
3060 GLint order
, const GLfloat
* points
)
3062 GET_CURRENT_CONTEXT(ctx
);
3064 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3065 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
3067 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
3071 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
3073 save_pointer(&n
[6], pnts
);
3075 if (ctx
->ExecuteFlag
) {
3076 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
3081 static void GLAPIENTRY
3082 save_Map2d(GLenum target
,
3083 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
3084 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
3085 const GLdouble
* points
)
3087 GET_CURRENT_CONTEXT(ctx
);
3089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3090 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
3092 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
3093 vstride
, vorder
, points
);
3095 n
[2].f
= (GLfloat
) u1
;
3096 n
[3].f
= (GLfloat
) u2
;
3097 n
[4].f
= (GLfloat
) v1
;
3098 n
[5].f
= (GLfloat
) v2
;
3099 /* XXX verify these strides are correct */
3100 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
3101 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
3104 save_pointer(&n
[10], pnts
);
3106 if (ctx
->ExecuteFlag
) {
3107 CALL_Map2d(ctx
->Exec
, (target
,
3108 u1
, u2
, ustride
, uorder
,
3109 v1
, v2
, vstride
, vorder
, points
));
3114 static void GLAPIENTRY
3115 save_Map2f(GLenum target
,
3116 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
3117 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
3118 const GLfloat
* points
)
3120 GET_CURRENT_CONTEXT(ctx
);
3122 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3123 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
3125 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
3126 vstride
, vorder
, points
);
3132 /* XXX verify these strides are correct */
3133 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
3134 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
3137 save_pointer(&n
[10], pnts
);
3139 if (ctx
->ExecuteFlag
) {
3140 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
3141 v1
, v2
, vstride
, vorder
, points
));
3146 static void GLAPIENTRY
3147 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
3149 GET_CURRENT_CONTEXT(ctx
);
3151 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3152 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
3158 if (ctx
->ExecuteFlag
) {
3159 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
3164 static void GLAPIENTRY
3165 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
3167 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
3171 static void GLAPIENTRY
3172 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
3173 GLint vn
, GLfloat v1
, GLfloat v2
)
3175 GET_CURRENT_CONTEXT(ctx
);
3177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3178 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
3187 if (ctx
->ExecuteFlag
) {
3188 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
3194 static void GLAPIENTRY
3195 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
3196 GLint vn
, GLdouble v1
, GLdouble v2
)
3198 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
3199 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
3203 static void GLAPIENTRY
3204 save_MatrixMode(GLenum mode
)
3206 GET_CURRENT_CONTEXT(ctx
);
3208 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3209 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
3213 if (ctx
->ExecuteFlag
) {
3214 CALL_MatrixMode(ctx
->Exec
, (mode
));
3219 static void GLAPIENTRY
3220 save_MultMatrixf(const GLfloat
* m
)
3222 GET_CURRENT_CONTEXT(ctx
);
3224 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3225 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
3228 for (i
= 0; i
< 16; i
++) {
3232 if (ctx
->ExecuteFlag
) {
3233 CALL_MultMatrixf(ctx
->Exec
, (m
));
3238 static void GLAPIENTRY
3239 save_MultMatrixd(const GLdouble
* m
)
3243 for (i
= 0; i
< 16; i
++) {
3244 f
[i
] = (GLfloat
) m
[i
];
3246 save_MultMatrixf(f
);
3250 static void GLAPIENTRY
3251 save_NewList(GLuint name
, GLenum mode
)
3253 GET_CURRENT_CONTEXT(ctx
);
3254 /* It's an error to call this function while building a display list */
3255 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
3262 static void GLAPIENTRY
3263 save_Ortho(GLdouble left
, GLdouble right
,
3264 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
3266 GET_CURRENT_CONTEXT(ctx
);
3268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3269 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
3271 n
[1].f
= (GLfloat
) left
;
3272 n
[2].f
= (GLfloat
) right
;
3273 n
[3].f
= (GLfloat
) bottom
;
3274 n
[4].f
= (GLfloat
) top
;
3275 n
[5].f
= (GLfloat
) nearval
;
3276 n
[6].f
= (GLfloat
) farval
;
3278 if (ctx
->ExecuteFlag
) {
3279 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
3284 static void GLAPIENTRY
3285 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
3287 GET_CURRENT_CONTEXT(ctx
);
3289 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3290 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
3294 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
3296 if (ctx
->ExecuteFlag
) {
3297 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
3302 static void GLAPIENTRY
3303 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*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
] = UINT_TO_FLOAT(values
[i
]);
3317 save_PixelMapfv(map
, mapsize
, fvalues
);
3321 static void GLAPIENTRY
3322 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3324 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3326 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3327 for (i
= 0; i
< mapsize
; i
++) {
3328 fvalues
[i
] = (GLfloat
) values
[i
];
3332 for (i
= 0; i
< mapsize
; i
++) {
3333 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3336 save_PixelMapfv(map
, mapsize
, fvalues
);
3340 static void GLAPIENTRY
3341 save_PixelTransferf(GLenum pname
, GLfloat param
)
3343 GET_CURRENT_CONTEXT(ctx
);
3345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3346 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3351 if (ctx
->ExecuteFlag
) {
3352 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3357 static void GLAPIENTRY
3358 save_PixelTransferi(GLenum pname
, GLint param
)
3360 save_PixelTransferf(pname
, (GLfloat
) param
);
3364 static void GLAPIENTRY
3365 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3367 GET_CURRENT_CONTEXT(ctx
);
3369 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3370 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3375 if (ctx
->ExecuteFlag
) {
3376 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3381 static void GLAPIENTRY
3382 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3384 GET_CURRENT_CONTEXT(ctx
);
3386 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3387 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3394 if (ctx
->ExecuteFlag
) {
3395 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3400 static void GLAPIENTRY
3401 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3405 parray
[1] = parray
[2] = 0.0F
;
3406 save_PointParameterfvEXT(pname
, parray
);
3409 static void GLAPIENTRY
3410 save_PointParameteriNV(GLenum pname
, GLint param
)
3413 parray
[0] = (GLfloat
) param
;
3414 parray
[1] = parray
[2] = 0.0F
;
3415 save_PointParameterfvEXT(pname
, parray
);
3418 static void GLAPIENTRY
3419 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3422 parray
[0] = (GLfloat
) param
[0];
3423 parray
[1] = parray
[2] = 0.0F
;
3424 save_PointParameterfvEXT(pname
, parray
);
3428 static void GLAPIENTRY
3429 save_PointSize(GLfloat size
)
3431 GET_CURRENT_CONTEXT(ctx
);
3433 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3434 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3438 if (ctx
->ExecuteFlag
) {
3439 CALL_PointSize(ctx
->Exec
, (size
));
3444 static void GLAPIENTRY
3445 save_PolygonMode(GLenum face
, GLenum mode
)
3447 GET_CURRENT_CONTEXT(ctx
);
3449 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3450 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3455 if (ctx
->ExecuteFlag
) {
3456 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3461 static void GLAPIENTRY
3462 save_PolygonStipple(const GLubyte
* pattern
)
3464 GET_CURRENT_CONTEXT(ctx
);
3467 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3469 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3472 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3473 pattern
, &ctx
->Unpack
));
3475 if (ctx
->ExecuteFlag
) {
3476 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3481 static void GLAPIENTRY
3482 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3484 GET_CURRENT_CONTEXT(ctx
);
3486 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3487 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3492 if (ctx
->ExecuteFlag
) {
3493 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3498 static void GLAPIENTRY
3499 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3501 GET_CURRENT_CONTEXT(ctx
);
3502 /* XXX mult by DepthMaxF here??? */
3503 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3506 static void GLAPIENTRY
3507 save_PolygonOffsetClampEXT(GLfloat factor
, GLfloat units
, GLfloat clamp
)
3509 GET_CURRENT_CONTEXT(ctx
);
3511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3512 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET_CLAMP
, 3);
3518 if (ctx
->ExecuteFlag
) {
3519 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (factor
, units
, clamp
));
3523 static void GLAPIENTRY
3524 save_PopAttrib(void)
3526 GET_CURRENT_CONTEXT(ctx
);
3527 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3528 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3529 if (ctx
->ExecuteFlag
) {
3530 CALL_PopAttrib(ctx
->Exec
, ());
3535 static void GLAPIENTRY
3536 save_PopMatrix(void)
3538 GET_CURRENT_CONTEXT(ctx
);
3539 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3540 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3541 if (ctx
->ExecuteFlag
) {
3542 CALL_PopMatrix(ctx
->Exec
, ());
3547 static void GLAPIENTRY
3550 GET_CURRENT_CONTEXT(ctx
);
3551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3552 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3553 if (ctx
->ExecuteFlag
) {
3554 CALL_PopName(ctx
->Exec
, ());
3559 static void GLAPIENTRY
3560 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3561 const GLclampf
* priorities
)
3563 GET_CURRENT_CONTEXT(ctx
);
3565 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3567 for (i
= 0; i
< num
; i
++) {
3569 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3571 n
[1].ui
= textures
[i
];
3572 n
[2].f
= priorities
[i
];
3575 if (ctx
->ExecuteFlag
) {
3576 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3581 static void GLAPIENTRY
3582 save_PushAttrib(GLbitfield mask
)
3584 GET_CURRENT_CONTEXT(ctx
);
3586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3587 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3591 if (ctx
->ExecuteFlag
) {
3592 CALL_PushAttrib(ctx
->Exec
, (mask
));
3597 static void GLAPIENTRY
3598 save_PushMatrix(void)
3600 GET_CURRENT_CONTEXT(ctx
);
3601 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3602 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3603 if (ctx
->ExecuteFlag
) {
3604 CALL_PushMatrix(ctx
->Exec
, ());
3609 static void GLAPIENTRY
3610 save_PushName(GLuint name
)
3612 GET_CURRENT_CONTEXT(ctx
);
3614 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3615 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3619 if (ctx
->ExecuteFlag
) {
3620 CALL_PushName(ctx
->Exec
, (name
));
3625 static void GLAPIENTRY
3626 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3628 GET_CURRENT_CONTEXT(ctx
);
3630 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3631 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3638 if (ctx
->ExecuteFlag
) {
3639 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3643 static void GLAPIENTRY
3644 save_RasterPos2d(GLdouble x
, GLdouble y
)
3646 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3649 static void GLAPIENTRY
3650 save_RasterPos2f(GLfloat x
, GLfloat y
)
3652 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3655 static void GLAPIENTRY
3656 save_RasterPos2i(GLint x
, GLint y
)
3658 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3661 static void GLAPIENTRY
3662 save_RasterPos2s(GLshort x
, GLshort y
)
3664 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3667 static void GLAPIENTRY
3668 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3670 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3673 static void GLAPIENTRY
3674 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3676 save_RasterPos4f(x
, y
, z
, 1.0F
);
3679 static void GLAPIENTRY
3680 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3682 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3685 static void GLAPIENTRY
3686 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3688 save_RasterPos4f(x
, y
, z
, 1.0F
);
3691 static void GLAPIENTRY
3692 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3694 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3697 static void GLAPIENTRY
3698 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3700 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3703 static void GLAPIENTRY
3704 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3706 save_RasterPos4f(x
, y
, z
, w
);
3709 static void GLAPIENTRY
3710 save_RasterPos2dv(const GLdouble
* v
)
3712 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3715 static void GLAPIENTRY
3716 save_RasterPos2fv(const GLfloat
* v
)
3718 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3721 static void GLAPIENTRY
3722 save_RasterPos2iv(const GLint
* v
)
3724 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3727 static void GLAPIENTRY
3728 save_RasterPos2sv(const GLshort
* v
)
3730 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3733 static void GLAPIENTRY
3734 save_RasterPos3dv(const GLdouble
* v
)
3736 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3739 static void GLAPIENTRY
3740 save_RasterPos3fv(const GLfloat
* v
)
3742 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3745 static void GLAPIENTRY
3746 save_RasterPos3iv(const GLint
* v
)
3748 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3751 static void GLAPIENTRY
3752 save_RasterPos3sv(const GLshort
* v
)
3754 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3757 static void GLAPIENTRY
3758 save_RasterPos4dv(const GLdouble
* v
)
3760 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3761 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3764 static void GLAPIENTRY
3765 save_RasterPos4fv(const GLfloat
* v
)
3767 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3770 static void GLAPIENTRY
3771 save_RasterPos4iv(const GLint
* v
)
3773 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3774 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3777 static void GLAPIENTRY
3778 save_RasterPos4sv(const GLshort
* v
)
3780 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3784 static void GLAPIENTRY
3785 save_PassThrough(GLfloat token
)
3787 GET_CURRENT_CONTEXT(ctx
);
3789 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3790 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3794 if (ctx
->ExecuteFlag
) {
3795 CALL_PassThrough(ctx
->Exec
, (token
));
3800 static void GLAPIENTRY
3801 save_ReadBuffer(GLenum mode
)
3803 GET_CURRENT_CONTEXT(ctx
);
3805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3806 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3810 if (ctx
->ExecuteFlag
) {
3811 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3816 static void GLAPIENTRY
3817 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3819 GET_CURRENT_CONTEXT(ctx
);
3821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3822 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3829 if (ctx
->ExecuteFlag
) {
3830 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3835 static void GLAPIENTRY
3836 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3838 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3842 static void GLAPIENTRY
3843 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3845 GET_CURRENT_CONTEXT(ctx
);
3847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3848 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3854 if (ctx
->ExecuteFlag
) {
3855 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3860 static void GLAPIENTRY
3861 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3863 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3867 static void GLAPIENTRY
3868 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3870 GET_CURRENT_CONTEXT(ctx
);
3872 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3873 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3880 if (ctx
->ExecuteFlag
) {
3881 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3886 static void GLAPIENTRY
3887 save_ShadeModel(GLenum mode
)
3889 GET_CURRENT_CONTEXT(ctx
);
3891 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3893 if (ctx
->ExecuteFlag
) {
3894 CALL_ShadeModel(ctx
->Exec
, (mode
));
3897 /* Don't compile this call if it's a no-op.
3898 * By avoiding this state change we have a better chance of
3899 * coalescing subsequent drawing commands into one batch.
3901 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3904 SAVE_FLUSH_VERTICES(ctx
);
3906 ctx
->ListState
.Current
.ShadeModel
= mode
;
3908 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3915 static void GLAPIENTRY
3916 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3918 GET_CURRENT_CONTEXT(ctx
);
3920 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3921 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3927 if (ctx
->ExecuteFlag
) {
3928 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3933 static void GLAPIENTRY
3934 save_StencilMask(GLuint mask
)
3936 GET_CURRENT_CONTEXT(ctx
);
3938 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3939 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3943 if (ctx
->ExecuteFlag
) {
3944 CALL_StencilMask(ctx
->Exec
, (mask
));
3949 static void GLAPIENTRY
3950 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3952 GET_CURRENT_CONTEXT(ctx
);
3954 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3955 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3961 if (ctx
->ExecuteFlag
) {
3962 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3967 static void GLAPIENTRY
3968 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3970 GET_CURRENT_CONTEXT(ctx
);
3972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3973 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3980 if (ctx
->ExecuteFlag
) {
3981 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3986 static void GLAPIENTRY
3987 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3990 GET_CURRENT_CONTEXT(ctx
);
3992 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3994 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
4002 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
4009 if (ctx
->ExecuteFlag
) {
4010 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
4011 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
4016 static void GLAPIENTRY
4017 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
4019 GET_CURRENT_CONTEXT(ctx
);
4021 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4022 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
4027 if (ctx
->ExecuteFlag
) {
4028 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
4033 static void GLAPIENTRY
4034 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
4036 GET_CURRENT_CONTEXT(ctx
);
4038 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4039 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
4046 if (ctx
->ExecuteFlag
) {
4047 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
4052 static void GLAPIENTRY
4053 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4055 GET_CURRENT_CONTEXT(ctx
);
4057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4058 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
4062 if (pname
== GL_TEXTURE_ENV_COLOR
) {
4070 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
4073 if (ctx
->ExecuteFlag
) {
4074 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
4079 static void GLAPIENTRY
4080 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
4083 parray
[0] = (GLfloat
) param
;
4084 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4085 save_TexEnvfv(target
, pname
, parray
);
4089 static void GLAPIENTRY
4090 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
4093 p
[0] = (GLfloat
) param
;
4094 p
[1] = p
[2] = p
[3] = 0.0F
;
4095 save_TexEnvfv(target
, pname
, p
);
4099 static void GLAPIENTRY
4100 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
4103 if (pname
== GL_TEXTURE_ENV_COLOR
) {
4104 p
[0] = INT_TO_FLOAT(param
[0]);
4105 p
[1] = INT_TO_FLOAT(param
[1]);
4106 p
[2] = INT_TO_FLOAT(param
[2]);
4107 p
[3] = INT_TO_FLOAT(param
[3]);
4110 p
[0] = (GLfloat
) param
[0];
4111 p
[1] = p
[2] = p
[3] = 0.0F
;
4113 save_TexEnvfv(target
, pname
, p
);
4117 static void GLAPIENTRY
4118 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
4120 GET_CURRENT_CONTEXT(ctx
);
4122 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4123 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
4132 if (ctx
->ExecuteFlag
) {
4133 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
4138 static void GLAPIENTRY
4139 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
4142 p
[0] = (GLfloat
) params
[0];
4143 p
[1] = (GLfloat
) params
[1];
4144 p
[2] = (GLfloat
) params
[2];
4145 p
[3] = (GLfloat
) params
[3];
4146 save_TexGenfv(coord
, pname
, p
);
4150 static void GLAPIENTRY
4151 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
4154 parray
[0] = (GLfloat
) param
;
4155 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4156 save_TexGenfv(coord
, pname
, parray
);
4160 static void GLAPIENTRY
4161 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
4164 p
[0] = (GLfloat
) params
[0];
4165 p
[1] = (GLfloat
) params
[1];
4166 p
[2] = (GLfloat
) params
[2];
4167 p
[3] = (GLfloat
) params
[3];
4168 save_TexGenfv(coord
, pname
, p
);
4172 static void GLAPIENTRY
4173 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
4177 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4178 save_TexGenfv(coord
, pname
, parray
);
4182 static void GLAPIENTRY
4183 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
4187 parray
[1] = parray
[2] = parray
[3] = 0;
4188 save_TexGeniv(coord
, pname
, parray
);
4192 static void GLAPIENTRY
4193 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4195 GET_CURRENT_CONTEXT(ctx
);
4197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4198 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
4207 if (ctx
->ExecuteFlag
) {
4208 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
4213 static void GLAPIENTRY
4214 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
4218 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4219 save_TexParameterfv(target
, pname
, parray
);
4223 static void GLAPIENTRY
4224 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
4227 fparam
[0] = (GLfloat
) param
;
4228 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4229 save_TexParameterfv(target
, pname
, fparam
);
4233 static void GLAPIENTRY
4234 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
4237 fparam
[0] = (GLfloat
) params
[0];
4238 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4239 save_TexParameterfv(target
, pname
, fparam
);
4243 static void GLAPIENTRY
4244 save_TexImage1D(GLenum target
,
4245 GLint level
, GLint components
,
4246 GLsizei width
, GLint border
,
4247 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4249 GET_CURRENT_CONTEXT(ctx
);
4250 if (target
== GL_PROXY_TEXTURE_1D
) {
4251 /* don't compile, execute immediately */
4252 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4253 border
, format
, type
, pixels
));
4257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4258 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
4262 n
[3].i
= components
;
4263 n
[4].i
= (GLint
) width
;
4268 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4269 pixels
, &ctx
->Unpack
));
4271 if (ctx
->ExecuteFlag
) {
4272 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4273 border
, format
, type
, pixels
));
4279 static void GLAPIENTRY
4280 save_TexImage2D(GLenum target
,
4281 GLint level
, GLint components
,
4282 GLsizei width
, GLsizei height
, GLint border
,
4283 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4285 GET_CURRENT_CONTEXT(ctx
);
4286 if (target
== GL_PROXY_TEXTURE_2D
) {
4287 /* don't compile, execute immediately */
4288 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4289 height
, border
, format
, type
, pixels
));
4293 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4294 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
4298 n
[3].i
= components
;
4299 n
[4].i
= (GLint
) width
;
4300 n
[5].i
= (GLint
) height
;
4305 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4306 pixels
, &ctx
->Unpack
));
4308 if (ctx
->ExecuteFlag
) {
4309 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4310 height
, border
, format
, type
, pixels
));
4316 static void GLAPIENTRY
4317 save_TexImage3D(GLenum target
,
4318 GLint level
, GLint internalFormat
,
4319 GLsizei width
, GLsizei height
, GLsizei depth
,
4321 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4323 GET_CURRENT_CONTEXT(ctx
);
4324 if (target
== GL_PROXY_TEXTURE_3D
) {
4325 /* don't compile, execute immediately */
4326 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4327 height
, depth
, border
, format
, type
,
4332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4333 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
4337 n
[3].i
= (GLint
) internalFormat
;
4338 n
[4].i
= (GLint
) width
;
4339 n
[5].i
= (GLint
) height
;
4340 n
[6].i
= (GLint
) depth
;
4344 save_pointer(&n
[10],
4345 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4346 pixels
, &ctx
->Unpack
));
4348 if (ctx
->ExecuteFlag
) {
4349 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4350 height
, depth
, border
, format
, type
,
4357 static void GLAPIENTRY
4358 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4359 GLsizei width
, GLenum format
, GLenum type
,
4360 const GLvoid
* pixels
)
4362 GET_CURRENT_CONTEXT(ctx
);
4365 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4367 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
4372 n
[4].i
= (GLint
) width
;
4376 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4377 pixels
, &ctx
->Unpack
));
4379 if (ctx
->ExecuteFlag
) {
4380 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4381 format
, type
, pixels
));
4386 static void GLAPIENTRY
4387 save_TexSubImage2D(GLenum target
, GLint level
,
4388 GLint xoffset
, GLint yoffset
,
4389 GLsizei width
, GLsizei height
,
4390 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4392 GET_CURRENT_CONTEXT(ctx
);
4395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4397 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
4403 n
[5].i
= (GLint
) width
;
4404 n
[6].i
= (GLint
) height
;
4408 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4409 pixels
, &ctx
->Unpack
));
4411 if (ctx
->ExecuteFlag
) {
4412 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4413 width
, height
, format
, type
, pixels
));
4418 static void GLAPIENTRY
4419 save_TexSubImage3D(GLenum target
, GLint level
,
4420 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4421 GLsizei width
, GLsizei height
, GLsizei depth
,
4422 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4424 GET_CURRENT_CONTEXT(ctx
);
4427 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4429 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4436 n
[6].i
= (GLint
) width
;
4437 n
[7].i
= (GLint
) height
;
4438 n
[8].i
= (GLint
) depth
;
4441 save_pointer(&n
[11],
4442 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4443 pixels
, &ctx
->Unpack
));
4445 if (ctx
->ExecuteFlag
) {
4446 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4447 xoffset
, yoffset
, zoffset
,
4448 width
, height
, depth
, format
, type
,
4454 static void GLAPIENTRY
4455 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4457 GET_CURRENT_CONTEXT(ctx
);
4459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4460 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4466 if (ctx
->ExecuteFlag
) {
4467 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4472 static void GLAPIENTRY
4473 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4475 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4480 static void GLAPIENTRY
4481 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4483 GET_CURRENT_CONTEXT(ctx
);
4485 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4486 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4490 n
[3].i
= (GLint
) width
;
4491 n
[4].i
= (GLint
) height
;
4493 if (ctx
->ExecuteFlag
) {
4494 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4499 static void GLAPIENTRY
4500 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4502 GET_CURRENT_CONTEXT(ctx
);
4504 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4505 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4512 if (ctx
->ExecuteFlag
) {
4513 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4517 static void GLAPIENTRY
4518 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4520 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4523 static void GLAPIENTRY
4524 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4526 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4529 static void GLAPIENTRY
4530 save_WindowPos2iMESA(GLint x
, GLint y
)
4532 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4535 static void GLAPIENTRY
4536 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4538 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4541 static void GLAPIENTRY
4542 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4544 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4547 static void GLAPIENTRY
4548 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4550 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4553 static void GLAPIENTRY
4554 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4556 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4559 static void GLAPIENTRY
4560 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4562 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4565 static void GLAPIENTRY
4566 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4568 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4571 static void GLAPIENTRY
4572 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4574 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4577 static void GLAPIENTRY
4578 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4580 save_WindowPos4fMESA(x
, y
, z
, w
);
4583 static void GLAPIENTRY
4584 save_WindowPos2dvMESA(const GLdouble
* v
)
4586 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4589 static void GLAPIENTRY
4590 save_WindowPos2fvMESA(const GLfloat
* v
)
4592 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4595 static void GLAPIENTRY
4596 save_WindowPos2ivMESA(const GLint
* v
)
4598 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4601 static void GLAPIENTRY
4602 save_WindowPos2svMESA(const GLshort
* v
)
4604 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4607 static void GLAPIENTRY
4608 save_WindowPos3dvMESA(const GLdouble
* v
)
4610 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4613 static void GLAPIENTRY
4614 save_WindowPos3fvMESA(const GLfloat
* v
)
4616 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4619 static void GLAPIENTRY
4620 save_WindowPos3ivMESA(const GLint
* v
)
4622 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4625 static void GLAPIENTRY
4626 save_WindowPos3svMESA(const GLshort
* v
)
4628 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4631 static void GLAPIENTRY
4632 save_WindowPos4dvMESA(const GLdouble
* v
)
4634 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4635 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4638 static void GLAPIENTRY
4639 save_WindowPos4fvMESA(const GLfloat
* v
)
4641 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4644 static void GLAPIENTRY
4645 save_WindowPos4ivMESA(const GLint
* v
)
4647 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4648 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4651 static void GLAPIENTRY
4652 save_WindowPos4svMESA(const GLshort
* v
)
4654 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4659 /* GL_ARB_multitexture */
4660 static void GLAPIENTRY
4661 save_ActiveTextureARB(GLenum target
)
4663 GET_CURRENT_CONTEXT(ctx
);
4665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4666 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4670 if (ctx
->ExecuteFlag
) {
4671 CALL_ActiveTexture(ctx
->Exec
, (target
));
4676 /* GL_ARB_transpose_matrix */
4678 static void GLAPIENTRY
4679 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4682 _math_transposefd(tm
, m
);
4683 save_LoadMatrixf(tm
);
4687 static void GLAPIENTRY
4688 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4691 _math_transposef(tm
, m
);
4692 save_LoadMatrixf(tm
);
4696 static void GLAPIENTRY
4697 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4700 _math_transposefd(tm
, m
);
4701 save_MultMatrixf(tm
);
4705 static void GLAPIENTRY
4706 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4709 _math_transposef(tm
, m
);
4710 save_MultMatrixf(tm
);
4713 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4715 GET_CURRENT_CONTEXT(ctx
);
4721 image
= malloc(size
);
4723 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4726 memcpy(image
, data
, size
);
4732 /* GL_ARB_texture_compression */
4733 static void GLAPIENTRY
4734 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4735 GLenum internalFormat
, GLsizei width
,
4736 GLint border
, GLsizei imageSize
,
4737 const GLvoid
* data
)
4739 GET_CURRENT_CONTEXT(ctx
);
4740 if (target
== GL_PROXY_TEXTURE_1D
) {
4741 /* don't compile, execute immediately */
4742 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4743 width
, border
, imageSize
,
4748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4750 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4751 6 + POINTER_DWORDS
);
4755 n
[3].e
= internalFormat
;
4756 n
[4].i
= (GLint
) width
;
4760 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4762 if (ctx
->ExecuteFlag
) {
4763 CALL_CompressedTexImage1D(ctx
->Exec
,
4764 (target
, level
, internalFormat
, width
,
4765 border
, imageSize
, data
));
4771 static void GLAPIENTRY
4772 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4773 GLenum internalFormat
, GLsizei width
,
4774 GLsizei height
, GLint border
, GLsizei imageSize
,
4775 const GLvoid
* data
)
4777 GET_CURRENT_CONTEXT(ctx
);
4778 if (target
== GL_PROXY_TEXTURE_2D
) {
4779 /* don't compile, execute immediately */
4780 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4781 width
, height
, border
,
4786 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4788 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4789 7 + POINTER_DWORDS
);
4793 n
[3].e
= internalFormat
;
4794 n
[4].i
= (GLint
) width
;
4795 n
[5].i
= (GLint
) height
;
4799 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4801 if (ctx
->ExecuteFlag
) {
4802 CALL_CompressedTexImage2D(ctx
->Exec
,
4803 (target
, level
, internalFormat
, width
,
4804 height
, border
, imageSize
, data
));
4810 static void GLAPIENTRY
4811 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4812 GLenum internalFormat
, GLsizei width
,
4813 GLsizei height
, GLsizei depth
, GLint border
,
4814 GLsizei imageSize
, const GLvoid
* data
)
4816 GET_CURRENT_CONTEXT(ctx
);
4817 if (target
== GL_PROXY_TEXTURE_3D
) {
4818 /* don't compile, execute immediately */
4819 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4820 width
, height
, depth
, border
,
4825 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4827 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4828 8 + POINTER_DWORDS
);
4832 n
[3].e
= internalFormat
;
4833 n
[4].i
= (GLint
) width
;
4834 n
[5].i
= (GLint
) height
;
4835 n
[6].i
= (GLint
) depth
;
4839 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4841 if (ctx
->ExecuteFlag
) {
4842 CALL_CompressedTexImage3D(ctx
->Exec
,
4843 (target
, level
, internalFormat
, width
,
4844 height
, depth
, border
, imageSize
,
4851 static void GLAPIENTRY
4852 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4853 GLsizei width
, GLenum format
,
4854 GLsizei imageSize
, const GLvoid
* data
)
4857 GET_CURRENT_CONTEXT(ctx
);
4858 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4860 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4861 6 + POINTER_DWORDS
);
4866 n
[4].i
= (GLint
) width
;
4870 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4872 if (ctx
->ExecuteFlag
) {
4873 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4874 width
, format
, imageSize
,
4880 static void GLAPIENTRY
4881 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4882 GLint yoffset
, GLsizei width
, GLsizei height
,
4883 GLenum format
, GLsizei imageSize
,
4884 const GLvoid
* data
)
4887 GET_CURRENT_CONTEXT(ctx
);
4888 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4890 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4891 8 + POINTER_DWORDS
);
4897 n
[5].i
= (GLint
) width
;
4898 n
[6].i
= (GLint
) height
;
4902 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4904 if (ctx
->ExecuteFlag
) {
4905 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4906 (target
, level
, xoffset
, yoffset
, width
,
4907 height
, format
, imageSize
, data
));
4912 static void GLAPIENTRY
4913 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4914 GLint yoffset
, GLint zoffset
, GLsizei width
,
4915 GLsizei height
, GLsizei depth
, GLenum format
,
4916 GLsizei imageSize
, const GLvoid
* data
)
4919 GET_CURRENT_CONTEXT(ctx
);
4920 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4922 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4923 10 + POINTER_DWORDS
);
4930 n
[6].i
= (GLint
) width
;
4931 n
[7].i
= (GLint
) height
;
4932 n
[8].i
= (GLint
) depth
;
4934 n
[10].i
= imageSize
;
4935 save_pointer(&n
[11],
4936 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4938 if (ctx
->ExecuteFlag
) {
4939 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4940 (target
, level
, xoffset
, yoffset
,
4941 zoffset
, width
, height
, depth
, format
,
4947 /* GL_ARB_multisample */
4948 static void GLAPIENTRY
4949 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4951 GET_CURRENT_CONTEXT(ctx
);
4953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4954 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4959 if (ctx
->ExecuteFlag
) {
4960 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4966 * GL_ARB_vertex_program
4968 static void GLAPIENTRY
4969 save_BindProgramARB(GLenum target
, GLuint id
)
4971 GET_CURRENT_CONTEXT(ctx
);
4973 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4974 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_ARB
, 2);
4979 if (ctx
->ExecuteFlag
) {
4980 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4984 static void GLAPIENTRY
4985 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4986 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4988 GET_CURRENT_CONTEXT(ctx
);
4990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4991 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
5000 if (ctx
->ExecuteFlag
) {
5001 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5006 static void GLAPIENTRY
5007 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
5008 const GLfloat
*params
)
5010 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
5011 params
[2], params
[3]);
5015 static void GLAPIENTRY
5016 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
5017 const GLfloat
* params
)
5019 GET_CURRENT_CONTEXT(ctx
);
5021 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5025 const GLfloat
* p
= params
;
5027 for (i
= 0 ; i
< count
; i
++) {
5028 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
5041 if (ctx
->ExecuteFlag
) {
5042 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5047 static void GLAPIENTRY
5048 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
5049 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
5051 save_ProgramEnvParameter4fARB(target
, index
,
5053 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
5057 static void GLAPIENTRY
5058 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
5059 const GLdouble
*params
)
5061 save_ProgramEnvParameter4fARB(target
, index
,
5062 (GLfloat
) params
[0],
5063 (GLfloat
) params
[1],
5064 (GLfloat
) params
[2], (GLfloat
) params
[3]);
5068 static void GLAPIENTRY
5069 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
5070 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5072 GET_CURRENT_CONTEXT(ctx
);
5074 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5075 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5084 if (ctx
->ExecuteFlag
) {
5085 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5090 static void GLAPIENTRY
5091 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
5092 const GLfloat
*params
)
5094 GET_CURRENT_CONTEXT(ctx
);
5096 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5097 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5106 if (ctx
->ExecuteFlag
) {
5107 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
5112 static void GLAPIENTRY
5113 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
5114 const GLfloat
*params
)
5116 GET_CURRENT_CONTEXT(ctx
);
5118 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5122 const GLfloat
* p
= params
;
5124 for (i
= 0 ; i
< count
; i
++) {
5125 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5138 if (ctx
->ExecuteFlag
) {
5139 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5144 static void GLAPIENTRY
5145 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
5146 GLdouble x
, GLdouble y
,
5147 GLdouble z
, GLdouble w
)
5149 GET_CURRENT_CONTEXT(ctx
);
5151 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5152 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5156 n
[3].f
= (GLfloat
) x
;
5157 n
[4].f
= (GLfloat
) y
;
5158 n
[5].f
= (GLfloat
) z
;
5159 n
[6].f
= (GLfloat
) w
;
5161 if (ctx
->ExecuteFlag
) {
5162 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5167 static void GLAPIENTRY
5168 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
5169 const GLdouble
*params
)
5171 GET_CURRENT_CONTEXT(ctx
);
5173 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5174 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5178 n
[3].f
= (GLfloat
) params
[0];
5179 n
[4].f
= (GLfloat
) params
[1];
5180 n
[5].f
= (GLfloat
) params
[2];
5181 n
[6].f
= (GLfloat
) params
[3];
5183 if (ctx
->ExecuteFlag
) {
5184 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
5189 /* GL_EXT_stencil_two_side */
5190 static void GLAPIENTRY
5191 save_ActiveStencilFaceEXT(GLenum face
)
5193 GET_CURRENT_CONTEXT(ctx
);
5195 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5196 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
5200 if (ctx
->ExecuteFlag
) {
5201 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
5206 /* GL_EXT_depth_bounds_test */
5207 static void GLAPIENTRY
5208 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
5210 GET_CURRENT_CONTEXT(ctx
);
5212 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5213 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
5215 n
[1].f
= (GLfloat
) zmin
;
5216 n
[2].f
= (GLfloat
) zmax
;
5218 if (ctx
->ExecuteFlag
) {
5219 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
5225 static void GLAPIENTRY
5226 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
5227 const GLvoid
* string
)
5229 GET_CURRENT_CONTEXT(ctx
);
5232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5234 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
5236 GLubyte
*programCopy
= malloc(len
);
5238 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
5241 memcpy(programCopy
, string
, len
);
5245 save_pointer(&n
[4], programCopy
);
5247 if (ctx
->ExecuteFlag
) {
5248 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
5253 static void GLAPIENTRY
5254 save_BeginQueryARB(GLenum target
, GLuint id
)
5256 GET_CURRENT_CONTEXT(ctx
);
5258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5259 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
5264 if (ctx
->ExecuteFlag
) {
5265 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
5269 static void GLAPIENTRY
5270 save_EndQueryARB(GLenum target
)
5272 GET_CURRENT_CONTEXT(ctx
);
5274 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5275 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
5279 if (ctx
->ExecuteFlag
) {
5280 CALL_EndQuery(ctx
->Exec
, (target
));
5284 static void GLAPIENTRY
5285 save_QueryCounter(GLuint id
, GLenum target
)
5287 GET_CURRENT_CONTEXT(ctx
);
5289 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5290 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
5295 if (ctx
->ExecuteFlag
) {
5296 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
5300 static void GLAPIENTRY
5301 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
5303 GET_CURRENT_CONTEXT(ctx
);
5305 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5306 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
5312 if (ctx
->ExecuteFlag
) {
5313 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5317 static void GLAPIENTRY
5318 save_EndQueryIndexed(GLenum target
, GLuint index
)
5320 GET_CURRENT_CONTEXT(ctx
);
5322 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5323 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5328 if (ctx
->ExecuteFlag
) {
5329 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5334 static void GLAPIENTRY
5335 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5337 GET_CURRENT_CONTEXT(ctx
);
5339 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5340 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5344 if (count
> MAX_DRAW_BUFFERS
)
5345 count
= MAX_DRAW_BUFFERS
;
5346 for (i
= 0; i
< count
; i
++) {
5347 n
[2 + i
].e
= buffers
[i
];
5350 if (ctx
->ExecuteFlag
) {
5351 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5355 static void GLAPIENTRY
5356 save_BindFragmentShaderATI(GLuint id
)
5358 GET_CURRENT_CONTEXT(ctx
);
5361 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5365 if (ctx
->ExecuteFlag
) {
5366 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5370 static void GLAPIENTRY
5371 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5373 GET_CURRENT_CONTEXT(ctx
);
5376 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5384 if (ctx
->ExecuteFlag
) {
5385 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5389 static void GLAPIENTRY
5390 save_Attr1fNV(GLenum attr
, GLfloat x
)
5392 GET_CURRENT_CONTEXT(ctx
);
5394 SAVE_FLUSH_VERTICES(ctx
);
5395 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5401 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5402 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5403 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5405 if (ctx
->ExecuteFlag
) {
5406 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5410 static void GLAPIENTRY
5411 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5413 GET_CURRENT_CONTEXT(ctx
);
5415 SAVE_FLUSH_VERTICES(ctx
);
5416 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5423 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5424 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5425 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5427 if (ctx
->ExecuteFlag
) {
5428 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5432 static void GLAPIENTRY
5433 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5435 GET_CURRENT_CONTEXT(ctx
);
5437 SAVE_FLUSH_VERTICES(ctx
);
5438 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5446 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5447 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5448 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5450 if (ctx
->ExecuteFlag
) {
5451 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5455 static void GLAPIENTRY
5456 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5458 GET_CURRENT_CONTEXT(ctx
);
5460 SAVE_FLUSH_VERTICES(ctx
);
5461 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5470 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5471 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5472 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5474 if (ctx
->ExecuteFlag
) {
5475 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5480 static void GLAPIENTRY
5481 save_Attr1fARB(GLenum attr
, GLfloat x
)
5483 GET_CURRENT_CONTEXT(ctx
);
5485 SAVE_FLUSH_VERTICES(ctx
);
5486 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5492 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5493 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5494 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5496 if (ctx
->ExecuteFlag
) {
5497 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5501 static void GLAPIENTRY
5502 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5504 GET_CURRENT_CONTEXT(ctx
);
5506 SAVE_FLUSH_VERTICES(ctx
);
5507 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5514 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5515 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5516 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5518 if (ctx
->ExecuteFlag
) {
5519 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5523 static void GLAPIENTRY
5524 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5526 GET_CURRENT_CONTEXT(ctx
);
5528 SAVE_FLUSH_VERTICES(ctx
);
5529 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5537 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5538 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5539 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5541 if (ctx
->ExecuteFlag
) {
5542 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5546 static void GLAPIENTRY
5547 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5549 GET_CURRENT_CONTEXT(ctx
);
5551 SAVE_FLUSH_VERTICES(ctx
);
5552 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5561 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5562 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5563 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5565 if (ctx
->ExecuteFlag
) {
5566 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5571 static void GLAPIENTRY
5572 save_EvalCoord1f(GLfloat x
)
5574 GET_CURRENT_CONTEXT(ctx
);
5576 SAVE_FLUSH_VERTICES(ctx
);
5577 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5581 if (ctx
->ExecuteFlag
) {
5582 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5586 static void GLAPIENTRY
5587 save_EvalCoord1fv(const GLfloat
* v
)
5589 save_EvalCoord1f(v
[0]);
5592 static void GLAPIENTRY
5593 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5595 GET_CURRENT_CONTEXT(ctx
);
5597 SAVE_FLUSH_VERTICES(ctx
);
5598 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5603 if (ctx
->ExecuteFlag
) {
5604 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5608 static void GLAPIENTRY
5609 save_EvalCoord2fv(const GLfloat
* v
)
5611 save_EvalCoord2f(v
[0], v
[1]);
5615 static void GLAPIENTRY
5616 save_EvalPoint1(GLint x
)
5618 GET_CURRENT_CONTEXT(ctx
);
5620 SAVE_FLUSH_VERTICES(ctx
);
5621 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5625 if (ctx
->ExecuteFlag
) {
5626 CALL_EvalPoint1(ctx
->Exec
, (x
));
5630 static void GLAPIENTRY
5631 save_EvalPoint2(GLint x
, GLint y
)
5633 GET_CURRENT_CONTEXT(ctx
);
5635 SAVE_FLUSH_VERTICES(ctx
);
5636 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5641 if (ctx
->ExecuteFlag
) {
5642 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5646 static void GLAPIENTRY
5647 save_Indexf(GLfloat x
)
5649 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5652 static void GLAPIENTRY
5653 save_Indexfv(const GLfloat
* v
)
5655 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5658 static void GLAPIENTRY
5659 save_EdgeFlag(GLboolean x
)
5661 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5666 * Compare 'count' elements of vectors 'a' and 'b'.
5667 * \return GL_TRUE if equal, GL_FALSE if different.
5669 static inline GLboolean
5670 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5672 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5677 * This glMaterial function is used for glMaterial calls that are outside
5678 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5680 static void GLAPIENTRY
5681 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5683 GET_CURRENT_CONTEXT(ctx
);
5691 case GL_FRONT_AND_BACK
:
5694 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5703 case GL_AMBIENT_AND_DIFFUSE
:
5709 case GL_COLOR_INDEXES
:
5713 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5717 if (ctx
->ExecuteFlag
) {
5718 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5721 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5723 /* Try to eliminate redundant statechanges. Because it is legal to
5724 * call glMaterial even inside begin/end calls, don't need to worry
5725 * about ctx->Driver.CurrentSavePrimitive here.
5727 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5728 if (bitmask
& (1 << i
)) {
5729 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5730 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5731 /* no change in material value */
5732 bitmask
&= ~(1 << i
);
5735 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5736 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5741 /* If this call has no effect, return early */
5745 SAVE_FLUSH_VERTICES(ctx
);
5747 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5751 for (i
= 0; i
< args
; i
++)
5752 n
[3 + i
].f
= param
[i
];
5756 static void GLAPIENTRY
5757 save_Begin(GLenum mode
)
5759 GET_CURRENT_CONTEXT(ctx
);
5761 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5762 /* compile this error into the display list */
5763 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5765 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5766 /* compile this error into the display list */
5767 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5770 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5772 vbo_save_NotifyBegin(ctx
, mode
);
5776 static void GLAPIENTRY
5779 GET_CURRENT_CONTEXT(ctx
);
5780 SAVE_FLUSH_VERTICES(ctx
);
5781 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5782 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5783 if (ctx
->ExecuteFlag
) {
5784 CALL_End(ctx
->Exec
, ());
5788 static void GLAPIENTRY
5789 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5791 GET_CURRENT_CONTEXT(ctx
);
5793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5794 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5801 if (ctx
->ExecuteFlag
) {
5802 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5807 static void GLAPIENTRY
5808 save_Vertex2f(GLfloat x
, GLfloat y
)
5810 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5813 static void GLAPIENTRY
5814 save_Vertex2fv(const GLfloat
* v
)
5816 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5819 static void GLAPIENTRY
5820 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5822 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5825 static void GLAPIENTRY
5826 save_Vertex3fv(const GLfloat
* v
)
5828 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5831 static void GLAPIENTRY
5832 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5834 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5837 static void GLAPIENTRY
5838 save_Vertex4fv(const GLfloat
* v
)
5840 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5843 static void GLAPIENTRY
5844 save_TexCoord1f(GLfloat x
)
5846 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5849 static void GLAPIENTRY
5850 save_TexCoord1fv(const GLfloat
* v
)
5852 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5855 static void GLAPIENTRY
5856 save_TexCoord2f(GLfloat x
, GLfloat y
)
5858 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5861 static void GLAPIENTRY
5862 save_TexCoord2fv(const GLfloat
* v
)
5864 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5867 static void GLAPIENTRY
5868 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5870 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5873 static void GLAPIENTRY
5874 save_TexCoord3fv(const GLfloat
* v
)
5876 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5879 static void GLAPIENTRY
5880 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5882 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5885 static void GLAPIENTRY
5886 save_TexCoord4fv(const GLfloat
* v
)
5888 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5891 static void GLAPIENTRY
5892 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5894 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5897 static void GLAPIENTRY
5898 save_Normal3fv(const GLfloat
* v
)
5900 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5903 static void GLAPIENTRY
5904 save_FogCoordfEXT(GLfloat x
)
5906 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5909 static void GLAPIENTRY
5910 save_FogCoordfvEXT(const GLfloat
* v
)
5912 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5915 static void GLAPIENTRY
5916 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5918 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5921 static void GLAPIENTRY
5922 save_Color3fv(const GLfloat
* v
)
5924 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5927 static void GLAPIENTRY
5928 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5930 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5933 static void GLAPIENTRY
5934 save_Color4fv(const GLfloat
* v
)
5936 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5939 static void GLAPIENTRY
5940 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5942 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5945 static void GLAPIENTRY
5946 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5948 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5952 /* Just call the respective ATTR for texcoord
5954 static void GLAPIENTRY
5955 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5957 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5958 save_Attr1fNV(attr
, x
);
5961 static void GLAPIENTRY
5962 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5964 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5965 save_Attr1fNV(attr
, v
[0]);
5968 static void GLAPIENTRY
5969 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5971 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5972 save_Attr2fNV(attr
, x
, y
);
5975 static void GLAPIENTRY
5976 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5978 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5979 save_Attr2fNV(attr
, v
[0], v
[1]);
5982 static void GLAPIENTRY
5983 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5985 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5986 save_Attr3fNV(attr
, x
, y
, z
);
5989 static void GLAPIENTRY
5990 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5992 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5993 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5996 static void GLAPIENTRY
5997 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5998 GLfloat z
, GLfloat w
)
6000 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6001 save_Attr4fNV(attr
, x
, y
, z
, w
);
6004 static void GLAPIENTRY
6005 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
6007 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6008 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
6013 * Record a GL_INVALID_VALUE error when an invalid vertex attribute
6019 GET_CURRENT_CONTEXT(ctx
);
6020 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
6025 static void GLAPIENTRY
6026 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
6028 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6029 save_Attr1fARB(index
, x
);
6034 static void GLAPIENTRY
6035 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
6037 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6038 save_Attr1fARB(index
, v
[0]);
6043 static void GLAPIENTRY
6044 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
6046 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6047 save_Attr2fARB(index
, x
, y
);
6052 static void GLAPIENTRY
6053 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
6055 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6056 save_Attr2fARB(index
, v
[0], v
[1]);
6061 static void GLAPIENTRY
6062 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
6064 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6065 save_Attr3fARB(index
, x
, y
, z
);
6070 static void GLAPIENTRY
6071 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
6073 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6074 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
6079 static void GLAPIENTRY
6080 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
6083 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6084 save_Attr4fARB(index
, x
, y
, z
, w
);
6089 static void GLAPIENTRY
6090 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
6092 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6093 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
6098 static void GLAPIENTRY
6099 save_PrimitiveRestartNV(void)
6101 /* Note: this is used when outside a glBegin/End pair in a display list */
6102 GET_CURRENT_CONTEXT(ctx
);
6103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6104 (void) alloc_instruction(ctx
, OPCODE_PRIMITIVE_RESTART_NV
, 0);
6105 if (ctx
->ExecuteFlag
) {
6106 CALL_PrimitiveRestartNV(ctx
->Exec
, ());
6111 static void GLAPIENTRY
6112 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
6113 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
6114 GLbitfield mask
, GLenum filter
)
6116 GET_CURRENT_CONTEXT(ctx
);
6118 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6119 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
6132 if (ctx
->ExecuteFlag
) {
6133 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
6134 dstX0
, dstY0
, dstX1
, dstY1
,
6140 /** GL_EXT_provoking_vertex */
6141 static void GLAPIENTRY
6142 save_ProvokingVertexEXT(GLenum mode
)
6144 GET_CURRENT_CONTEXT(ctx
);
6146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6147 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
6151 if (ctx
->ExecuteFlag
) {
6152 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6153 _mesa_ProvokingVertex(mode
);
6158 /** GL_EXT_transform_feedback */
6159 static void GLAPIENTRY
6160 save_BeginTransformFeedback(GLenum mode
)
6162 GET_CURRENT_CONTEXT(ctx
);
6164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6165 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
6169 if (ctx
->ExecuteFlag
) {
6170 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
6175 /** GL_EXT_transform_feedback */
6176 static void GLAPIENTRY
6177 save_EndTransformFeedback(void)
6179 GET_CURRENT_CONTEXT(ctx
);
6180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6181 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
6182 if (ctx
->ExecuteFlag
) {
6183 CALL_EndTransformFeedback(ctx
->Exec
, ());
6187 static void GLAPIENTRY
6188 save_BindTransformFeedback(GLenum target
, GLuint name
)
6190 GET_CURRENT_CONTEXT(ctx
);
6192 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6193 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
6198 if (ctx
->ExecuteFlag
) {
6199 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
6203 static void GLAPIENTRY
6204 save_PauseTransformFeedback(void)
6206 GET_CURRENT_CONTEXT(ctx
);
6207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6208 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
6209 if (ctx
->ExecuteFlag
) {
6210 CALL_PauseTransformFeedback(ctx
->Exec
, ());
6214 static void GLAPIENTRY
6215 save_ResumeTransformFeedback(void)
6217 GET_CURRENT_CONTEXT(ctx
);
6218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6219 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
6220 if (ctx
->ExecuteFlag
) {
6221 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
6225 static void GLAPIENTRY
6226 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
6228 GET_CURRENT_CONTEXT(ctx
);
6230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6231 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
6236 if (ctx
->ExecuteFlag
) {
6237 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
6241 static void GLAPIENTRY
6242 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
6244 GET_CURRENT_CONTEXT(ctx
);
6246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6247 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
6253 if (ctx
->ExecuteFlag
) {
6254 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
6258 static void GLAPIENTRY
6259 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
6262 GET_CURRENT_CONTEXT(ctx
);
6264 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6265 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
6269 n
[3].si
= primcount
;
6271 if (ctx
->ExecuteFlag
) {
6272 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
6276 static void GLAPIENTRY
6277 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
6278 GLuint stream
, GLsizei primcount
)
6280 GET_CURRENT_CONTEXT(ctx
);
6282 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6283 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
6288 n
[4].si
= primcount
;
6290 if (ctx
->ExecuteFlag
) {
6291 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
6296 static void GLAPIENTRY
6297 save_UseProgram(GLuint program
)
6299 GET_CURRENT_CONTEXT(ctx
);
6301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6302 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
6306 if (ctx
->ExecuteFlag
) {
6307 CALL_UseProgram(ctx
->Exec
, (program
));
6312 static void GLAPIENTRY
6313 save_Uniform1fARB(GLint location
, GLfloat x
)
6315 GET_CURRENT_CONTEXT(ctx
);
6317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6318 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6323 if (ctx
->ExecuteFlag
) {
6324 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6329 static void GLAPIENTRY
6330 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6332 GET_CURRENT_CONTEXT(ctx
);
6334 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6335 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6341 if (ctx
->ExecuteFlag
) {
6342 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6347 static void GLAPIENTRY
6348 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6350 GET_CURRENT_CONTEXT(ctx
);
6352 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6353 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6360 if (ctx
->ExecuteFlag
) {
6361 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6366 static void GLAPIENTRY
6367 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6369 GET_CURRENT_CONTEXT(ctx
);
6371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6372 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6380 if (ctx
->ExecuteFlag
) {
6381 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6386 static void GLAPIENTRY
6387 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6389 GET_CURRENT_CONTEXT(ctx
);
6391 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6392 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
6396 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6398 if (ctx
->ExecuteFlag
) {
6399 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6403 static void GLAPIENTRY
6404 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6406 GET_CURRENT_CONTEXT(ctx
);
6408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6409 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6413 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6415 if (ctx
->ExecuteFlag
) {
6416 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6420 static void GLAPIENTRY
6421 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6423 GET_CURRENT_CONTEXT(ctx
);
6425 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6426 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6430 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6432 if (ctx
->ExecuteFlag
) {
6433 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6437 static void GLAPIENTRY
6438 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6440 GET_CURRENT_CONTEXT(ctx
);
6442 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6443 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6447 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6449 if (ctx
->ExecuteFlag
) {
6450 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6455 static void GLAPIENTRY
6456 save_Uniform1iARB(GLint location
, GLint x
)
6458 GET_CURRENT_CONTEXT(ctx
);
6460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6461 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6466 if (ctx
->ExecuteFlag
) {
6467 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6471 static void GLAPIENTRY
6472 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6474 GET_CURRENT_CONTEXT(ctx
);
6476 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6477 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6483 if (ctx
->ExecuteFlag
) {
6484 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6488 static void GLAPIENTRY
6489 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6491 GET_CURRENT_CONTEXT(ctx
);
6493 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6494 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6501 if (ctx
->ExecuteFlag
) {
6502 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6506 static void GLAPIENTRY
6507 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6509 GET_CURRENT_CONTEXT(ctx
);
6511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6512 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6520 if (ctx
->ExecuteFlag
) {
6521 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6527 static void GLAPIENTRY
6528 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6530 GET_CURRENT_CONTEXT(ctx
);
6532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6533 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6537 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6539 if (ctx
->ExecuteFlag
) {
6540 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6544 static void GLAPIENTRY
6545 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6547 GET_CURRENT_CONTEXT(ctx
);
6549 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6550 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6554 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6556 if (ctx
->ExecuteFlag
) {
6557 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6561 static void GLAPIENTRY
6562 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6564 GET_CURRENT_CONTEXT(ctx
);
6566 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6567 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6571 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6573 if (ctx
->ExecuteFlag
) {
6574 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6578 static void GLAPIENTRY
6579 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6581 GET_CURRENT_CONTEXT(ctx
);
6583 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6584 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6588 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6590 if (ctx
->ExecuteFlag
) {
6591 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6597 static void GLAPIENTRY
6598 save_Uniform1ui(GLint location
, GLuint x
)
6600 GET_CURRENT_CONTEXT(ctx
);
6602 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6603 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6608 if (ctx
->ExecuteFlag
) {
6609 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6613 static void GLAPIENTRY
6614 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6616 GET_CURRENT_CONTEXT(ctx
);
6618 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6619 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6625 if (ctx
->ExecuteFlag
) {
6626 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6630 static void GLAPIENTRY
6631 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6633 GET_CURRENT_CONTEXT(ctx
);
6635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6636 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6643 if (ctx
->ExecuteFlag
) {
6644 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6648 static void GLAPIENTRY
6649 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6651 GET_CURRENT_CONTEXT(ctx
);
6653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6654 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6662 if (ctx
->ExecuteFlag
) {
6663 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6669 static void GLAPIENTRY
6670 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6672 GET_CURRENT_CONTEXT(ctx
);
6674 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6675 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6679 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6681 if (ctx
->ExecuteFlag
) {
6682 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6686 static void GLAPIENTRY
6687 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6689 GET_CURRENT_CONTEXT(ctx
);
6691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6692 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6696 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6698 if (ctx
->ExecuteFlag
) {
6699 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6703 static void GLAPIENTRY
6704 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6706 GET_CURRENT_CONTEXT(ctx
);
6708 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6709 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6713 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6715 if (ctx
->ExecuteFlag
) {
6716 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6720 static void GLAPIENTRY
6721 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6723 GET_CURRENT_CONTEXT(ctx
);
6725 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6726 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6730 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6732 if (ctx
->ExecuteFlag
) {
6733 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6739 static void GLAPIENTRY
6740 save_UniformMatrix2fvARB(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_MATRIX22
, 3 + POINTER_DWORDS
);
6751 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6753 if (ctx
->ExecuteFlag
) {
6754 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6758 static void GLAPIENTRY
6759 save_UniformMatrix3fvARB(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_MATRIX33
, 3 + POINTER_DWORDS
);
6770 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6772 if (ctx
->ExecuteFlag
) {
6773 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6777 static void GLAPIENTRY
6778 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6781 GET_CURRENT_CONTEXT(ctx
);
6783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6784 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6789 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6791 if (ctx
->ExecuteFlag
) {
6792 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6797 static void GLAPIENTRY
6798 save_UniformMatrix2x3fv(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_MATRIX23
, 3 + POINTER_DWORDS
);
6809 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6811 if (ctx
->ExecuteFlag
) {
6812 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6816 static void GLAPIENTRY
6817 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6820 GET_CURRENT_CONTEXT(ctx
);
6822 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6823 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6828 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6830 if (ctx
->ExecuteFlag
) {
6831 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6836 static void GLAPIENTRY
6837 save_UniformMatrix2x4fv(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_MATRIX24
, 3 + POINTER_DWORDS
);
6848 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6850 if (ctx
->ExecuteFlag
) {
6851 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6855 static void GLAPIENTRY
6856 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6859 GET_CURRENT_CONTEXT(ctx
);
6861 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6862 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6867 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6869 if (ctx
->ExecuteFlag
) {
6870 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6875 static void GLAPIENTRY
6876 save_UniformMatrix3x4fv(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_MATRIX34
, 3 + POINTER_DWORDS
);
6887 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6889 if (ctx
->ExecuteFlag
) {
6890 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6894 static void GLAPIENTRY
6895 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6898 GET_CURRENT_CONTEXT(ctx
);
6900 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6901 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6906 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6908 if (ctx
->ExecuteFlag
) {
6909 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6913 static void GLAPIENTRY
6914 save_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
6916 GET_CURRENT_CONTEXT(ctx
);
6918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6919 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM_STAGES
, 3);
6925 if (ctx
->ExecuteFlag
) {
6926 CALL_UseProgramStages(ctx
->Exec
, (pipeline
, stages
, program
));
6930 static void GLAPIENTRY
6931 save_ProgramUniform1f(GLuint program
, GLint location
, GLfloat x
)
6933 GET_CURRENT_CONTEXT(ctx
);
6935 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6936 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1F
, 3);
6942 if (ctx
->ExecuteFlag
) {
6943 CALL_ProgramUniform1f(ctx
->Exec
, (program
, location
, x
));
6947 static void GLAPIENTRY
6948 save_ProgramUniform2f(GLuint program
, GLint location
, GLfloat x
, GLfloat y
)
6950 GET_CURRENT_CONTEXT(ctx
);
6952 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6953 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2F
, 4);
6960 if (ctx
->ExecuteFlag
) {
6961 CALL_ProgramUniform2f(ctx
->Exec
, (program
, location
, x
, y
));
6965 static void GLAPIENTRY
6966 save_ProgramUniform3f(GLuint program
, GLint location
,
6967 GLfloat x
, GLfloat y
, GLfloat z
)
6969 GET_CURRENT_CONTEXT(ctx
);
6971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6972 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3F
, 5);
6980 if (ctx
->ExecuteFlag
) {
6981 CALL_ProgramUniform3f(ctx
->Exec
, (program
, location
, x
, y
, z
));
6985 static void GLAPIENTRY
6986 save_ProgramUniform4f(GLuint program
, GLint location
,
6987 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6989 GET_CURRENT_CONTEXT(ctx
);
6991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6992 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4F
, 6);
7001 if (ctx
->ExecuteFlag
) {
7002 CALL_ProgramUniform4f(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7006 static void GLAPIENTRY
7007 save_ProgramUniform1fv(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_1FV
, 3 + POINTER_DWORDS
);
7018 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLfloat
)));
7020 if (ctx
->ExecuteFlag
) {
7021 CALL_ProgramUniform1fv(ctx
->Exec
, (program
, location
, count
, v
));
7025 static void GLAPIENTRY
7026 save_ProgramUniform2fv(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_2FV
, 3 + POINTER_DWORDS
);
7037 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLfloat
)));
7039 if (ctx
->ExecuteFlag
) {
7040 CALL_ProgramUniform2fv(ctx
->Exec
, (program
, location
, count
, v
));
7044 static void GLAPIENTRY
7045 save_ProgramUniform3fv(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_3FV
, 3 + POINTER_DWORDS
);
7056 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLfloat
)));
7058 if (ctx
->ExecuteFlag
) {
7059 CALL_ProgramUniform3fv(ctx
->Exec
, (program
, location
, count
, v
));
7063 static void GLAPIENTRY
7064 save_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
7067 GET_CURRENT_CONTEXT(ctx
);
7069 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7070 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4FV
, 3 + POINTER_DWORDS
);
7075 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLfloat
)));
7077 if (ctx
->ExecuteFlag
) {
7078 CALL_ProgramUniform4fv(ctx
->Exec
, (program
, location
, count
, v
));
7082 static void GLAPIENTRY
7083 save_ProgramUniform1i(GLuint program
, GLint location
, GLint x
)
7085 GET_CURRENT_CONTEXT(ctx
);
7087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7088 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1I
, 3);
7094 if (ctx
->ExecuteFlag
) {
7095 CALL_ProgramUniform1i(ctx
->Exec
, (program
, location
, x
));
7099 static void GLAPIENTRY
7100 save_ProgramUniform2i(GLuint program
, GLint location
, GLint x
, GLint y
)
7102 GET_CURRENT_CONTEXT(ctx
);
7104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7105 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2I
, 4);
7112 if (ctx
->ExecuteFlag
) {
7113 CALL_ProgramUniform2i(ctx
->Exec
, (program
, location
, x
, y
));
7117 static void GLAPIENTRY
7118 save_ProgramUniform3i(GLuint program
, GLint location
,
7119 GLint x
, GLint y
, GLint z
)
7121 GET_CURRENT_CONTEXT(ctx
);
7123 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7124 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3I
, 5);
7132 if (ctx
->ExecuteFlag
) {
7133 CALL_ProgramUniform3i(ctx
->Exec
, (program
, location
, x
, y
, z
));
7137 static void GLAPIENTRY
7138 save_ProgramUniform4i(GLuint program
, GLint location
,
7139 GLint x
, GLint y
, GLint z
, GLint w
)
7141 GET_CURRENT_CONTEXT(ctx
);
7143 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7144 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4I
, 6);
7153 if (ctx
->ExecuteFlag
) {
7154 CALL_ProgramUniform4i(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7158 static void GLAPIENTRY
7159 save_ProgramUniform1iv(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_1IV
, 3 + POINTER_DWORDS
);
7170 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLint
)));
7172 if (ctx
->ExecuteFlag
) {
7173 CALL_ProgramUniform1iv(ctx
->Exec
, (program
, location
, count
, v
));
7177 static void GLAPIENTRY
7178 save_ProgramUniform2iv(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_2IV
, 3 + POINTER_DWORDS
);
7189 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLint
)));
7191 if (ctx
->ExecuteFlag
) {
7192 CALL_ProgramUniform2iv(ctx
->Exec
, (program
, location
, count
, v
));
7196 static void GLAPIENTRY
7197 save_ProgramUniform3iv(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_3IV
, 3 + POINTER_DWORDS
);
7208 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLint
)));
7210 if (ctx
->ExecuteFlag
) {
7211 CALL_ProgramUniform3iv(ctx
->Exec
, (program
, location
, count
, v
));
7215 static void GLAPIENTRY
7216 save_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
7219 GET_CURRENT_CONTEXT(ctx
);
7221 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7222 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4IV
, 3 + POINTER_DWORDS
);
7227 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLint
)));
7229 if (ctx
->ExecuteFlag
) {
7230 CALL_ProgramUniform4iv(ctx
->Exec
, (program
, location
, count
, v
));
7234 static void GLAPIENTRY
7235 save_ProgramUniform1ui(GLuint program
, GLint location
, GLuint x
)
7237 GET_CURRENT_CONTEXT(ctx
);
7239 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7240 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UI
, 3);
7246 if (ctx
->ExecuteFlag
) {
7247 CALL_ProgramUniform1ui(ctx
->Exec
, (program
, location
, x
));
7251 static void GLAPIENTRY
7252 save_ProgramUniform2ui(GLuint program
, GLint location
, GLuint x
, GLuint y
)
7254 GET_CURRENT_CONTEXT(ctx
);
7256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7257 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UI
, 4);
7264 if (ctx
->ExecuteFlag
) {
7265 CALL_ProgramUniform2ui(ctx
->Exec
, (program
, location
, x
, y
));
7269 static void GLAPIENTRY
7270 save_ProgramUniform3ui(GLuint program
, GLint location
,
7271 GLuint x
, GLuint y
, GLuint z
)
7273 GET_CURRENT_CONTEXT(ctx
);
7275 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7276 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UI
, 5);
7284 if (ctx
->ExecuteFlag
) {
7285 CALL_ProgramUniform3ui(ctx
->Exec
, (program
, location
, x
, y
, z
));
7289 static void GLAPIENTRY
7290 save_ProgramUniform4ui(GLuint program
, GLint location
,
7291 GLuint x
, GLuint y
, GLuint z
, GLuint w
)
7293 GET_CURRENT_CONTEXT(ctx
);
7295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7296 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UI
, 6);
7305 if (ctx
->ExecuteFlag
) {
7306 CALL_ProgramUniform4ui(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7310 static void GLAPIENTRY
7311 save_ProgramUniform1uiv(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_1UIV
, 3 + POINTER_DWORDS
);
7322 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLuint
)));
7324 if (ctx
->ExecuteFlag
) {
7325 CALL_ProgramUniform1uiv(ctx
->Exec
, (program
, location
, count
, v
));
7329 static void GLAPIENTRY
7330 save_ProgramUniform2uiv(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_2UIV
, 3 + POINTER_DWORDS
);
7341 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLuint
)));
7343 if (ctx
->ExecuteFlag
) {
7344 CALL_ProgramUniform2uiv(ctx
->Exec
, (program
, location
, count
, v
));
7348 static void GLAPIENTRY
7349 save_ProgramUniform3uiv(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_3UIV
, 3 + POINTER_DWORDS
);
7360 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLuint
)));
7362 if (ctx
->ExecuteFlag
) {
7363 CALL_ProgramUniform3uiv(ctx
->Exec
, (program
, location
, count
, v
));
7367 static void GLAPIENTRY
7368 save_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
7371 GET_CURRENT_CONTEXT(ctx
);
7373 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7374 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UIV
, 3 + POINTER_DWORDS
);
7379 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLuint
)));
7381 if (ctx
->ExecuteFlag
) {
7382 CALL_ProgramUniform4uiv(ctx
->Exec
, (program
, location
, count
, v
));
7386 static void GLAPIENTRY
7387 save_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
7388 GLboolean transpose
, const GLfloat
*v
)
7390 GET_CURRENT_CONTEXT(ctx
);
7392 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7393 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
7394 4 + POINTER_DWORDS
);
7400 save_pointer(&n
[5], memdup(v
, count
* 2 * 2 * sizeof(GLfloat
)));
7402 if (ctx
->ExecuteFlag
) {
7403 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
7404 (program
, location
, count
, transpose
, v
));
7408 static void GLAPIENTRY
7409 save_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
7410 GLboolean transpose
, const GLfloat
*v
)
7412 GET_CURRENT_CONTEXT(ctx
);
7414 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7415 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
7416 4 + POINTER_DWORDS
);
7422 save_pointer(&n
[5], memdup(v
, count
* 2 * 3 * sizeof(GLfloat
)));
7424 if (ctx
->ExecuteFlag
) {
7425 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
7426 (program
, location
, count
, transpose
, v
));
7430 static void GLAPIENTRY
7431 save_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
7432 GLboolean transpose
, const GLfloat
*v
)
7434 GET_CURRENT_CONTEXT(ctx
);
7436 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7437 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
7438 4 + POINTER_DWORDS
);
7444 save_pointer(&n
[5], memdup(v
, count
* 2 * 4 * sizeof(GLfloat
)));
7446 if (ctx
->ExecuteFlag
) {
7447 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
7448 (program
, location
, count
, transpose
, v
));
7452 static void GLAPIENTRY
7453 save_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
7454 GLboolean transpose
, const GLfloat
*v
)
7456 GET_CURRENT_CONTEXT(ctx
);
7458 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7459 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
7460 4 + POINTER_DWORDS
);
7466 save_pointer(&n
[5], memdup(v
, count
* 3 * 2 * sizeof(GLfloat
)));
7468 if (ctx
->ExecuteFlag
) {
7469 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
7470 (program
, location
, count
, transpose
, v
));
7474 static void GLAPIENTRY
7475 save_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
7476 GLboolean transpose
, const GLfloat
*v
)
7478 GET_CURRENT_CONTEXT(ctx
);
7480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7481 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
7482 4 + POINTER_DWORDS
);
7488 save_pointer(&n
[5], memdup(v
, count
* 3 * 3 * sizeof(GLfloat
)));
7490 if (ctx
->ExecuteFlag
) {
7491 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
7492 (program
, location
, count
, transpose
, v
));
7496 static void GLAPIENTRY
7497 save_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
7498 GLboolean transpose
, const GLfloat
*v
)
7500 GET_CURRENT_CONTEXT(ctx
);
7502 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7503 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
7504 4 + POINTER_DWORDS
);
7510 save_pointer(&n
[5], memdup(v
, count
* 3 * 4 * sizeof(GLfloat
)));
7512 if (ctx
->ExecuteFlag
) {
7513 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
7514 (program
, location
, count
, transpose
, v
));
7518 static void GLAPIENTRY
7519 save_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
7520 GLboolean transpose
, const GLfloat
*v
)
7522 GET_CURRENT_CONTEXT(ctx
);
7524 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7525 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
7526 4 + POINTER_DWORDS
);
7532 save_pointer(&n
[5], memdup(v
, count
* 4 * 2 * sizeof(GLfloat
)));
7534 if (ctx
->ExecuteFlag
) {
7535 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
7536 (program
, location
, count
, transpose
, v
));
7540 static void GLAPIENTRY
7541 save_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
7542 GLboolean transpose
, const GLfloat
*v
)
7544 GET_CURRENT_CONTEXT(ctx
);
7546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7547 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
7548 4 + POINTER_DWORDS
);
7554 save_pointer(&n
[5], memdup(v
, count
* 4 * 3 * sizeof(GLfloat
)));
7556 if (ctx
->ExecuteFlag
) {
7557 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
7558 (program
, location
, count
, transpose
, v
));
7562 static void GLAPIENTRY
7563 save_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
7564 GLboolean transpose
, const GLfloat
*v
)
7566 GET_CURRENT_CONTEXT(ctx
);
7568 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7569 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
7570 4 + POINTER_DWORDS
);
7576 save_pointer(&n
[5], memdup(v
, count
* 4 * 4 * sizeof(GLfloat
)));
7578 if (ctx
->ExecuteFlag
) {
7579 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
7580 (program
, location
, count
, transpose
, v
));
7584 static void GLAPIENTRY
7585 save_ClipControl(GLenum origin
, GLenum depth
)
7587 GET_CURRENT_CONTEXT(ctx
);
7589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7590 n
= alloc_instruction(ctx
, OPCODE_CLIP_CONTROL
, 2);
7595 if (ctx
->ExecuteFlag
) {
7596 CALL_ClipControl(ctx
->Exec
, (origin
, depth
));
7600 static void GLAPIENTRY
7601 save_ClampColorARB(GLenum target
, GLenum clamp
)
7603 GET_CURRENT_CONTEXT(ctx
);
7605 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7606 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
7611 if (ctx
->ExecuteFlag
) {
7612 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
7616 /** GL_EXT_texture_integer */
7617 static void GLAPIENTRY
7618 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
7620 GET_CURRENT_CONTEXT(ctx
);
7622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7623 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
7630 if (ctx
->ExecuteFlag
) {
7631 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7635 /** GL_EXT_texture_integer */
7636 static void GLAPIENTRY
7637 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
7639 GET_CURRENT_CONTEXT(ctx
);
7641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7642 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
7649 if (ctx
->ExecuteFlag
) {
7650 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7654 /** GL_EXT_texture_integer */
7655 static void GLAPIENTRY
7656 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
7658 GET_CURRENT_CONTEXT(ctx
);
7660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7661 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
7670 if (ctx
->ExecuteFlag
) {
7671 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
7675 /** GL_EXT_texture_integer */
7676 static void GLAPIENTRY
7677 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
7679 GET_CURRENT_CONTEXT(ctx
);
7681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7682 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
7686 n
[3].ui
= params
[0];
7687 n
[4].ui
= params
[1];
7688 n
[5].ui
= params
[2];
7689 n
[6].ui
= params
[3];
7691 if (ctx
->ExecuteFlag
) {
7692 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
7696 /* GL_ARB_instanced_arrays */
7697 static void GLAPIENTRY
7698 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
7700 GET_CURRENT_CONTEXT(ctx
);
7702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7703 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
7708 if (ctx
->ExecuteFlag
) {
7709 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
7714 /* GL_NV_texture_barrier */
7715 static void GLAPIENTRY
7716 save_TextureBarrierNV(void)
7718 GET_CURRENT_CONTEXT(ctx
);
7719 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7720 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
7721 if (ctx
->ExecuteFlag
) {
7722 CALL_TextureBarrierNV(ctx
->Exec
, ());
7727 /* GL_ARB_sampler_objects */
7728 static void GLAPIENTRY
7729 save_BindSampler(GLuint unit
, GLuint sampler
)
7732 GET_CURRENT_CONTEXT(ctx
);
7733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7734 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
7739 if (ctx
->ExecuteFlag
) {
7740 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
7744 static void GLAPIENTRY
7745 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7748 GET_CURRENT_CONTEXT(ctx
);
7749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7750 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7755 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7761 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7764 if (ctx
->ExecuteFlag
) {
7765 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7769 static void GLAPIENTRY
7770 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7774 parray
[1] = parray
[2] = parray
[3] = 0;
7775 save_SamplerParameteriv(sampler
, pname
, parray
);
7778 static void GLAPIENTRY
7779 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7782 GET_CURRENT_CONTEXT(ctx
);
7783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7784 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7789 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7795 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7798 if (ctx
->ExecuteFlag
) {
7799 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7803 static void GLAPIENTRY
7804 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7808 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7809 save_SamplerParameterfv(sampler
, pname
, parray
);
7812 static void GLAPIENTRY
7813 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7816 GET_CURRENT_CONTEXT(ctx
);
7817 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7818 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7823 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7829 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7832 if (ctx
->ExecuteFlag
) {
7833 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7837 static void GLAPIENTRY
7838 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7841 GET_CURRENT_CONTEXT(ctx
);
7842 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7843 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7847 n
[3].ui
= params
[0];
7848 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7849 n
[4].ui
= params
[1];
7850 n
[5].ui
= params
[2];
7851 n
[6].ui
= params
[3];
7854 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7857 if (ctx
->ExecuteFlag
) {
7858 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7862 static void GLAPIENTRY
7863 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7866 GET_CURRENT_CONTEXT(ctx
);
7867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7868 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7870 union uint64_pair p
;
7873 n
[2].ui
= p
.uint32
[0];
7874 n
[3].ui
= p
.uint32
[1];
7875 save_pointer(&n
[4], sync
);
7877 if (ctx
->ExecuteFlag
) {
7878 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7883 /** GL_NV_conditional_render */
7884 static void GLAPIENTRY
7885 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7887 GET_CURRENT_CONTEXT(ctx
);
7889 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7890 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7895 if (ctx
->ExecuteFlag
) {
7896 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7900 static void GLAPIENTRY
7901 save_EndConditionalRender(void)
7903 GET_CURRENT_CONTEXT(ctx
);
7904 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7905 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7906 if (ctx
->ExecuteFlag
) {
7907 CALL_EndConditionalRender(ctx
->Exec
, ());
7911 static void GLAPIENTRY
7912 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7914 GET_CURRENT_CONTEXT(ctx
);
7916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7917 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7923 if (ctx
->ExecuteFlag
) {
7924 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7928 /** GL_EXT_window_rectangles */
7929 static void GLAPIENTRY
7930 save_WindowRectanglesEXT(GLenum mode
, GLsizei count
, const GLint
*box
)
7932 GET_CURRENT_CONTEXT(ctx
);
7934 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7935 n
= alloc_instruction(ctx
, OPCODE_WINDOW_RECTANGLES
, 2 + POINTER_DWORDS
);
7937 GLint
*box_copy
= NULL
;
7940 box_copy
= memdup(box
, sizeof(GLint
) * 4 * count
);
7943 save_pointer(&n
[3], box_copy
);
7945 if (ctx
->ExecuteFlag
) {
7946 CALL_WindowRectanglesEXT(ctx
->Exec
, (mode
, count
, box
));
7951 * Save an error-generating command into display list.
7953 * KW: Will appear in the list before the vertex buffer containing the
7954 * command that provoked the error. I don't see this as a problem.
7957 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7960 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
7963 save_pointer(&n
[2], (void *) s
);
7964 /* note: the data/string here doesn't have to be freed in
7965 * _mesa_delete_list() since the string is never dynamically
7973 * Compile an error into current display list.
7976 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7978 if (ctx
->CompileFlag
)
7979 save_error(ctx
, error
, s
);
7980 if (ctx
->ExecuteFlag
)
7981 _mesa_error(ctx
, error
, "%s", s
);
7986 * Test if ID names a display list.
7989 islist(struct gl_context
*ctx
, GLuint list
)
7991 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
8001 /**********************************************************************/
8002 /* Display list execution */
8003 /**********************************************************************/
8007 * Execute a display list. Note that the ListBase offset must have already
8008 * been added before calling this function. I.e. the list argument is
8009 * the absolute list number, not relative to ListBase.
8010 * \param list - display list number
8013 execute_list(struct gl_context
*ctx
, GLuint list
)
8015 struct gl_display_list
*dlist
;
8019 if (list
== 0 || !islist(ctx
, list
))
8022 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
8023 /* raise an error? */
8027 dlist
= _mesa_lookup_list(ctx
, list
);
8031 ctx
->ListState
.CallDepth
++;
8033 vbo_save_BeginCallList(ctx
, dlist
);
8039 const OpCode opcode
= n
[0].opcode
;
8041 if (is_ext_opcode(opcode
)) {
8042 n
+= ext_opcode_execute(ctx
, n
);
8047 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
8050 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8052 case OPCODE_ALPHA_FUNC
:
8053 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8055 case OPCODE_BIND_TEXTURE
:
8056 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8060 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8061 ctx
->Unpack
= ctx
->DefaultPacking
;
8062 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
8063 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
8064 get_pointer(&n
[7])));
8065 ctx
->Unpack
= save
; /* restore */
8068 case OPCODE_BLEND_COLOR
:
8069 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8071 case OPCODE_BLEND_EQUATION
:
8072 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
8074 case OPCODE_BLEND_EQUATION_SEPARATE
:
8075 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8077 case OPCODE_BLEND_FUNC_SEPARATE
:
8078 CALL_BlendFuncSeparate(ctx
->Exec
,
8079 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8082 case OPCODE_BLEND_FUNC_I
:
8083 /* GL_ARB_draw_buffers_blend */
8084 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
8086 case OPCODE_BLEND_FUNC_SEPARATE_I
:
8087 /* GL_ARB_draw_buffers_blend */
8088 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
8091 case OPCODE_BLEND_EQUATION_I
:
8092 /* GL_ARB_draw_buffers_blend */
8093 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8095 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
8096 /* GL_ARB_draw_buffers_blend */
8097 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
8098 (n
[1].ui
, n
[2].e
, n
[3].e
));
8101 case OPCODE_CALL_LIST
:
8102 /* Generated by glCallList(), don't add ListBase */
8103 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
8104 execute_list(ctx
, n
[1].ui
);
8107 case OPCODE_CALL_LISTS
:
8108 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
8109 CALL_CallLists(ctx
->Exec
, (n
[1].i
, n
[2].e
, get_pointer(&n
[3])));
8113 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
8115 case OPCODE_CLEAR_BUFFER_IV
:
8122 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8125 case OPCODE_CLEAR_BUFFER_UIV
:
8132 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8135 case OPCODE_CLEAR_BUFFER_FV
:
8142 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8145 case OPCODE_CLEAR_BUFFER_FI
:
8146 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
8148 case OPCODE_CLEAR_COLOR
:
8149 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8151 case OPCODE_CLEAR_ACCUM
:
8152 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8154 case OPCODE_CLEAR_DEPTH
:
8155 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
8157 case OPCODE_CLEAR_INDEX
:
8158 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
8160 case OPCODE_CLEAR_STENCIL
:
8161 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
8163 case OPCODE_CLIP_PLANE
:
8170 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
8173 case OPCODE_COLOR_MASK
:
8174 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
8176 case OPCODE_COLOR_MASK_INDEXED
:
8177 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
8180 case OPCODE_COLOR_MATERIAL
:
8181 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8183 case OPCODE_COPY_PIXELS
:
8184 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8185 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
8188 case OPCODE_COPY_TEX_IMAGE1D
:
8189 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
8190 n
[5].i
, n
[6].i
, n
[7].i
));
8192 case OPCODE_COPY_TEX_IMAGE2D
:
8193 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
8194 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
8196 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
8197 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8198 n
[4].i
, n
[5].i
, n
[6].i
));
8200 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
8201 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8202 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8205 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
8206 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8207 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8210 case OPCODE_CULL_FACE
:
8211 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
8213 case OPCODE_DEPTH_FUNC
:
8214 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
8216 case OPCODE_DEPTH_MASK
:
8217 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
8219 case OPCODE_DEPTH_RANGE
:
8220 CALL_DepthRange(ctx
->Exec
,
8221 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
8223 case OPCODE_DISABLE
:
8224 CALL_Disable(ctx
->Exec
, (n
[1].e
));
8226 case OPCODE_DISABLE_INDEXED
:
8227 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8229 case OPCODE_DRAW_BUFFER
:
8230 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
8232 case OPCODE_DRAW_PIXELS
:
8234 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8235 ctx
->Unpack
= ctx
->DefaultPacking
;
8236 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
8237 get_pointer(&n
[5])));
8238 ctx
->Unpack
= save
; /* restore */
8242 CALL_Enable(ctx
->Exec
, (n
[1].e
));
8244 case OPCODE_ENABLE_INDEXED
:
8245 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8247 case OPCODE_EVALMESH1
:
8248 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
8250 case OPCODE_EVALMESH2
:
8251 CALL_EvalMesh2(ctx
->Exec
,
8252 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8261 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
8264 case OPCODE_FRONT_FACE
:
8265 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
8267 case OPCODE_FRUSTUM
:
8268 CALL_Frustum(ctx
->Exec
,
8269 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8272 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8274 case OPCODE_INDEX_MASK
:
8275 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
8277 case OPCODE_INIT_NAMES
:
8278 CALL_InitNames(ctx
->Exec
, ());
8287 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
8290 case OPCODE_LIGHT_MODEL
:
8297 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
8300 case OPCODE_LINE_STIPPLE
:
8301 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
8303 case OPCODE_LINE_WIDTH
:
8304 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
8306 case OPCODE_LIST_BASE
:
8307 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
8309 case OPCODE_LOAD_IDENTITY
:
8310 CALL_LoadIdentity(ctx
->Exec
, ());
8312 case OPCODE_LOAD_MATRIX
:
8313 STATIC_ASSERT(sizeof(Node
) == sizeof(GLfloat
));
8314 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
8316 case OPCODE_LOAD_NAME
:
8317 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
8319 case OPCODE_LOGIC_OP
:
8320 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
8324 GLenum target
= n
[1].e
;
8325 GLint ustride
= _mesa_evaluator_components(target
);
8326 GLint uorder
= n
[5].i
;
8327 GLfloat u1
= n
[2].f
;
8328 GLfloat u2
= n
[3].f
;
8329 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8330 (GLfloat
*) get_pointer(&n
[6])));
8335 GLenum target
= n
[1].e
;
8336 GLfloat u1
= n
[2].f
;
8337 GLfloat u2
= n
[3].f
;
8338 GLfloat v1
= n
[4].f
;
8339 GLfloat v2
= n
[5].f
;
8340 GLint ustride
= n
[6].i
;
8341 GLint vstride
= n
[7].i
;
8342 GLint uorder
= n
[8].i
;
8343 GLint vorder
= n
[9].i
;
8344 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8345 v1
, v2
, vstride
, vorder
,
8346 (GLfloat
*) get_pointer(&n
[10])));
8349 case OPCODE_MAPGRID1
:
8350 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8352 case OPCODE_MAPGRID2
:
8353 CALL_MapGrid2f(ctx
->Exec
,
8354 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
8356 case OPCODE_MATRIX_MODE
:
8357 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
8359 case OPCODE_MULT_MATRIX
:
8360 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
8363 CALL_Ortho(ctx
->Exec
,
8364 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8366 case OPCODE_PASSTHROUGH
:
8367 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
8369 case OPCODE_PIXEL_MAP
:
8370 CALL_PixelMapfv(ctx
->Exec
,
8371 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
8373 case OPCODE_PIXEL_TRANSFER
:
8374 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8376 case OPCODE_PIXEL_ZOOM
:
8377 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8379 case OPCODE_POINT_SIZE
:
8380 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
8382 case OPCODE_POINT_PARAMETERS
:
8388 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8391 case OPCODE_POLYGON_MODE
:
8392 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8394 case OPCODE_POLYGON_STIPPLE
:
8396 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8397 ctx
->Unpack
= ctx
->DefaultPacking
;
8398 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
8399 ctx
->Unpack
= save
; /* restore */
8402 case OPCODE_POLYGON_OFFSET
:
8403 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8405 case OPCODE_POLYGON_OFFSET_CLAMP
:
8406 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8408 case OPCODE_POP_ATTRIB
:
8409 CALL_PopAttrib(ctx
->Exec
, ());
8411 case OPCODE_POP_MATRIX
:
8412 CALL_PopMatrix(ctx
->Exec
, ());
8414 case OPCODE_POP_NAME
:
8415 CALL_PopName(ctx
->Exec
, ());
8417 case OPCODE_PRIORITIZE_TEXTURE
:
8418 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
8420 case OPCODE_PUSH_ATTRIB
:
8421 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
8423 case OPCODE_PUSH_MATRIX
:
8424 CALL_PushMatrix(ctx
->Exec
, ());
8426 case OPCODE_PUSH_NAME
:
8427 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
8429 case OPCODE_RASTER_POS
:
8430 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8432 case OPCODE_READ_BUFFER
:
8433 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
8436 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8439 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8441 case OPCODE_SCISSOR
:
8442 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8444 case OPCODE_SHADE_MODEL
:
8445 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
8447 case OPCODE_PROVOKING_VERTEX
:
8448 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
8450 case OPCODE_STENCIL_FUNC
:
8451 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
8453 case OPCODE_STENCIL_MASK
:
8454 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
8456 case OPCODE_STENCIL_OP
:
8457 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
8459 case OPCODE_STENCIL_FUNC_SEPARATE
:
8460 CALL_StencilFuncSeparate(ctx
->Exec
,
8461 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
8463 case OPCODE_STENCIL_MASK_SEPARATE
:
8464 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8466 case OPCODE_STENCIL_OP_SEPARATE
:
8467 CALL_StencilOpSeparate(ctx
->Exec
,
8468 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8477 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8487 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8490 case OPCODE_TEXPARAMETER
:
8497 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8500 case OPCODE_TEX_IMAGE1D
:
8502 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8503 ctx
->Unpack
= ctx
->DefaultPacking
;
8504 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
8506 n
[3].i
, /* components */
8508 n
[5].e
, /* border */
8509 n
[6].e
, /* format */
8511 get_pointer(&n
[8])));
8512 ctx
->Unpack
= save
; /* restore */
8515 case OPCODE_TEX_IMAGE2D
:
8517 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8518 ctx
->Unpack
= ctx
->DefaultPacking
;
8519 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
8521 n
[3].i
, /* components */
8523 n
[5].i
, /* height */
8524 n
[6].e
, /* border */
8525 n
[7].e
, /* format */
8527 get_pointer(&n
[9])));
8528 ctx
->Unpack
= save
; /* restore */
8531 case OPCODE_TEX_IMAGE3D
:
8533 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8534 ctx
->Unpack
= ctx
->DefaultPacking
;
8535 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
8537 n
[3].i
, /* components */
8539 n
[5].i
, /* height */
8541 n
[7].e
, /* border */
8542 n
[8].e
, /* format */
8544 get_pointer(&n
[10])));
8545 ctx
->Unpack
= save
; /* restore */
8548 case OPCODE_TEX_SUB_IMAGE1D
:
8550 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8551 ctx
->Unpack
= ctx
->DefaultPacking
;
8552 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8554 n
[6].e
, get_pointer(&n
[7])));
8555 ctx
->Unpack
= save
; /* restore */
8558 case OPCODE_TEX_SUB_IMAGE2D
:
8560 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8561 ctx
->Unpack
= ctx
->DefaultPacking
;
8562 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8564 n
[6].i
, n
[7].e
, n
[8].e
,
8565 get_pointer(&n
[9])));
8566 ctx
->Unpack
= save
; /* restore */
8569 case OPCODE_TEX_SUB_IMAGE3D
:
8571 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8572 ctx
->Unpack
= ctx
->DefaultPacking
;
8573 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8574 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8575 n
[8].i
, n
[9].e
, n
[10].e
,
8576 get_pointer(&n
[11])));
8577 ctx
->Unpack
= save
; /* restore */
8580 case OPCODE_TRANSLATE
:
8581 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8583 case OPCODE_VIEWPORT
:
8584 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8585 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8587 case OPCODE_WINDOW_POS
:
8588 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8590 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8591 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8593 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8594 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8595 n
[4].i
, n
[5].i
, n
[6].i
,
8596 get_pointer(&n
[7])));
8598 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8599 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8600 n
[4].i
, n
[5].i
, n
[6].i
,
8601 n
[7].i
, get_pointer(&n
[8])));
8603 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8604 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8605 n
[4].i
, n
[5].i
, n
[6].i
,
8607 get_pointer(&n
[9])));
8609 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8610 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8611 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8613 get_pointer(&n
[7])));
8615 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8616 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8617 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8618 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8619 get_pointer(&n
[9])));
8621 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8622 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8623 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8624 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8626 get_pointer(&n
[11])));
8628 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8629 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8631 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8632 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8634 case OPCODE_BIND_PROGRAM_ARB
: /* GL_ARB_vertex_program */
8635 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8637 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8638 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8639 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8642 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8643 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8645 case OPCODE_DEPTH_BOUNDS_EXT
:
8646 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8648 case OPCODE_PROGRAM_STRING_ARB
:
8649 CALL_ProgramStringARB(ctx
->Exec
,
8650 (n
[1].e
, n
[2].e
, n
[3].i
,
8651 get_pointer(&n
[4])));
8653 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8654 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8658 case OPCODE_BEGIN_QUERY_ARB
:
8659 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8661 case OPCODE_END_QUERY_ARB
:
8662 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8664 case OPCODE_QUERY_COUNTER
:
8665 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8667 case OPCODE_BEGIN_QUERY_INDEXED
:
8668 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8670 case OPCODE_END_QUERY_INDEXED
:
8671 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8673 case OPCODE_DRAW_BUFFERS_ARB
:
8675 GLenum buffers
[MAX_DRAW_BUFFERS
];
8676 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8677 for (i
= 0; i
< count
; i
++)
8678 buffers
[i
] = n
[2 + i
].e
;
8679 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8682 case OPCODE_BLIT_FRAMEBUFFER
:
8683 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8684 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8687 case OPCODE_PRIMITIVE_RESTART_NV
:
8688 CALL_PrimitiveRestartNV(ctx
->Exec
, ());
8691 case OPCODE_USE_PROGRAM
:
8692 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8694 case OPCODE_UNIFORM_1F
:
8695 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8697 case OPCODE_UNIFORM_2F
:
8698 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8700 case OPCODE_UNIFORM_3F
:
8701 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8703 case OPCODE_UNIFORM_4F
:
8704 CALL_Uniform4f(ctx
->Exec
,
8705 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8707 case OPCODE_UNIFORM_1FV
:
8708 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8710 case OPCODE_UNIFORM_2FV
:
8711 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8713 case OPCODE_UNIFORM_3FV
:
8714 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8716 case OPCODE_UNIFORM_4FV
:
8717 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8719 case OPCODE_UNIFORM_1I
:
8720 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8722 case OPCODE_UNIFORM_2I
:
8723 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8725 case OPCODE_UNIFORM_3I
:
8726 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8728 case OPCODE_UNIFORM_4I
:
8729 CALL_Uniform4i(ctx
->Exec
,
8730 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8732 case OPCODE_UNIFORM_1IV
:
8733 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8735 case OPCODE_UNIFORM_2IV
:
8736 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8738 case OPCODE_UNIFORM_3IV
:
8739 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8741 case OPCODE_UNIFORM_4IV
:
8742 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8744 case OPCODE_UNIFORM_1UI
:
8745 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8747 case OPCODE_UNIFORM_2UI
:
8748 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8750 case OPCODE_UNIFORM_3UI
:
8751 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8753 case OPCODE_UNIFORM_4UI
:
8754 /*CALL_Uniform4uiARB(ctx->Exec,
8755 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8758 case OPCODE_UNIFORM_1UIV
:
8759 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
8760 get_pointer(&n[3])));*/
8762 case OPCODE_UNIFORM_2UIV
:
8763 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
8764 get_pointer(&n[3])));*/
8766 case OPCODE_UNIFORM_3UIV
:
8767 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
8768 get_pointer(&n[3])));*/
8770 case OPCODE_UNIFORM_4UIV
:
8771 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
8772 get_pointer(&n[3])));*/
8774 case OPCODE_UNIFORM_MATRIX22
:
8775 CALL_UniformMatrix2fv(ctx
->Exec
,
8776 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8778 case OPCODE_UNIFORM_MATRIX33
:
8779 CALL_UniformMatrix3fv(ctx
->Exec
,
8780 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8782 case OPCODE_UNIFORM_MATRIX44
:
8783 CALL_UniformMatrix4fv(ctx
->Exec
,
8784 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8786 case OPCODE_UNIFORM_MATRIX23
:
8787 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8788 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8790 case OPCODE_UNIFORM_MATRIX32
:
8791 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8792 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8794 case OPCODE_UNIFORM_MATRIX24
:
8795 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8796 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8798 case OPCODE_UNIFORM_MATRIX42
:
8799 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8800 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8802 case OPCODE_UNIFORM_MATRIX34
:
8803 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8804 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8806 case OPCODE_UNIFORM_MATRIX43
:
8807 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8808 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8811 case OPCODE_USE_PROGRAM_STAGES
:
8812 CALL_UseProgramStages(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8814 case OPCODE_PROGRAM_UNIFORM_1F
:
8815 CALL_ProgramUniform1f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
));
8817 case OPCODE_PROGRAM_UNIFORM_2F
:
8818 CALL_ProgramUniform2f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
, n
[4].f
));
8820 case OPCODE_PROGRAM_UNIFORM_3F
:
8821 CALL_ProgramUniform3f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8822 n
[3].f
, n
[4].f
, n
[5].f
));
8824 case OPCODE_PROGRAM_UNIFORM_4F
:
8825 CALL_ProgramUniform4f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8826 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8828 case OPCODE_PROGRAM_UNIFORM_1FV
:
8829 CALL_ProgramUniform1fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8830 get_pointer(&n
[4])));
8832 case OPCODE_PROGRAM_UNIFORM_2FV
:
8833 CALL_ProgramUniform2fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8834 get_pointer(&n
[4])));
8836 case OPCODE_PROGRAM_UNIFORM_3FV
:
8837 CALL_ProgramUniform3fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8838 get_pointer(&n
[4])));
8840 case OPCODE_PROGRAM_UNIFORM_4FV
:
8841 CALL_ProgramUniform4fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8842 get_pointer(&n
[4])));
8844 case OPCODE_PROGRAM_UNIFORM_1I
:
8845 CALL_ProgramUniform1i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
));
8847 case OPCODE_PROGRAM_UNIFORM_2I
:
8848 CALL_ProgramUniform2i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].i
));
8850 case OPCODE_PROGRAM_UNIFORM_3I
:
8851 CALL_ProgramUniform3i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8852 n
[3].i
, n
[4].i
, n
[5].i
));
8854 case OPCODE_PROGRAM_UNIFORM_4I
:
8855 CALL_ProgramUniform4i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8856 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
));
8858 case OPCODE_PROGRAM_UNIFORM_1IV
:
8859 CALL_ProgramUniform1iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8860 get_pointer(&n
[4])));
8862 case OPCODE_PROGRAM_UNIFORM_2IV
:
8863 CALL_ProgramUniform2iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8864 get_pointer(&n
[4])));
8866 case OPCODE_PROGRAM_UNIFORM_3IV
:
8867 CALL_ProgramUniform3iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8868 get_pointer(&n
[4])));
8870 case OPCODE_PROGRAM_UNIFORM_4IV
:
8871 CALL_ProgramUniform4iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8872 get_pointer(&n
[4])));
8874 case OPCODE_PROGRAM_UNIFORM_1UI
:
8875 CALL_ProgramUniform1ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].ui
));
8877 case OPCODE_PROGRAM_UNIFORM_2UI
:
8878 CALL_ProgramUniform2ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8881 case OPCODE_PROGRAM_UNIFORM_3UI
:
8882 CALL_ProgramUniform3ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8883 n
[3].ui
, n
[4].ui
, n
[5].ui
));
8885 case OPCODE_PROGRAM_UNIFORM_4UI
:
8886 CALL_ProgramUniform4ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8888 n
[4].ui
, n
[5].ui
, n
[6].ui
));
8890 case OPCODE_PROGRAM_UNIFORM_1UIV
:
8891 CALL_ProgramUniform1uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8892 get_pointer(&n
[4])));
8894 case OPCODE_PROGRAM_UNIFORM_2UIV
:
8895 CALL_ProgramUniform2uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8896 get_pointer(&n
[4])));
8898 case OPCODE_PROGRAM_UNIFORM_3UIV
:
8899 CALL_ProgramUniform3uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8900 get_pointer(&n
[4])));
8902 case OPCODE_PROGRAM_UNIFORM_4UIV
:
8903 CALL_ProgramUniform4uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8904 get_pointer(&n
[4])));
8906 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
8907 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
8908 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8909 get_pointer(&n
[5])));
8911 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
8912 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
8913 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8914 get_pointer(&n
[5])));
8916 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
8917 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
8918 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8919 get_pointer(&n
[5])));
8921 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
8922 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
8923 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8924 get_pointer(&n
[5])));
8926 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
8927 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
8928 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8929 get_pointer(&n
[5])));
8931 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
8932 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
8933 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8934 get_pointer(&n
[5])));
8936 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
8937 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
8938 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8939 get_pointer(&n
[5])));
8941 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
8942 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
8943 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8944 get_pointer(&n
[5])));
8946 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
8947 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
8948 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8949 get_pointer(&n
[5])));
8952 case OPCODE_CLIP_CONTROL
:
8953 CALL_ClipControl(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8956 case OPCODE_CLAMP_COLOR
:
8957 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8960 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8961 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8963 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8964 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (n
[1].ui
, &n
[2].f
));
8966 case OPCODE_ATTR_1F_NV
:
8967 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8969 case OPCODE_ATTR_2F_NV
:
8970 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8972 case OPCODE_ATTR_3F_NV
:
8973 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8975 case OPCODE_ATTR_4F_NV
:
8976 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8978 case OPCODE_ATTR_1F_ARB
:
8979 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8981 case OPCODE_ATTR_2F_ARB
:
8982 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8984 case OPCODE_ATTR_3F_ARB
:
8985 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8987 case OPCODE_ATTR_4F_ARB
:
8988 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8990 case OPCODE_MATERIAL
:
8991 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8994 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8997 CALL_End(ctx
->Exec
, ());
9000 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
9002 case OPCODE_EVAL_C1
:
9003 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
9005 case OPCODE_EVAL_C2
:
9006 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
9008 case OPCODE_EVAL_P1
:
9009 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
9011 case OPCODE_EVAL_P2
:
9012 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
9015 /* GL_EXT_texture_integer */
9016 case OPCODE_CLEARCOLOR_I
:
9017 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
9019 case OPCODE_CLEARCOLOR_UI
:
9020 CALL_ClearColorIuiEXT(ctx
->Exec
,
9021 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
9023 case OPCODE_TEXPARAMETER_I
:
9030 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
9033 case OPCODE_TEXPARAMETER_UI
:
9036 params
[0] = n
[3].ui
;
9037 params
[1] = n
[4].ui
;
9038 params
[2] = n
[5].ui
;
9039 params
[3] = n
[6].ui
;
9040 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
9044 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
9045 /* GL_ARB_instanced_arrays */
9046 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
9049 case OPCODE_TEXTURE_BARRIER_NV
:
9050 CALL_TextureBarrierNV(ctx
->Exec
, ());
9053 /* GL_EXT/ARB_transform_feedback */
9054 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
9055 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
9057 case OPCODE_END_TRANSFORM_FEEDBACK
:
9058 CALL_EndTransformFeedback(ctx
->Exec
, ());
9060 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
9061 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
9063 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
9064 CALL_PauseTransformFeedback(ctx
->Exec
, ());
9066 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
9067 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
9069 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
9070 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
9072 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
9073 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
9074 (n
[1].e
, n
[2].ui
, n
[3].ui
));
9076 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
9077 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
9078 (n
[1].e
, n
[2].ui
, n
[3].si
));
9080 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
9081 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
9082 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
9086 case OPCODE_BIND_SAMPLER
:
9087 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
9089 case OPCODE_SAMPLER_PARAMETERIV
:
9096 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9099 case OPCODE_SAMPLER_PARAMETERFV
:
9106 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9109 case OPCODE_SAMPLER_PARAMETERIIV
:
9116 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9119 case OPCODE_SAMPLER_PARAMETERUIV
:
9122 params
[0] = n
[3].ui
;
9123 params
[1] = n
[4].ui
;
9124 params
[2] = n
[5].ui
;
9125 params
[3] = n
[6].ui
;
9126 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9131 case OPCODE_WAIT_SYNC
:
9133 union uint64_pair p
;
9134 p
.uint32
[0] = n
[2].ui
;
9135 p
.uint32
[1] = n
[3].ui
;
9136 CALL_WaitSync(ctx
->Exec
,
9137 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
9141 /* GL_NV_conditional_render */
9142 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
9143 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
9145 case OPCODE_END_CONDITIONAL_RENDER
:
9146 CALL_EndConditionalRender(ctx
->Exec
, ());
9149 case OPCODE_UNIFORM_BLOCK_BINDING
:
9150 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
9153 /* GL_EXT_window_rectangles */
9154 case OPCODE_WINDOW_RECTANGLES
:
9155 CALL_WindowRectanglesEXT(
9156 ctx
->Exec
, (n
[1].e
, n
[2].si
, get_pointer(&n
[3])));
9159 case OPCODE_CONTINUE
:
9160 n
= (Node
*) get_pointer(&n
[1]);
9165 case OPCODE_END_OF_LIST
:
9171 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
9173 _mesa_problem(ctx
, "%s", msg
);
9178 /* increment n to point to next compiled command */
9179 if (opcode
!= OPCODE_CONTINUE
) {
9180 n
+= InstSize
[opcode
];
9185 vbo_save_EndCallList(ctx
);
9187 ctx
->ListState
.CallDepth
--;
9192 /**********************************************************************/
9194 /**********************************************************************/
9197 * Test if a display list number is valid.
9199 GLboolean GLAPIENTRY
9200 _mesa_IsList(GLuint list
)
9202 GET_CURRENT_CONTEXT(ctx
);
9203 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9204 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
9205 return islist(ctx
, list
);
9210 * Delete a sequence of consecutive display lists.
9213 _mesa_DeleteLists(GLuint list
, GLsizei range
)
9215 GET_CURRENT_CONTEXT(ctx
);
9217 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9218 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9221 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
9226 /* We may be deleting a set of bitmap lists. See if there's a
9227 * bitmap atlas to free.
9229 struct gl_bitmap_atlas
*atlas
= lookup_bitmap_atlas(ctx
, list
);
9231 _mesa_delete_bitmap_atlas(ctx
, atlas
);
9232 _mesa_HashRemove(ctx
->Shared
->BitmapAtlas
, list
);
9236 for (i
= list
; i
< list
+ range
; i
++) {
9237 destroy_list(ctx
, i
);
9243 * Return a display list number, n, such that lists n through n+range-1
9247 _mesa_GenLists(GLsizei range
)
9249 GET_CURRENT_CONTEXT(ctx
);
9251 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9252 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
9255 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
9263 * Make this an atomic operation
9265 _mesa_HashLockMutex(ctx
->Shared
->DisplayList
);
9267 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
9269 /* reserve the list IDs by with empty/dummy lists */
9271 for (i
= 0; i
< range
; i
++) {
9272 _mesa_HashInsertLocked(ctx
->Shared
->DisplayList
, base
+ i
,
9273 make_list(base
+ i
, 1));
9277 if (USE_BITMAP_ATLAS
&&
9279 ctx
->Driver
.DrawAtlasBitmaps
) {
9280 /* "range > 16" is a rough heuristic to guess when glGenLists might be
9281 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
9282 * Create the empty atlas now.
9284 struct gl_bitmap_atlas
*atlas
= lookup_bitmap_atlas(ctx
, base
);
9286 atlas
= alloc_bitmap_atlas(ctx
, base
);
9289 /* Atlas _should_ be new/empty now, but clobbering is OK */
9290 assert(atlas
->numBitmaps
== 0);
9291 atlas
->numBitmaps
= range
;
9295 _mesa_HashUnlockMutex(ctx
->Shared
->DisplayList
);
9302 * Begin a new display list.
9305 _mesa_NewList(GLuint name
, GLenum mode
)
9307 GET_CURRENT_CONTEXT(ctx
);
9309 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
9310 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9312 if (MESA_VERBOSE
& VERBOSE_API
)
9313 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
9314 _mesa_enum_to_string(mode
));
9317 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
9321 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
9322 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
9326 if (ctx
->ListState
.CurrentList
) {
9327 /* already compiling a display list */
9328 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
9332 ctx
->CompileFlag
= GL_TRUE
;
9333 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
9335 /* Reset accumulated list state */
9336 invalidate_saved_current_state( ctx
);
9338 /* Allocate new display list */
9339 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
9340 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
9341 ctx
->ListState
.CurrentPos
= 0;
9343 vbo_save_NewList(ctx
, name
, mode
);
9345 ctx
->CurrentServerDispatch
= ctx
->Save
;
9346 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9347 if (ctx
->MarshalExec
== NULL
) {
9348 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9354 * End definition of current display list.
9359 GET_CURRENT_CONTEXT(ctx
);
9360 SAVE_FLUSH_VERTICES(ctx
);
9361 FLUSH_VERTICES(ctx
, 0);
9363 if (MESA_VERBOSE
& VERBOSE_API
)
9364 _mesa_debug(ctx
, "glEndList\n");
9366 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
9367 _mesa_error(ctx
, GL_INVALID_OPERATION
,
9368 "glEndList() called inside glBegin/End");
9371 /* Check that a list is under construction */
9372 if (!ctx
->ListState
.CurrentList
) {
9373 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
9377 /* Call before emitting END_OF_LIST, in case the driver wants to
9378 * emit opcodes itself.
9380 vbo_save_EndList(ctx
);
9382 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
9386 /* Destroy old list, if any */
9387 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
9389 /* Install the new list */
9390 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
9391 ctx
->ListState
.CurrentList
->Name
,
9392 ctx
->ListState
.CurrentList
);
9395 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
9396 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
9398 ctx
->ListState
.CurrentList
= NULL
;
9399 ctx
->ListState
.CurrentBlock
= NULL
;
9400 ctx
->ListState
.CurrentPos
= 0;
9401 ctx
->ExecuteFlag
= GL_TRUE
;
9402 ctx
->CompileFlag
= GL_FALSE
;
9404 ctx
->CurrentServerDispatch
= ctx
->Exec
;
9405 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9406 if (ctx
->MarshalExec
== NULL
) {
9407 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9413 _mesa_CallList(GLuint list
)
9415 GLboolean save_compile_flag
;
9416 GET_CURRENT_CONTEXT(ctx
);
9417 FLUSH_CURRENT(ctx
, 0);
9419 if (MESA_VERBOSE
& VERBOSE_API
)
9420 _mesa_debug(ctx
, "glCallList %d\n", list
);
9423 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
9428 mesa_print_display_list( list
);
9430 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9431 * execute the display list, and restore the CompileFlag.
9433 save_compile_flag
= ctx
->CompileFlag
;
9434 if (save_compile_flag
) {
9435 ctx
->CompileFlag
= GL_FALSE
;
9438 execute_list(ctx
, list
);
9439 ctx
->CompileFlag
= save_compile_flag
;
9441 /* also restore API function pointers to point to "save" versions */
9442 if (save_compile_flag
) {
9443 ctx
->CurrentServerDispatch
= ctx
->Save
;
9444 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9445 if (ctx
->MarshalExec
== NULL
) {
9446 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9453 * Try to execute a glCallLists() command where the display lists contain
9454 * glBitmap commands with a texture atlas.
9455 * \return true for success, false otherwise
9458 render_bitmap_atlas(struct gl_context
*ctx
, GLsizei n
, GLenum type
,
9461 struct gl_bitmap_atlas
*atlas
;
9464 if (!USE_BITMAP_ATLAS
||
9465 !ctx
->Current
.RasterPosValid
||
9466 ctx
->List
.ListBase
== 0 ||
9467 type
!= GL_UNSIGNED_BYTE
||
9468 !ctx
->Driver
.DrawAtlasBitmaps
) {
9473 atlas
= lookup_bitmap_atlas(ctx
, ctx
->List
.ListBase
);
9476 /* Even if glGenLists wasn't called, we can still try to create
9479 atlas
= alloc_bitmap_atlas(ctx
, ctx
->List
.ListBase
);
9482 if (atlas
&& !atlas
->complete
&& !atlas
->incomplete
) {
9483 /* Try to build the bitmap atlas now.
9484 * If the atlas was created in glGenLists, we'll have recorded the
9485 * number of lists (bitmaps). Otherwise, take a guess at 256.
9487 if (atlas
->numBitmaps
== 0)
9488 atlas
->numBitmaps
= 256;
9489 build_bitmap_atlas(ctx
, atlas
, ctx
->List
.ListBase
);
9492 if (!atlas
|| !atlas
->complete
) {
9496 /* check that all display list IDs are in the atlas */
9497 for (i
= 0; i
< n
; i
++) {
9498 const GLubyte
*ids
= (const GLubyte
*) lists
;
9500 if (ids
[i
] >= atlas
->numBitmaps
) {
9505 ctx
->Driver
.DrawAtlasBitmaps(ctx
, atlas
, n
, (const GLubyte
*) lists
);
9512 * Execute glCallLists: call multiple display lists.
9515 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
9517 GET_CURRENT_CONTEXT(ctx
);
9519 GLboolean save_compile_flag
;
9521 if (MESA_VERBOSE
& VERBOSE_API
)
9522 _mesa_debug(ctx
, "glCallLists %d\n", n
);
9526 case GL_UNSIGNED_BYTE
:
9528 case GL_UNSIGNED_SHORT
:
9530 case GL_UNSIGNED_INT
:
9538 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
9543 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallLists(n < 0)");
9545 } else if (n
== 0 || lists
== NULL
) {
9550 if (render_bitmap_atlas(ctx
, n
, type
, lists
)) {
9554 /* Save the CompileFlag status, turn it off, execute display list,
9555 * and restore the CompileFlag.
9557 save_compile_flag
= ctx
->CompileFlag
;
9558 ctx
->CompileFlag
= GL_FALSE
;
9560 for (i
= 0; i
< n
; i
++) {
9561 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
9562 execute_list(ctx
, list
);
9565 ctx
->CompileFlag
= save_compile_flag
;
9567 /* also restore API function pointers to point to "save" versions */
9568 if (save_compile_flag
) {
9569 ctx
->CurrentServerDispatch
= ctx
->Save
;
9570 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9571 if (ctx
->MarshalExec
== NULL
) {
9572 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9579 * Set the offset added to list numbers in glCallLists.
9582 _mesa_ListBase(GLuint base
)
9584 GET_CURRENT_CONTEXT(ctx
);
9585 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9586 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9587 ctx
->List
.ListBase
= base
;
9591 * Setup the given dispatch table to point to Mesa's display list
9592 * building functions.
9594 * This does not include any of the tnl functions - they are
9595 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9599 _mesa_initialize_save_table(const struct gl_context
*ctx
)
9601 struct _glapi_table
*table
= ctx
->Save
;
9602 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
9604 /* Initially populate the dispatch table with the contents of the
9605 * normal-execution dispatch table. This lets us skip populating functions
9606 * that should be called directly instead of compiled into display lists.
9608 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
9610 _mesa_loopback_init_api_table(ctx
, table
);
9613 vbo_initialize_save_dispatch(ctx
, table
);
9616 SET_Accum(table
, save_Accum
);
9617 SET_AlphaFunc(table
, save_AlphaFunc
);
9618 SET_Bitmap(table
, save_Bitmap
);
9619 SET_BlendFunc(table
, save_BlendFunc
);
9620 SET_CallList(table
, save_CallList
);
9621 SET_CallLists(table
, save_CallLists
);
9622 SET_Clear(table
, save_Clear
);
9623 SET_ClearAccum(table
, save_ClearAccum
);
9624 SET_ClearColor(table
, save_ClearColor
);
9625 SET_ClearDepth(table
, save_ClearDepth
);
9626 SET_ClearIndex(table
, save_ClearIndex
);
9627 SET_ClearStencil(table
, save_ClearStencil
);
9628 SET_ClipPlane(table
, save_ClipPlane
);
9629 SET_ColorMask(table
, save_ColorMask
);
9630 SET_ColorMaski(table
, save_ColorMaskIndexed
);
9631 SET_ColorMaterial(table
, save_ColorMaterial
);
9632 SET_CopyPixels(table
, save_CopyPixels
);
9633 SET_CullFace(table
, save_CullFace
);
9634 SET_DepthFunc(table
, save_DepthFunc
);
9635 SET_DepthMask(table
, save_DepthMask
);
9636 SET_DepthRange(table
, save_DepthRange
);
9637 SET_Disable(table
, save_Disable
);
9638 SET_Disablei(table
, save_DisableIndexed
);
9639 SET_DrawBuffer(table
, save_DrawBuffer
);
9640 SET_DrawPixels(table
, save_DrawPixels
);
9641 SET_Enable(table
, save_Enable
);
9642 SET_Enablei(table
, save_EnableIndexed
);
9643 SET_EvalMesh1(table
, save_EvalMesh1
);
9644 SET_EvalMesh2(table
, save_EvalMesh2
);
9645 SET_Fogf(table
, save_Fogf
);
9646 SET_Fogfv(table
, save_Fogfv
);
9647 SET_Fogi(table
, save_Fogi
);
9648 SET_Fogiv(table
, save_Fogiv
);
9649 SET_FrontFace(table
, save_FrontFace
);
9650 SET_Frustum(table
, save_Frustum
);
9651 SET_Hint(table
, save_Hint
);
9652 SET_IndexMask(table
, save_IndexMask
);
9653 SET_InitNames(table
, save_InitNames
);
9654 SET_LightModelf(table
, save_LightModelf
);
9655 SET_LightModelfv(table
, save_LightModelfv
);
9656 SET_LightModeli(table
, save_LightModeli
);
9657 SET_LightModeliv(table
, save_LightModeliv
);
9658 SET_Lightf(table
, save_Lightf
);
9659 SET_Lightfv(table
, save_Lightfv
);
9660 SET_Lighti(table
, save_Lighti
);
9661 SET_Lightiv(table
, save_Lightiv
);
9662 SET_LineStipple(table
, save_LineStipple
);
9663 SET_LineWidth(table
, save_LineWidth
);
9664 SET_ListBase(table
, save_ListBase
);
9665 SET_LoadIdentity(table
, save_LoadIdentity
);
9666 SET_LoadMatrixd(table
, save_LoadMatrixd
);
9667 SET_LoadMatrixf(table
, save_LoadMatrixf
);
9668 SET_LoadName(table
, save_LoadName
);
9669 SET_LogicOp(table
, save_LogicOp
);
9670 SET_Map1d(table
, save_Map1d
);
9671 SET_Map1f(table
, save_Map1f
);
9672 SET_Map2d(table
, save_Map2d
);
9673 SET_Map2f(table
, save_Map2f
);
9674 SET_MapGrid1d(table
, save_MapGrid1d
);
9675 SET_MapGrid1f(table
, save_MapGrid1f
);
9676 SET_MapGrid2d(table
, save_MapGrid2d
);
9677 SET_MapGrid2f(table
, save_MapGrid2f
);
9678 SET_MatrixMode(table
, save_MatrixMode
);
9679 SET_MultMatrixd(table
, save_MultMatrixd
);
9680 SET_MultMatrixf(table
, save_MultMatrixf
);
9681 SET_NewList(table
, save_NewList
);
9682 SET_Ortho(table
, save_Ortho
);
9683 SET_PassThrough(table
, save_PassThrough
);
9684 SET_PixelMapfv(table
, save_PixelMapfv
);
9685 SET_PixelMapuiv(table
, save_PixelMapuiv
);
9686 SET_PixelMapusv(table
, save_PixelMapusv
);
9687 SET_PixelTransferf(table
, save_PixelTransferf
);
9688 SET_PixelTransferi(table
, save_PixelTransferi
);
9689 SET_PixelZoom(table
, save_PixelZoom
);
9690 SET_PointSize(table
, save_PointSize
);
9691 SET_PolygonMode(table
, save_PolygonMode
);
9692 SET_PolygonOffset(table
, save_PolygonOffset
);
9693 SET_PolygonStipple(table
, save_PolygonStipple
);
9694 SET_PopAttrib(table
, save_PopAttrib
);
9695 SET_PopMatrix(table
, save_PopMatrix
);
9696 SET_PopName(table
, save_PopName
);
9697 SET_PushAttrib(table
, save_PushAttrib
);
9698 SET_PushMatrix(table
, save_PushMatrix
);
9699 SET_PushName(table
, save_PushName
);
9700 SET_RasterPos2d(table
, save_RasterPos2d
);
9701 SET_RasterPos2dv(table
, save_RasterPos2dv
);
9702 SET_RasterPos2f(table
, save_RasterPos2f
);
9703 SET_RasterPos2fv(table
, save_RasterPos2fv
);
9704 SET_RasterPos2i(table
, save_RasterPos2i
);
9705 SET_RasterPos2iv(table
, save_RasterPos2iv
);
9706 SET_RasterPos2s(table
, save_RasterPos2s
);
9707 SET_RasterPos2sv(table
, save_RasterPos2sv
);
9708 SET_RasterPos3d(table
, save_RasterPos3d
);
9709 SET_RasterPos3dv(table
, save_RasterPos3dv
);
9710 SET_RasterPos3f(table
, save_RasterPos3f
);
9711 SET_RasterPos3fv(table
, save_RasterPos3fv
);
9712 SET_RasterPos3i(table
, save_RasterPos3i
);
9713 SET_RasterPos3iv(table
, save_RasterPos3iv
);
9714 SET_RasterPos3s(table
, save_RasterPos3s
);
9715 SET_RasterPos3sv(table
, save_RasterPos3sv
);
9716 SET_RasterPos4d(table
, save_RasterPos4d
);
9717 SET_RasterPos4dv(table
, save_RasterPos4dv
);
9718 SET_RasterPos4f(table
, save_RasterPos4f
);
9719 SET_RasterPos4fv(table
, save_RasterPos4fv
);
9720 SET_RasterPos4i(table
, save_RasterPos4i
);
9721 SET_RasterPos4iv(table
, save_RasterPos4iv
);
9722 SET_RasterPos4s(table
, save_RasterPos4s
);
9723 SET_RasterPos4sv(table
, save_RasterPos4sv
);
9724 SET_ReadBuffer(table
, save_ReadBuffer
);
9725 SET_Rectf(table
, save_Rectf
);
9726 SET_Rotated(table
, save_Rotated
);
9727 SET_Rotatef(table
, save_Rotatef
);
9728 SET_Scaled(table
, save_Scaled
);
9729 SET_Scalef(table
, save_Scalef
);
9730 SET_Scissor(table
, save_Scissor
);
9731 SET_ShadeModel(table
, save_ShadeModel
);
9732 SET_StencilFunc(table
, save_StencilFunc
);
9733 SET_StencilMask(table
, save_StencilMask
);
9734 SET_StencilOp(table
, save_StencilOp
);
9735 SET_TexEnvf(table
, save_TexEnvf
);
9736 SET_TexEnvfv(table
, save_TexEnvfv
);
9737 SET_TexEnvi(table
, save_TexEnvi
);
9738 SET_TexEnviv(table
, save_TexEnviv
);
9739 SET_TexGend(table
, save_TexGend
);
9740 SET_TexGendv(table
, save_TexGendv
);
9741 SET_TexGenf(table
, save_TexGenf
);
9742 SET_TexGenfv(table
, save_TexGenfv
);
9743 SET_TexGeni(table
, save_TexGeni
);
9744 SET_TexGeniv(table
, save_TexGeniv
);
9745 SET_TexImage1D(table
, save_TexImage1D
);
9746 SET_TexImage2D(table
, save_TexImage2D
);
9747 SET_TexParameterf(table
, save_TexParameterf
);
9748 SET_TexParameterfv(table
, save_TexParameterfv
);
9749 SET_TexParameteri(table
, save_TexParameteri
);
9750 SET_TexParameteriv(table
, save_TexParameteriv
);
9751 SET_Translated(table
, save_Translated
);
9752 SET_Translatef(table
, save_Translatef
);
9753 SET_Viewport(table
, save_Viewport
);
9756 SET_BindTexture(table
, save_BindTexture
);
9757 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
9758 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
9759 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
9760 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
9761 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
9762 SET_TexSubImage1D(table
, save_TexSubImage1D
);
9763 SET_TexSubImage2D(table
, save_TexSubImage2D
);
9766 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
9767 SET_TexImage3D(table
, save_TexImage3D
);
9768 SET_TexSubImage3D(table
, save_TexSubImage3D
);
9771 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
9772 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
9773 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
9775 /* ATI_separate_stencil */
9776 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
9778 /* GL_ARB_imaging */
9779 /* Not all are supported */
9780 SET_BlendColor(table
, save_BlendColor
);
9781 SET_BlendEquation(table
, save_BlendEquation
);
9783 /* 2. GL_EXT_blend_color */
9785 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9788 /* 3. GL_EXT_polygon_offset */
9789 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9791 /* 6. GL_EXT_texture3d */
9793 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9794 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9795 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9798 /* 37. GL_EXT_blend_minmax */
9800 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9803 /* 54. GL_EXT_point_parameters */
9804 SET_PointParameterf(table
, save_PointParameterfEXT
);
9805 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9807 /* 173. GL_EXT_blend_func_separate */
9808 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9810 /* 197. GL_MESA_window_pos */
9811 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9812 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9813 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9814 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9815 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9816 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9817 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9818 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9819 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9820 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9821 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9822 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9823 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9824 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9825 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9826 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9827 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9828 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9829 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9830 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9831 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9832 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9833 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9834 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9836 /* 245. GL_ATI_fragment_shader */
9837 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9838 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9840 /* 262. GL_NV_point_sprite */
9841 SET_PointParameteri(table
, save_PointParameteriNV
);
9842 SET_PointParameteriv(table
, save_PointParameterivNV
);
9844 /* 268. GL_EXT_stencil_two_side */
9845 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9847 /* ???. GL_EXT_depth_bounds_test */
9848 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9850 /* ARB 1. GL_ARB_multitexture */
9851 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9853 /* ARB 3. GL_ARB_transpose_matrix */
9854 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9855 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9856 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9857 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9859 /* ARB 5. GL_ARB_multisample */
9860 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9862 /* ARB 12. GL_ARB_texture_compression */
9863 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9864 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9865 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9866 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9867 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9868 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9870 /* ARB 14. GL_ARB_point_parameters */
9871 /* aliased with EXT_point_parameters functions */
9873 /* ARB 25. GL_ARB_window_pos */
9874 /* aliased with MESA_window_pos functions */
9876 /* ARB 26. GL_ARB_vertex_program */
9877 /* ARB 27. GL_ARB_fragment_program */
9878 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9879 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9880 SET_BindProgramARB(table
, save_BindProgramARB
);
9881 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9882 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9883 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9884 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9885 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9886 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9887 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9888 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9890 SET_BeginQuery(table
, save_BeginQueryARB
);
9891 SET_EndQuery(table
, save_EndQueryARB
);
9892 SET_QueryCounter(table
, save_QueryCounter
);
9894 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9896 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9898 SET_UseProgram(table
, save_UseProgram
);
9899 SET_Uniform1f(table
, save_Uniform1fARB
);
9900 SET_Uniform2f(table
, save_Uniform2fARB
);
9901 SET_Uniform3f(table
, save_Uniform3fARB
);
9902 SET_Uniform4f(table
, save_Uniform4fARB
);
9903 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9904 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9905 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9906 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9907 SET_Uniform1i(table
, save_Uniform1iARB
);
9908 SET_Uniform2i(table
, save_Uniform2iARB
);
9909 SET_Uniform3i(table
, save_Uniform3iARB
);
9910 SET_Uniform4i(table
, save_Uniform4iARB
);
9911 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9912 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9913 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9914 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9915 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9916 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9917 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9918 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9919 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9920 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9921 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9922 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9923 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9925 /* 299. GL_EXT_blend_equation_separate */
9926 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9928 /* GL_EXT_gpu_program_parameters */
9929 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9930 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9932 /* 364. GL_EXT_provoking_vertex */
9933 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9935 /* GL_EXT_texture_integer */
9936 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9937 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9938 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9939 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9941 /* GL_ARB_clip_control */
9942 SET_ClipControl(table
, save_ClipControl
);
9944 /* GL_ARB_color_buffer_float */
9945 SET_ClampColor(table
, save_ClampColorARB
);
9948 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9949 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9950 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9951 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9953 SET_Uniform1ui(table
, save_Uniform1ui
);
9954 SET_Uniform2ui(table
, save_Uniform2ui
);
9955 SET_Uniform3ui(table
, save_Uniform3ui
);
9956 SET_Uniform4ui(table
, save_Uniform4ui
);
9957 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9958 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9959 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9960 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9962 (void) save_Uniform1ui
;
9963 (void) save_Uniform2ui
;
9964 (void) save_Uniform3ui
;
9965 (void) save_Uniform4ui
;
9966 (void) save_Uniform1uiv
;
9967 (void) save_Uniform2uiv
;
9968 (void) save_Uniform3uiv
;
9969 (void) save_Uniform4uiv
;
9973 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9974 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9975 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9976 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9977 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9978 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9979 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9980 SET_DrawTransformFeedbackInstanced(table
,
9981 save_DrawTransformFeedbackInstanced
);
9982 SET_DrawTransformFeedbackStreamInstanced(table
,
9983 save_DrawTransformFeedbackStreamInstanced
);
9984 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9985 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9987 /* GL_ARB_instanced_arrays */
9988 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9990 /* GL_NV_texture_barrier */
9991 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9993 SET_BindSampler(table
, save_BindSampler
);
9994 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9995 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9996 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9997 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9998 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9999 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
10001 /* GL_ARB_draw_buffer_blend */
10002 SET_BlendFunciARB(table
, save_BlendFunci
);
10003 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
10004 SET_BlendEquationiARB(table
, save_BlendEquationi
);
10005 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
10007 /* GL_NV_conditional_render */
10008 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
10009 SET_EndConditionalRender(table
, save_EndConditionalRender
);
10012 SET_WaitSync(table
, save_WaitSync
);
10014 /* GL_ARB_uniform_buffer_object */
10015 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
10017 /* GL_ARB_draw_instanced */
10018 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
10019 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
10021 /* GL_ARB_draw_elements_base_vertex */
10022 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
10024 /* GL_ARB_base_instance */
10025 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
10026 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
10027 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
10029 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
10030 SET_UseProgramStages(table
, save_UseProgramStages
);
10031 SET_ProgramUniform1f(table
, save_ProgramUniform1f
);
10032 SET_ProgramUniform2f(table
, save_ProgramUniform2f
);
10033 SET_ProgramUniform3f(table
, save_ProgramUniform3f
);
10034 SET_ProgramUniform4f(table
, save_ProgramUniform4f
);
10035 SET_ProgramUniform1fv(table
, save_ProgramUniform1fv
);
10036 SET_ProgramUniform2fv(table
, save_ProgramUniform2fv
);
10037 SET_ProgramUniform3fv(table
, save_ProgramUniform3fv
);
10038 SET_ProgramUniform4fv(table
, save_ProgramUniform4fv
);
10039 SET_ProgramUniform1i(table
, save_ProgramUniform1i
);
10040 SET_ProgramUniform2i(table
, save_ProgramUniform2i
);
10041 SET_ProgramUniform3i(table
, save_ProgramUniform3i
);
10042 SET_ProgramUniform4i(table
, save_ProgramUniform4i
);
10043 SET_ProgramUniform1iv(table
, save_ProgramUniform1iv
);
10044 SET_ProgramUniform2iv(table
, save_ProgramUniform2iv
);
10045 SET_ProgramUniform3iv(table
, save_ProgramUniform3iv
);
10046 SET_ProgramUniform4iv(table
, save_ProgramUniform4iv
);
10047 SET_ProgramUniform1ui(table
, save_ProgramUniform1ui
);
10048 SET_ProgramUniform2ui(table
, save_ProgramUniform2ui
);
10049 SET_ProgramUniform3ui(table
, save_ProgramUniform3ui
);
10050 SET_ProgramUniform4ui(table
, save_ProgramUniform4ui
);
10051 SET_ProgramUniform1uiv(table
, save_ProgramUniform1uiv
);
10052 SET_ProgramUniform2uiv(table
, save_ProgramUniform2uiv
);
10053 SET_ProgramUniform3uiv(table
, save_ProgramUniform3uiv
);
10054 SET_ProgramUniform4uiv(table
, save_ProgramUniform4uiv
);
10055 SET_ProgramUniformMatrix2fv(table
, save_ProgramUniformMatrix2fv
);
10056 SET_ProgramUniformMatrix3fv(table
, save_ProgramUniformMatrix3fv
);
10057 SET_ProgramUniformMatrix4fv(table
, save_ProgramUniformMatrix4fv
);
10058 SET_ProgramUniformMatrix2x3fv(table
, save_ProgramUniformMatrix2x3fv
);
10059 SET_ProgramUniformMatrix3x2fv(table
, save_ProgramUniformMatrix3x2fv
);
10060 SET_ProgramUniformMatrix2x4fv(table
, save_ProgramUniformMatrix2x4fv
);
10061 SET_ProgramUniformMatrix4x2fv(table
, save_ProgramUniformMatrix4x2fv
);
10062 SET_ProgramUniformMatrix3x4fv(table
, save_ProgramUniformMatrix3x4fv
);
10063 SET_ProgramUniformMatrix4x3fv(table
, save_ProgramUniformMatrix4x3fv
);
10065 /* GL_{ARB,EXT}_polygon_offset_clamp */
10066 SET_PolygonOffsetClampEXT(table
, save_PolygonOffsetClampEXT
);
10068 /* GL_EXT_window_rectangles */
10069 SET_WindowRectanglesEXT(table
, save_WindowRectanglesEXT
);
10074 static const char *
10075 enum_string(GLenum k
)
10077 return _mesa_enum_to_string(k
);
10082 * Print the commands in a display list. For debugging only.
10083 * TODO: many commands aren't handled yet.
10084 * \param fname filename to write display list to. If null, use stdout.
10086 static void GLAPIENTRY
10087 print_list(struct gl_context
*ctx
, GLuint list
, const char *fname
)
10089 struct gl_display_list
*dlist
;
10095 f
= fopen(fname
, "w");
10100 if (!islist(ctx
, list
)) {
10101 fprintf(f
, "%u is not a display list ID\n", list
);
10105 dlist
= _mesa_lookup_list(ctx
, list
);
10112 fprintf(f
, "START-LIST %u, address %p\n", list
, (void *) n
);
10114 done
= n
? GL_FALSE
: GL_TRUE
;
10116 const OpCode opcode
= n
[0].opcode
;
10118 if (is_ext_opcode(opcode
)) {
10119 n
+= ext_opcode_print(ctx
, n
, f
);
10124 fprintf(f
, "Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
10126 case OPCODE_ACTIVE_TEXTURE
:
10127 fprintf(f
, "ActiveTexture(%s)\n", enum_string(n
[1].e
));
10129 case OPCODE_BITMAP
:
10130 fprintf(f
, "Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
10131 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
10132 get_pointer(&n
[7]));
10134 case OPCODE_BLEND_COLOR
:
10135 fprintf(f
, "BlendColor %f, %f, %f, %f\n",
10136 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10138 case OPCODE_BLEND_EQUATION
:
10139 fprintf(f
, "BlendEquation %s\n",
10140 enum_string(n
[1].e
));
10142 case OPCODE_BLEND_EQUATION_SEPARATE
:
10143 fprintf(f
, "BlendEquationSeparate %s, %s\n",
10144 enum_string(n
[1].e
),
10145 enum_string(n
[2].e
));
10147 case OPCODE_BLEND_FUNC_SEPARATE
:
10148 fprintf(f
, "BlendFuncSeparate %s, %s, %s, %s\n",
10149 enum_string(n
[1].e
),
10150 enum_string(n
[2].e
),
10151 enum_string(n
[3].e
),
10152 enum_string(n
[4].e
));
10154 case OPCODE_BLEND_EQUATION_I
:
10155 fprintf(f
, "BlendEquationi %u, %s\n",
10156 n
[1].ui
, enum_string(n
[2].e
));
10158 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
10159 fprintf(f
, "BlendEquationSeparatei %u, %s, %s\n",
10160 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
10162 case OPCODE_BLEND_FUNC_I
:
10163 fprintf(f
, "BlendFunci %u, %s, %s\n",
10164 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
10166 case OPCODE_BLEND_FUNC_SEPARATE_I
:
10167 fprintf(f
, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
10169 enum_string(n
[2].e
),
10170 enum_string(n
[3].e
),
10171 enum_string(n
[4].e
),
10172 enum_string(n
[5].e
));
10174 case OPCODE_CALL_LIST
:
10175 fprintf(f
, "CallList %d\n", (int) n
[1].ui
);
10177 case OPCODE_CALL_LISTS
:
10178 fprintf(f
, "CallLists %d, %s\n", n
[1].i
, enum_string(n
[1].e
));
10180 case OPCODE_DISABLE
:
10181 fprintf(f
, "Disable %s\n", enum_string(n
[1].e
));
10183 case OPCODE_ENABLE
:
10184 fprintf(f
, "Enable %s\n", enum_string(n
[1].e
));
10186 case OPCODE_FRUSTUM
:
10187 fprintf(f
, "Frustum %g %g %g %g %g %g\n",
10188 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10190 case OPCODE_LINE_STIPPLE
:
10191 fprintf(f
, "LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
10193 case OPCODE_LINE_WIDTH
:
10194 fprintf(f
, "LineWidth %f\n", n
[1].f
);
10196 case OPCODE_LOAD_IDENTITY
:
10197 fprintf(f
, "LoadIdentity\n");
10199 case OPCODE_LOAD_MATRIX
:
10200 fprintf(f
, "LoadMatrix\n");
10201 fprintf(f
, " %8f %8f %8f %8f\n",
10202 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
10203 fprintf(f
, " %8f %8f %8f %8f\n",
10204 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
10205 fprintf(f
, " %8f %8f %8f %8f\n",
10206 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
10207 fprintf(f
, " %8f %8f %8f %8f\n",
10208 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
10210 case OPCODE_MULT_MATRIX
:
10211 fprintf(f
, "MultMatrix (or Rotate)\n");
10212 fprintf(f
, " %8f %8f %8f %8f\n",
10213 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
10214 fprintf(f
, " %8f %8f %8f %8f\n",
10215 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
10216 fprintf(f
, " %8f %8f %8f %8f\n",
10217 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
10218 fprintf(f
, " %8f %8f %8f %8f\n",
10219 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
10222 fprintf(f
, "Ortho %g %g %g %g %g %g\n",
10223 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10225 case OPCODE_POINT_SIZE
:
10226 fprintf(f
, "PointSize %f\n", n
[1].f
);
10228 case OPCODE_POP_ATTRIB
:
10229 fprintf(f
, "PopAttrib\n");
10231 case OPCODE_POP_MATRIX
:
10232 fprintf(f
, "PopMatrix\n");
10234 case OPCODE_POP_NAME
:
10235 fprintf(f
, "PopName\n");
10237 case OPCODE_PUSH_ATTRIB
:
10238 fprintf(f
, "PushAttrib %x\n", n
[1].bf
);
10240 case OPCODE_PUSH_MATRIX
:
10241 fprintf(f
, "PushMatrix\n");
10243 case OPCODE_PUSH_NAME
:
10244 fprintf(f
, "PushName %d\n", (int) n
[1].ui
);
10246 case OPCODE_RASTER_POS
:
10247 fprintf(f
, "RasterPos %g %g %g %g\n",
10248 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10250 case OPCODE_ROTATE
:
10251 fprintf(f
, "Rotate %g %g %g %g\n",
10252 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10255 fprintf(f
, "Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
10257 case OPCODE_TRANSLATE
:
10258 fprintf(f
, "Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
10260 case OPCODE_BIND_TEXTURE
:
10261 fprintf(f
, "BindTexture %s %d\n",
10262 _mesa_enum_to_string(n
[1].ui
), n
[2].ui
);
10264 case OPCODE_SHADE_MODEL
:
10265 fprintf(f
, "ShadeModel %s\n", _mesa_enum_to_string(n
[1].ui
));
10268 fprintf(f
, "Map1 %s %.3f %.3f %d %d\n",
10269 _mesa_enum_to_string(n
[1].ui
),
10270 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
10273 fprintf(f
, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
10274 _mesa_enum_to_string(n
[1].ui
),
10275 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
10276 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
10278 case OPCODE_MAPGRID1
:
10279 fprintf(f
, "MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
10281 case OPCODE_MAPGRID2
:
10282 fprintf(f
, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
10283 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
10285 case OPCODE_EVALMESH1
:
10286 fprintf(f
, "EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
10288 case OPCODE_EVALMESH2
:
10289 fprintf(f
, "EvalMesh2 %d %d %d %d\n",
10290 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
10293 case OPCODE_ATTR_1F_NV
:
10294 fprintf(f
, "ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
10296 case OPCODE_ATTR_2F_NV
:
10297 fprintf(f
, "ATTR_2F_NV attr %d: %f %f\n",
10298 n
[1].i
, n
[2].f
, n
[3].f
);
10300 case OPCODE_ATTR_3F_NV
:
10301 fprintf(f
, "ATTR_3F_NV attr %d: %f %f %f\n",
10302 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
10304 case OPCODE_ATTR_4F_NV
:
10305 fprintf(f
, "ATTR_4F_NV attr %d: %f %f %f %f\n",
10306 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
10308 case OPCODE_ATTR_1F_ARB
:
10309 fprintf(f
, "ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
10311 case OPCODE_ATTR_2F_ARB
:
10312 fprintf(f
, "ATTR_2F_ARB attr %d: %f %f\n",
10313 n
[1].i
, n
[2].f
, n
[3].f
);
10315 case OPCODE_ATTR_3F_ARB
:
10316 fprintf(f
, "ATTR_3F_ARB attr %d: %f %f %f\n",
10317 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
10319 case OPCODE_ATTR_4F_ARB
:
10320 fprintf(f
, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
10321 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
10324 case OPCODE_MATERIAL
:
10325 fprintf(f
, "MATERIAL %x %x: %f %f %f %f\n",
10326 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10329 fprintf(f
, "BEGIN %x\n", n
[1].i
);
10332 fprintf(f
, "END\n");
10335 fprintf(f
, "RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
10338 case OPCODE_EVAL_C1
:
10339 fprintf(f
, "EVAL_C1 %f\n", n
[1].f
);
10341 case OPCODE_EVAL_C2
:
10342 fprintf(f
, "EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
10344 case OPCODE_EVAL_P1
:
10345 fprintf(f
, "EVAL_P1 %d\n", n
[1].i
);
10347 case OPCODE_EVAL_P2
:
10348 fprintf(f
, "EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
10351 case OPCODE_PROVOKING_VERTEX
:
10352 fprintf(f
, "ProvokingVertex %s\n",
10353 _mesa_enum_to_string(n
[1].ui
));
10357 * meta opcodes/commands
10360 fprintf(f
, "Error: %s %s\n", enum_string(n
[1].e
),
10361 (const char *) get_pointer(&n
[2]));
10363 case OPCODE_CONTINUE
:
10364 fprintf(f
, "DISPLAY-LIST-CONTINUE\n");
10365 n
= (Node
*) get_pointer(&n
[1]);
10368 fprintf(f
, "NOP\n");
10370 case OPCODE_END_OF_LIST
:
10371 fprintf(f
, "END-LIST %u\n", list
);
10375 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
10377 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
10378 opcode
, (void *) n
);
10382 fprintf(f
, "command %d, %u operands\n", opcode
,
10386 /* increment n to point to next compiled command */
10387 if (opcode
!= OPCODE_CONTINUE
) {
10388 n
+= InstSize
[opcode
];
10402 * Clients may call this function to help debug display list problems.
10403 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
10404 * changed, or break in the future without notice.
10407 mesa_print_display_list(GLuint list
)
10409 GET_CURRENT_CONTEXT(ctx
);
10410 print_list(ctx
, list
, NULL
);
10414 /**********************************************************************/
10415 /***** Initialization *****/
10416 /**********************************************************************/
10419 save_vtxfmt_init(GLvertexformat
* vfmt
)
10421 vfmt
->ArrayElement
= _ae_ArrayElement
;
10423 vfmt
->Begin
= save_Begin
;
10425 vfmt
->CallList
= save_CallList
;
10426 vfmt
->CallLists
= save_CallLists
;
10428 vfmt
->Color3f
= save_Color3f
;
10429 vfmt
->Color3fv
= save_Color3fv
;
10430 vfmt
->Color4f
= save_Color4f
;
10431 vfmt
->Color4fv
= save_Color4fv
;
10432 vfmt
->EdgeFlag
= save_EdgeFlag
;
10433 vfmt
->End
= save_End
;
10435 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
10436 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
10437 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
10438 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
10439 vfmt
->EvalPoint1
= save_EvalPoint1
;
10440 vfmt
->EvalPoint2
= save_EvalPoint2
;
10442 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
10443 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
10444 vfmt
->Indexf
= save_Indexf
;
10445 vfmt
->Indexfv
= save_Indexfv
;
10446 vfmt
->Materialfv
= save_Materialfv
;
10447 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
10448 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
10449 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
10450 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
10451 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
10452 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
10453 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
10454 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
10455 vfmt
->Normal3f
= save_Normal3f
;
10456 vfmt
->Normal3fv
= save_Normal3fv
;
10457 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
10458 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
10459 vfmt
->TexCoord1f
= save_TexCoord1f
;
10460 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
10461 vfmt
->TexCoord2f
= save_TexCoord2f
;
10462 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
10463 vfmt
->TexCoord3f
= save_TexCoord3f
;
10464 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
10465 vfmt
->TexCoord4f
= save_TexCoord4f
;
10466 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
10467 vfmt
->Vertex2f
= save_Vertex2f
;
10468 vfmt
->Vertex2fv
= save_Vertex2fv
;
10469 vfmt
->Vertex3f
= save_Vertex3f
;
10470 vfmt
->Vertex3fv
= save_Vertex3fv
;
10471 vfmt
->Vertex4f
= save_Vertex4f
;
10472 vfmt
->Vertex4fv
= save_Vertex4fv
;
10473 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
10474 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
10475 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
10476 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
10477 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
10478 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
10479 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
10480 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
10482 vfmt
->PrimitiveRestartNV
= save_PrimitiveRestartNV
;
10487 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
10488 const GLvertexformat
*vfmt
)
10490 SET_CallList(disp
, vfmt
->CallList
);
10491 SET_CallLists(disp
, vfmt
->CallLists
);
10496 * Initialize display list state for given context.
10499 _mesa_init_display_list(struct gl_context
*ctx
)
10501 static GLboolean tableInitialized
= GL_FALSE
;
10503 /* zero-out the instruction size table, just once */
10504 if (!tableInitialized
) {
10505 memset(InstSize
, 0, sizeof(InstSize
));
10506 tableInitialized
= GL_TRUE
;
10509 /* extension info */
10510 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
10513 ctx
->ListState
.CallDepth
= 0;
10514 ctx
->ExecuteFlag
= GL_TRUE
;
10515 ctx
->CompileFlag
= GL_FALSE
;
10516 ctx
->ListState
.CurrentBlock
= NULL
;
10517 ctx
->ListState
.CurrentPos
= 0;
10519 /* Display List group */
10520 ctx
->List
.ListBase
= 0;
10522 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
10524 InstSize
[OPCODE_NOP
] = 1;
10529 _mesa_free_display_list_data(struct gl_context
*ctx
)
10531 free(ctx
->ListExt
);
10532 ctx
->ListExt
= NULL
;