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); \
177 * Display list opcodes.
179 * The fact that these identifiers are assigned consecutive
180 * integer values starting at 0 is very important, see InstSize array usage)
184 OPCODE_INVALID
= -1, /* Force signed enum */
190 OPCODE_BLEND_EQUATION
,
191 OPCODE_BLEND_EQUATION_SEPARATE
,
192 OPCODE_BLEND_FUNC_SEPARATE
,
194 OPCODE_BLEND_EQUATION_I
,
195 OPCODE_BLEND_EQUATION_SEPARATE_I
,
197 OPCODE_BLEND_FUNC_SEPARATE_I
,
206 OPCODE_CLEAR_STENCIL
,
207 OPCODE_CLEAR_BUFFER_IV
,
208 OPCODE_CLEAR_BUFFER_UIV
,
209 OPCODE_CLEAR_BUFFER_FV
,
210 OPCODE_CLEAR_BUFFER_FI
,
213 OPCODE_COLOR_MASK_INDEXED
,
214 OPCODE_COLOR_MATERIAL
,
216 OPCODE_COPY_TEX_IMAGE1D
,
217 OPCODE_COPY_TEX_IMAGE2D
,
218 OPCODE_COPY_TEX_SUB_IMAGE1D
,
219 OPCODE_COPY_TEX_SUB_IMAGE2D
,
220 OPCODE_COPY_TEX_SUB_IMAGE3D
,
226 OPCODE_DISABLE_INDEXED
,
230 OPCODE_ENABLE_INDEXED
,
244 OPCODE_LOAD_IDENTITY
,
257 OPCODE_PIXEL_TRANSFER
,
260 OPCODE_POINT_PARAMETERS
,
262 OPCODE_POLYGON_STIPPLE
,
263 OPCODE_POLYGON_OFFSET
,
267 OPCODE_PRIORITIZE_TEXTURE
,
276 OPCODE_SELECT_TEXTURE_SGIS
,
277 OPCODE_SELECT_TEXTURE_COORD_SET
,
288 OPCODE_TEX_SUB_IMAGE1D
,
289 OPCODE_TEX_SUB_IMAGE2D
,
290 OPCODE_TEX_SUB_IMAGE3D
,
294 /* GL_ARB_multitexture */
295 OPCODE_ACTIVE_TEXTURE
,
296 /* GL_ARB_texture_compression */
297 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
298 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
299 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
300 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
301 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
302 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
303 /* GL_ARB_multisample */
304 OPCODE_SAMPLE_COVERAGE
,
305 /* GL_ARB_window_pos */
306 OPCODE_WINDOW_POS_ARB
,
307 /* GL_NV_fragment_program */
308 OPCODE_BIND_PROGRAM_NV
,
309 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
310 /* GL_EXT_stencil_two_side */
311 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
312 /* GL_EXT_depth_bounds_test */
313 OPCODE_DEPTH_BOUNDS_EXT
,
314 /* GL_ARB_vertex/fragment_program */
315 OPCODE_PROGRAM_STRING_ARB
,
316 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
317 /* GL_ARB_occlusion_query */
318 OPCODE_BEGIN_QUERY_ARB
,
319 OPCODE_END_QUERY_ARB
,
320 /* GL_ARB_draw_buffers */
321 OPCODE_DRAW_BUFFERS_ARB
,
322 /* GL_ATI_fragment_shader */
323 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
324 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
326 OPCODE_STENCIL_FUNC_SEPARATE
,
327 OPCODE_STENCIL_OP_SEPARATE
,
328 OPCODE_STENCIL_MASK_SEPARATE
,
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 /* The following three are meta instructions */
489 OPCODE_ERROR
, /* raise compiled-in error */
491 OPCODE_NOP
, /* No-op (used for 8-byte alignment */
501 * Display list instructions are stored as sequences of "nodes". Nodes
502 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
503 * are linked together with a pointer.
505 * Each instruction in the display list is stored as a sequence of
506 * contiguous nodes in memory.
507 * Each node is the union of a variety of data types.
509 * Note, all of these members should be 4 bytes in size or less for the
510 * sake of compact display lists. We store 8-byte pointers in a pair of
511 * these nodes using the save/get_pointer() functions below.
529 typedef union gl_dlist_node Node
;
532 /** How many 4-byte dwords to store a pointer */
533 #define POINTER_DWORDS (sizeof(void *) / 4)
535 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
536 * space for display lists. The following types and functions are
537 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
542 GLuint dwords
[POINTER_DWORDS
];
547 * Save a 4 or 8-byte pointer at dest (and dest+1).
550 save_pointer(Node
*dest
, void *src
)
555 STATIC_ASSERT(POINTER_DWORDS
== 1 || POINTER_DWORDS
== 2);
556 STATIC_ASSERT(sizeof(Node
) == 4);
560 for (i
= 0; i
< POINTER_DWORDS
; i
++)
561 dest
[i
].ui
= p
.dwords
[i
];
566 * Retrieve a 4 or 8-byte pointer from node (node+1).
569 get_pointer(const Node
*node
)
574 for (i
= 0; i
< POINTER_DWORDS
; i
++)
575 p
.dwords
[i
] = node
[i
].ui
;
582 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
593 * How many nodes to allocate at a time. Note that bulk vertex data
594 * from glBegin/glVertex/glEnd primitives will typically wind up in
595 * a VBO, and not directly in the display list itself.
597 #define BLOCK_SIZE 256
602 * Number of nodes of storage needed for each instruction.
603 * Sizes for dynamically allocated opcodes are stored in the context struct.
605 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
608 void mesa_print_display_list(GLuint list
);
612 * Does the given display list only contain a single glBitmap call?
615 is_bitmap_list(const struct gl_display_list
*dlist
)
617 const Node
*n
= dlist
->Head
;
618 if (n
[0].opcode
== OPCODE_BITMAP
) {
619 n
+= InstSize
[OPCODE_BITMAP
];
620 if (n
[0].opcode
== OPCODE_END_OF_LIST
)
628 * Is the given display list an empty list?
631 is_empty_list(const struct gl_display_list
*dlist
)
633 const Node
*n
= dlist
->Head
;
634 return n
[0].opcode
== OPCODE_END_OF_LIST
;
639 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
642 _mesa_delete_bitmap_atlas(struct gl_context
*ctx
, struct gl_bitmap_atlas
*atlas
)
645 ctx
->Driver
.DeleteTexture(ctx
, atlas
->texObj
);
652 * Lookup a gl_bitmap_atlas by listBase ID.
654 static struct gl_bitmap_atlas
*
655 lookup_bitmap_atlas(struct gl_context
*ctx
, GLuint listBase
)
657 struct gl_bitmap_atlas
*atlas
;
659 assert(listBase
> 0);
660 atlas
= _mesa_HashLookup(ctx
->Shared
->BitmapAtlas
, listBase
);
666 * Create new bitmap atlas and insert into hash table.
668 static struct gl_bitmap_atlas
*
669 alloc_bitmap_atlas(struct gl_context
*ctx
, GLuint listBase
)
671 struct gl_bitmap_atlas
*atlas
;
673 assert(listBase
> 0);
674 assert(_mesa_HashLookup(ctx
->Shared
->BitmapAtlas
, listBase
) == NULL
);
676 atlas
= calloc(1, sizeof(*atlas
));
678 _mesa_HashInsert(ctx
->Shared
->BitmapAtlas
, listBase
, atlas
);
686 * Try to build a bitmap atlas. This involves examining a sequence of
687 * display lists which contain glBitmap commands and putting the bitmap
688 * images into a texture map (the atlas).
689 * If we succeed, gl_bitmap_atlas::complete will be set to true.
690 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
693 build_bitmap_atlas(struct gl_context
*ctx
, struct gl_bitmap_atlas
*atlas
,
696 unsigned i
, row_height
= 0, xpos
= 0, ypos
= 0;
701 assert(!atlas
->complete
);
702 assert(atlas
->numBitmaps
> 0);
704 /* We use a rectangle texture (non-normalized coords) for the atlas */
705 assert(ctx
->Extensions
.NV_texture_rectangle
);
706 assert(ctx
->Const
.MaxTextureRectSize
>= 1024);
708 atlas
->texWidth
= 1024;
709 atlas
->texHeight
= 0; /* determined below */
711 atlas
->glyphs
= malloc(atlas
->numBitmaps
* sizeof(atlas
->glyphs
[0]));
712 if (!atlas
->glyphs
) {
714 atlas
->incomplete
= true;
718 /* Loop over the display lists. They should all contain a single glBitmap
719 * call. If not, bail out. Also, compute the position and sizes of each
720 * bitmap in the atlas to determine the texture atlas size.
722 for (i
= 0; i
< atlas
->numBitmaps
; i
++) {
723 const struct gl_display_list
*list
= _mesa_lookup_list(ctx
, listBase
+ i
);
725 struct gl_bitmap_glyph
*g
= &atlas
->glyphs
[i
];
726 unsigned bitmap_width
, bitmap_height
;
727 float bitmap_xmove
, bitmap_ymove
, bitmap_xorig
, bitmap_yorig
;
729 if (!list
|| is_empty_list(list
)) {
731 atlas
->numBitmaps
= i
;
735 if (!is_bitmap_list(list
)) {
736 /* This list does not contain exactly one glBitmap command. Give up. */
737 atlas
->incomplete
= true;
741 /* get bitmap info from the display list command */
743 assert(n
[0].opcode
== OPCODE_BITMAP
);
744 bitmap_width
= n
[1].i
;
745 bitmap_height
= n
[2].i
;
746 bitmap_xorig
= n
[3].f
;
747 bitmap_yorig
= n
[4].f
;
748 bitmap_xmove
= n
[5].f
;
749 bitmap_ymove
= n
[6].f
;
751 if (xpos
+ bitmap_width
> atlas
->texWidth
) {
752 /* advance to the next row of the texture */
758 /* save the bitmap's position in the atlas */
762 g
->h
= bitmap_height
;
763 g
->xorig
= bitmap_xorig
;
764 g
->yorig
= bitmap_yorig
;
765 g
->xmove
= bitmap_xmove
;
766 g
->ymove
= bitmap_ymove
;
768 xpos
+= bitmap_width
;
770 /* keep track of tallest bitmap in the row */
771 row_height
= MAX2(row_height
, bitmap_height
);
774 /* Now we know the texture height */
775 atlas
->texHeight
= ypos
+ row_height
;
777 if (atlas
->texHeight
== 0) {
778 /* no glyphs found, give up */
781 else if (atlas
->texHeight
> ctx
->Const
.MaxTextureRectSize
) {
782 /* too large, give up */
786 /* Create atlas texture (texture ID is irrelevant) */
787 atlas
->texObj
= ctx
->Driver
.NewTextureObject(ctx
, 999, GL_TEXTURE_RECTANGLE
);
788 if (!atlas
->texObj
) {
792 atlas
->texObj
->Sampler
.MinFilter
= GL_NEAREST
;
793 atlas
->texObj
->Sampler
.MagFilter
= GL_NEAREST
;
794 atlas
->texObj
->MaxLevel
= 0;
795 atlas
->texObj
->Immutable
= GL_TRUE
;
797 atlas
->texImage
= _mesa_get_tex_image(ctx
, atlas
->texObj
,
798 GL_TEXTURE_RECTANGLE
, 0);
799 if (!atlas
->texImage
) {
803 _mesa_init_teximage_fields(ctx
, atlas
->texImage
,
804 atlas
->texWidth
, atlas
->texHeight
, 1, 0,
805 GL_ALPHA
, MESA_FORMAT_A_UNORM8
);
807 /* alloc image storage */
808 if (!ctx
->Driver
.AllocTextureImageBuffer(ctx
, atlas
->texImage
)) {
812 /* map teximage, load with bitmap glyphs */
813 ctx
->Driver
.MapTextureImage(ctx
, atlas
->texImage
, 0,
814 0, 0, atlas
->texWidth
, atlas
->texHeight
,
815 GL_MAP_WRITE_BIT
, &map
, &map_stride
);
820 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
821 memset(map
, 0xff, map_stride
* atlas
->texHeight
);
823 for (i
= 0; i
< atlas
->numBitmaps
; i
++) {
824 const struct gl_display_list
*list
= _mesa_lookup_list(ctx
, listBase
+ i
);
825 const Node
*n
= list
->Head
;
827 assert(n
[0].opcode
== OPCODE_BITMAP
||
828 n
[0].opcode
== OPCODE_END_OF_LIST
);
830 if (n
[0].opcode
== OPCODE_BITMAP
) {
831 unsigned bitmap_width
= n
[1].i
;
832 unsigned bitmap_height
= n
[2].i
;
833 unsigned xpos
= atlas
->glyphs
[i
].x
;
834 unsigned ypos
= atlas
->glyphs
[i
].y
;
835 const void *bitmap_image
= get_pointer(&n
[7]);
837 assert(atlas
->glyphs
[i
].w
== bitmap_width
);
838 assert(atlas
->glyphs
[i
].h
== bitmap_height
);
840 /* put the bitmap image into the texture image */
841 _mesa_expand_bitmap(bitmap_width
, bitmap_height
,
842 &ctx
->DefaultPacking
, bitmap_image
,
843 map
+ map_stride
* ypos
+ xpos
, /* dest addr */
848 ctx
->Driver
.UnmapTextureImage(ctx
, atlas
->texImage
, 0);
850 atlas
->complete
= true;
855 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Display list bitmap atlas");
858 ctx
->Driver
.DeleteTexture(ctx
, atlas
->texObj
);
861 atlas
->glyphs
= NULL
;
862 atlas
->incomplete
= true;
867 * Allocate a gl_display_list object with an initial block of storage.
868 * \param count how many display list nodes/tokens to allocate
870 static struct gl_display_list
*
871 make_list(GLuint name
, GLuint count
)
873 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
875 dlist
->Head
= malloc(sizeof(Node
) * count
);
876 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
882 * Lookup function to just encapsulate casting.
884 struct gl_display_list
*
885 _mesa_lookup_list(struct gl_context
*ctx
, GLuint list
)
887 return (struct gl_display_list
*)
888 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
892 /** Is the given opcode an extension code? */
893 static inline GLboolean
894 is_ext_opcode(OpCode opcode
)
896 return (opcode
>= OPCODE_EXT_0
);
900 /** Destroy an extended opcode instruction */
902 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
904 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
906 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
907 step
= ctx
->ListExt
->Opcode
[i
].Size
;
912 /** Execute an extended opcode instruction */
914 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
916 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
918 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
919 step
= ctx
->ListExt
->Opcode
[i
].Size
;
924 /** Print an extended opcode instruction */
926 ext_opcode_print(struct gl_context
*ctx
, Node
*node
, FILE *f
)
928 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
930 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1], f
);
931 step
= ctx
->ListExt
->Opcode
[i
].Size
;
937 * Delete the named display list, but don't remove from hash table.
938 * \param dlist - display list pointer
941 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
946 n
= block
= dlist
->Head
;
948 done
= block
? GL_FALSE
: GL_TRUE
;
950 const OpCode opcode
= n
[0].opcode
;
952 /* check for extension opcodes first */
953 if (is_ext_opcode(opcode
)) {
954 n
+= ext_opcode_destroy(ctx
, n
);
958 /* for some commands, we need to free malloc'd memory */
960 free(get_pointer(&n
[6]));
961 n
+= InstSize
[n
[0].opcode
];
964 free(get_pointer(&n
[10]));
965 n
+= InstSize
[n
[0].opcode
];
967 case OPCODE_CALL_LISTS
:
968 free(get_pointer(&n
[3]));
969 n
+= InstSize
[n
[0].opcode
];
971 case OPCODE_DRAW_PIXELS
:
972 free(get_pointer(&n
[5]));
973 n
+= InstSize
[n
[0].opcode
];
976 free(get_pointer(&n
[7]));
977 n
+= InstSize
[n
[0].opcode
];
979 case OPCODE_POLYGON_STIPPLE
:
980 free(get_pointer(&n
[1]));
981 n
+= InstSize
[n
[0].opcode
];
983 case OPCODE_TEX_IMAGE1D
:
984 free(get_pointer(&n
[8]));
985 n
+= InstSize
[n
[0].opcode
];
987 case OPCODE_TEX_IMAGE2D
:
988 free(get_pointer(&n
[9]));
989 n
+= InstSize
[n
[0].opcode
];
991 case OPCODE_TEX_IMAGE3D
:
992 free(get_pointer(&n
[10]));
993 n
+= InstSize
[n
[0].opcode
];
995 case OPCODE_TEX_SUB_IMAGE1D
:
996 free(get_pointer(&n
[7]));
997 n
+= InstSize
[n
[0].opcode
];
999 case OPCODE_TEX_SUB_IMAGE2D
:
1000 free(get_pointer(&n
[9]));
1001 n
+= InstSize
[n
[0].opcode
];
1003 case OPCODE_TEX_SUB_IMAGE3D
:
1004 free(get_pointer(&n
[11]));
1005 n
+= InstSize
[n
[0].opcode
];
1007 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
1008 free(get_pointer(&n
[7]));
1009 n
+= InstSize
[n
[0].opcode
];
1011 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
1012 free(get_pointer(&n
[8]));
1013 n
+= InstSize
[n
[0].opcode
];
1015 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
1016 free(get_pointer(&n
[9]));
1017 n
+= InstSize
[n
[0].opcode
];
1019 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
1020 free(get_pointer(&n
[7]));
1021 n
+= InstSize
[n
[0].opcode
];
1023 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
1024 free(get_pointer(&n
[9]));
1025 n
+= InstSize
[n
[0].opcode
];
1027 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
1028 free(get_pointer(&n
[11]));
1029 n
+= InstSize
[n
[0].opcode
];
1031 case OPCODE_PROGRAM_STRING_ARB
:
1032 free(get_pointer(&n
[4])); /* program string */
1033 n
+= InstSize
[n
[0].opcode
];
1035 case OPCODE_UNIFORM_1FV
:
1036 case OPCODE_UNIFORM_2FV
:
1037 case OPCODE_UNIFORM_3FV
:
1038 case OPCODE_UNIFORM_4FV
:
1039 case OPCODE_UNIFORM_1IV
:
1040 case OPCODE_UNIFORM_2IV
:
1041 case OPCODE_UNIFORM_3IV
:
1042 case OPCODE_UNIFORM_4IV
:
1043 case OPCODE_UNIFORM_1UIV
:
1044 case OPCODE_UNIFORM_2UIV
:
1045 case OPCODE_UNIFORM_3UIV
:
1046 case OPCODE_UNIFORM_4UIV
:
1047 free(get_pointer(&n
[3]));
1048 n
+= InstSize
[n
[0].opcode
];
1050 case OPCODE_UNIFORM_MATRIX22
:
1051 case OPCODE_UNIFORM_MATRIX33
:
1052 case OPCODE_UNIFORM_MATRIX44
:
1053 case OPCODE_UNIFORM_MATRIX24
:
1054 case OPCODE_UNIFORM_MATRIX42
:
1055 case OPCODE_UNIFORM_MATRIX23
:
1056 case OPCODE_UNIFORM_MATRIX32
:
1057 case OPCODE_UNIFORM_MATRIX34
:
1058 case OPCODE_UNIFORM_MATRIX43
:
1059 free(get_pointer(&n
[4]));
1060 n
+= InstSize
[n
[0].opcode
];
1062 case OPCODE_PROGRAM_UNIFORM_1FV
:
1063 case OPCODE_PROGRAM_UNIFORM_2FV
:
1064 case OPCODE_PROGRAM_UNIFORM_3FV
:
1065 case OPCODE_PROGRAM_UNIFORM_4FV
:
1066 case OPCODE_PROGRAM_UNIFORM_1IV
:
1067 case OPCODE_PROGRAM_UNIFORM_2IV
:
1068 case OPCODE_PROGRAM_UNIFORM_3IV
:
1069 case OPCODE_PROGRAM_UNIFORM_4IV
:
1070 case OPCODE_PROGRAM_UNIFORM_1UIV
:
1071 case OPCODE_PROGRAM_UNIFORM_2UIV
:
1072 case OPCODE_PROGRAM_UNIFORM_3UIV
:
1073 case OPCODE_PROGRAM_UNIFORM_4UIV
:
1074 free(get_pointer(&n
[4]));
1075 n
+= InstSize
[n
[0].opcode
];
1077 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
1078 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
1079 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
1080 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
1081 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
1082 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
1083 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
1084 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
1085 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
1086 free(get_pointer(&n
[5]));
1087 n
+= InstSize
[n
[0].opcode
];
1089 case OPCODE_PIXEL_MAP
:
1090 free(get_pointer(&n
[3]));
1091 n
+= InstSize
[n
[0].opcode
];
1094 case OPCODE_CONTINUE
:
1095 n
= (Node
*) get_pointer(&n
[1]);
1099 case OPCODE_END_OF_LIST
:
1104 /* Most frequent case */
1105 n
+= InstSize
[n
[0].opcode
];
1117 * Called by _mesa_HashWalk() to check if a display list which is being
1118 * deleted belongs to a bitmap texture atlas.
1121 check_atlas_for_deleted_list(GLuint atlas_id
, void *data
, void *userData
)
1123 struct gl_bitmap_atlas
*atlas
= (struct gl_bitmap_atlas
*) data
;
1124 GLuint list_id
= *((GLuint
*) userData
); /* the list being deleted */
1126 /* See if the list_id falls in the range contained in this texture atlas */
1127 if (atlas
->complete
&&
1128 list_id
>= atlas_id
&&
1129 list_id
< atlas_id
+ atlas
->numBitmaps
) {
1130 /* Mark the atlas as incomplete so it doesn't get used. But don't
1131 * delete it yet since we don't want to try to recreate it in the next
1134 atlas
->complete
= false;
1135 atlas
->incomplete
= true;
1141 * Destroy a display list and remove from hash table.
1142 * \param list - display list number
1145 destroy_list(struct gl_context
*ctx
, GLuint list
)
1147 struct gl_display_list
*dlist
;
1152 dlist
= _mesa_lookup_list(ctx
, list
);
1156 if (is_bitmap_list(dlist
)) {
1157 /* If we're destroying a simple glBitmap display list, there's a
1158 * chance that we're destroying a bitmap image that's in a texture
1159 * atlas. Examine all atlases to see if that's the case. There's
1160 * usually few (if any) atlases so this isn't expensive.
1162 _mesa_HashWalk(ctx
->Shared
->BitmapAtlas
,
1163 check_atlas_for_deleted_list
, &list
);
1166 _mesa_delete_list(ctx
, dlist
);
1167 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
1172 * Translate the nth element of list from <type> to GLint.
1175 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
1187 bptr
= (GLbyte
*) list
;
1188 return (GLint
) bptr
[n
];
1189 case GL_UNSIGNED_BYTE
:
1190 ubptr
= (GLubyte
*) list
;
1191 return (GLint
) ubptr
[n
];
1193 sptr
= (GLshort
*) list
;
1194 return (GLint
) sptr
[n
];
1195 case GL_UNSIGNED_SHORT
:
1196 usptr
= (GLushort
*) list
;
1197 return (GLint
) usptr
[n
];
1199 iptr
= (GLint
*) list
;
1201 case GL_UNSIGNED_INT
:
1202 uiptr
= (GLuint
*) list
;
1203 return (GLint
) uiptr
[n
];
1205 fptr
= (GLfloat
*) list
;
1206 return (GLint
) floorf(fptr
[n
]);
1208 ubptr
= ((GLubyte
*) list
) + 2 * n
;
1209 return (GLint
) ubptr
[0] * 256
1212 ubptr
= ((GLubyte
*) list
) + 3 * n
;
1213 return (GLint
) ubptr
[0] * 65536
1214 + (GLint
) ubptr
[1] * 256
1217 ubptr
= ((GLubyte
*) list
) + 4 * n
;
1218 return (GLint
) ubptr
[0] * 16777216
1219 + (GLint
) ubptr
[1] * 65536
1220 + (GLint
) ubptr
[2] * 256
1229 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1230 * If width < 0 or height < 0 or format or type are invalid we'll just
1231 * return NULL. We will not generate an error since OpenGL command
1232 * arguments aren't error-checked until the command is actually executed
1233 * (not when they're compiled).
1234 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1237 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
1238 GLsizei width
, GLsizei height
, GLsizei depth
,
1239 GLenum format
, GLenum type
, const GLvoid
* pixels
,
1240 const struct gl_pixelstore_attrib
*unpack
)
1242 if (width
<= 0 || height
<= 0) {
1246 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
1247 /* bad format and/or type */
1251 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
1255 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
1256 format
, type
, pixels
, unpack
);
1257 if (pixels
&& !image
) {
1258 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1262 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
1263 depth
, format
, type
, INT_MAX
, pixels
)) {
1264 const GLubyte
*map
, *src
;
1268 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
1269 GL_MAP_READ_BIT
, unpack
->BufferObj
,
1272 /* unable to map src buffer! */
1273 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
1277 src
= ADD_POINTERS(map
, pixels
);
1278 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
1279 format
, type
, src
, unpack
);
1281 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
, MAP_INTERNAL
);
1284 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1290 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
1295 /** Return copy of memory */
1297 memdup(const void *src
, GLsizei bytes
)
1299 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
1301 memcpy(b
, src
, bytes
);
1307 * Allocate space for a display list instruction (opcode + payload space).
1308 * \param opcode the instruction opcode (OPCODE_* value)
1309 * \param bytes instruction payload size (not counting opcode)
1310 * \param align8 does the payload need to be 8-byte aligned?
1311 * This is only relevant in 64-bit environments.
1312 * \return pointer to allocated memory (the payload will be at pointer+1)
1315 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
, bool align8
)
1317 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
1318 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
1322 if (opcode
< OPCODE_EXT_0
) {
1323 if (InstSize
[opcode
] == 0) {
1324 /* save instruction size now */
1325 InstSize
[opcode
] = numNodes
;
1328 /* make sure instruction size agrees */
1329 assert(numNodes
== InstSize
[opcode
]);
1333 if (sizeof(void *) > sizeof(Node
) && align8
1334 && ctx
->ListState
.CurrentPos
% 2 == 0) {
1335 /* The opcode would get placed at node[0] and the payload would start
1336 * at node[1]. But the payload needs to be at an even offset (8-byte
1345 if (ctx
->ListState
.CurrentPos
+ nopNode
+ numNodes
+ contNodes
1347 /* This block is full. Allocate a new block and chain to it */
1349 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1350 n
[0].opcode
= OPCODE_CONTINUE
;
1351 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
1353 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
1357 /* a fresh block should be 8-byte aligned on 64-bit systems */
1358 assert(((GLintptr
) newblock
) % sizeof(void *) == 0);
1360 save_pointer(&n
[1], newblock
);
1361 ctx
->ListState
.CurrentBlock
= newblock
;
1362 ctx
->ListState
.CurrentPos
= 0;
1364 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1365 * we have to insert a NOP so that the payload of the real opcode lands
1366 * on an even location:
1367 * node[0] = OPCODE_NOP
1368 * node[1] = OPCODE_x;
1369 * node[2] = start of payload
1371 nopNode
= sizeof(void *) > sizeof(Node
) && align8
;
1374 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1376 assert(ctx
->ListState
.CurrentPos
% 2 == 0); /* even value */
1377 n
[0].opcode
= OPCODE_NOP
;
1379 /* The "real" opcode will now be at an odd location and the payload
1380 * will be at an even location.
1383 ctx
->ListState
.CurrentPos
+= nopNode
+ numNodes
;
1385 n
[0].opcode
= opcode
;
1393 * Allocate space for a display list instruction. Used by callers outside
1394 * this file for things like VBO vertex data.
1396 * \param opcode the instruction opcode (OPCODE_* value)
1397 * \param bytes instruction size in bytes, not counting opcode.
1398 * \return pointer to the usable data area (not including the internal
1402 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1404 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, false);
1406 return n
+ 1; /* return pointer to payload area, after opcode */
1413 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1414 * aligned in 64-bit environments, 4-byte aligned otherwise.
1417 _mesa_dlist_alloc_aligned(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1419 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, true);
1421 return n
+ 1; /* return pointer to payload area, after opcode */
1428 * This function allows modules and drivers to get their own opcodes
1429 * for extending display list functionality.
1430 * \param ctx the rendering context
1431 * \param size number of bytes for storing the new display list command
1432 * \param execute function to execute the new display list command
1433 * \param destroy function to destroy the new display list command
1434 * \param print function to print the new display list command
1435 * \return the new opcode number or -1 if error
1438 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1440 void (*execute
) (struct gl_context
*, void *),
1441 void (*destroy
) (struct gl_context
*, void *),
1442 void (*print
) (struct gl_context
*, void *, FILE *))
1444 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1445 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1446 ctx
->ListExt
->Opcode
[i
].Size
=
1447 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1448 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1449 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1450 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1451 return i
+ OPCODE_EXT_0
;
1458 * Allocate space for a display list instruction. The space is basically
1459 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1460 * function parameter, node[2] is the second parameter, etc.
1462 * \param opcode one of OPCODE_x
1463 * \param nparams number of function parameters
1464 * \return pointer to start of instruction space
1466 static inline Node
*
1467 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1469 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
), false);
1474 * Called by EndList to try to reduce memory used for the list.
1477 trim_list(struct gl_context
*ctx
)
1479 /* If the list we're ending only has one allocated block of nodes/tokens
1480 * and its size isn't a full block size, realloc the block to use less
1481 * memory. This is important for apps that create many small display
1482 * lists and apps that use glXUseXFont (many lists each containing one
1484 * Note: we currently only trim display lists that allocated one block
1485 * of tokens. That hits the short list case which is what we're mainly
1486 * concerned with. Trimming longer lists would involve traversing the
1487 * linked list of blocks.
1489 struct gl_dlist_state
*list
= &ctx
->ListState
;
1491 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1492 (list
->CurrentPos
< BLOCK_SIZE
)) {
1493 /* There's only one block and it's not full, so realloc */
1494 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1495 list
->CurrentList
->Head
=
1496 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1497 if (!list
->CurrentBlock
) {
1498 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1506 * Display List compilation functions
1508 static void GLAPIENTRY
1509 save_Accum(GLenum op
, GLfloat value
)
1511 GET_CURRENT_CONTEXT(ctx
);
1513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1514 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1519 if (ctx
->ExecuteFlag
) {
1520 CALL_Accum(ctx
->Exec
, (op
, value
));
1525 static void GLAPIENTRY
1526 save_AlphaFunc(GLenum func
, GLclampf ref
)
1528 GET_CURRENT_CONTEXT(ctx
);
1530 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1531 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1534 n
[2].f
= (GLfloat
) ref
;
1536 if (ctx
->ExecuteFlag
) {
1537 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1542 static void GLAPIENTRY
1543 save_BindTexture(GLenum target
, GLuint texture
)
1545 GET_CURRENT_CONTEXT(ctx
);
1547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1548 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1553 if (ctx
->ExecuteFlag
) {
1554 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1559 static void GLAPIENTRY
1560 save_Bitmap(GLsizei width
, GLsizei height
,
1561 GLfloat xorig
, GLfloat yorig
,
1562 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1564 GET_CURRENT_CONTEXT(ctx
);
1566 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1567 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1569 n
[1].i
= (GLint
) width
;
1570 n
[2].i
= (GLint
) height
;
1576 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1577 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1579 if (ctx
->ExecuteFlag
) {
1580 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1581 xorig
, yorig
, xmove
, ymove
, pixels
));
1586 static void GLAPIENTRY
1587 save_BlendEquation(GLenum mode
)
1589 GET_CURRENT_CONTEXT(ctx
);
1591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1592 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1596 if (ctx
->ExecuteFlag
) {
1597 CALL_BlendEquation(ctx
->Exec
, (mode
));
1602 static void GLAPIENTRY
1603 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1605 GET_CURRENT_CONTEXT(ctx
);
1607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1608 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1613 if (ctx
->ExecuteFlag
) {
1614 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1619 static void GLAPIENTRY
1620 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1621 GLenum sfactorA
, GLenum dfactorA
)
1623 GET_CURRENT_CONTEXT(ctx
);
1625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1626 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1628 n
[1].e
= sfactorRGB
;
1629 n
[2].e
= dfactorRGB
;
1633 if (ctx
->ExecuteFlag
) {
1634 CALL_BlendFuncSeparate(ctx
->Exec
,
1635 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1640 static void GLAPIENTRY
1641 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1643 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1647 static void GLAPIENTRY
1648 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1650 GET_CURRENT_CONTEXT(ctx
);
1652 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1653 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1660 if (ctx
->ExecuteFlag
) {
1661 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1665 /* GL_ARB_draw_buffers_blend */
1666 static void GLAPIENTRY
1667 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1668 GLenum sfactorA
, GLenum dfactorA
)
1670 GET_CURRENT_CONTEXT(ctx
);
1672 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1673 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1676 n
[2].e
= sfactorRGB
;
1677 n
[3].e
= dfactorRGB
;
1681 if (ctx
->ExecuteFlag
) {
1682 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1683 sfactorA
, dfactorA
));
1687 /* GL_ARB_draw_buffers_blend */
1688 static void GLAPIENTRY
1689 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1691 GET_CURRENT_CONTEXT(ctx
);
1693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1694 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_I
, 3);
1700 if (ctx
->ExecuteFlag
) {
1701 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1705 /* GL_ARB_draw_buffers_blend */
1706 static void GLAPIENTRY
1707 save_BlendEquationi(GLuint buf
, GLenum mode
)
1709 GET_CURRENT_CONTEXT(ctx
);
1711 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1712 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1717 if (ctx
->ExecuteFlag
) {
1718 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1722 /* GL_ARB_draw_buffers_blend */
1723 static void GLAPIENTRY
1724 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1726 GET_CURRENT_CONTEXT(ctx
);
1728 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1729 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1735 if (ctx
->ExecuteFlag
) {
1736 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1741 /* GL_ARB_draw_instanced. */
1742 static void GLAPIENTRY
1743 save_DrawArraysInstancedARB(GLenum mode
,
1748 GET_CURRENT_CONTEXT(ctx
);
1749 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1750 "glDrawArraysInstanced() during display list compile");
1753 static void GLAPIENTRY
1754 save_DrawElementsInstancedARB(GLenum mode
,
1757 const GLvoid
*indices
,
1760 GET_CURRENT_CONTEXT(ctx
);
1761 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1762 "glDrawElementsInstanced() during display list compile");
1765 static void GLAPIENTRY
1766 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1769 const GLvoid
*indices
,
1773 GET_CURRENT_CONTEXT(ctx
);
1774 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1775 "glDrawElementsInstancedBaseVertex() during display list compile");
1778 /* GL_ARB_base_instance. */
1779 static void GLAPIENTRY
1780 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1784 GLuint baseinstance
)
1786 GET_CURRENT_CONTEXT(ctx
);
1787 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1788 "glDrawArraysInstancedBaseInstance() during display list compile");
1791 static void APIENTRY
1792 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1795 const void *indices
,
1797 GLuint baseinstance
)
1799 GET_CURRENT_CONTEXT(ctx
);
1800 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1801 "glDrawElementsInstancedBaseInstance() during display list compile");
1804 static void APIENTRY
1805 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1808 const void *indices
,
1811 GLuint baseinstance
)
1813 GET_CURRENT_CONTEXT(ctx
);
1814 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1815 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1820 * While building a display list we cache some OpenGL state.
1821 * Under some circumstances we need to invalidate that state (immediately
1822 * when we start compiling a list, or after glCallList(s)).
1825 invalidate_saved_current_state(struct gl_context
*ctx
)
1829 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1830 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1832 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1833 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1835 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1837 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1841 static void GLAPIENTRY
1842 save_CallList(GLuint list
)
1844 GET_CURRENT_CONTEXT(ctx
);
1846 SAVE_FLUSH_VERTICES(ctx
);
1848 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1853 /* After this, we don't know what state we're in. Invalidate all
1854 * cached information previously gathered:
1856 invalidate_saved_current_state( ctx
);
1858 if (ctx
->ExecuteFlag
) {
1859 _mesa_CallList(list
);
1864 static void GLAPIENTRY
1865 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1867 GET_CURRENT_CONTEXT(ctx
);
1872 SAVE_FLUSH_VERTICES(ctx
);
1876 case GL_UNSIGNED_BYTE
:
1880 case GL_UNSIGNED_SHORT
:
1888 case GL_UNSIGNED_INT
:
1897 if (num
> 0 && type_size
> 0) {
1898 /* create a copy of the array of list IDs to save in the display list */
1899 lists_copy
= memdup(lists
, num
* type_size
);
1904 n
= alloc_instruction(ctx
, OPCODE_CALL_LISTS
, 2 + POINTER_DWORDS
);
1908 save_pointer(&n
[3], lists_copy
);
1911 /* After this, we don't know what state we're in. Invalidate all
1912 * cached information previously gathered:
1914 invalidate_saved_current_state( ctx
);
1916 if (ctx
->ExecuteFlag
) {
1917 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1922 static void GLAPIENTRY
1923 save_Clear(GLbitfield mask
)
1925 GET_CURRENT_CONTEXT(ctx
);
1927 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1928 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1932 if (ctx
->ExecuteFlag
) {
1933 CALL_Clear(ctx
->Exec
, (mask
));
1938 static void GLAPIENTRY
1939 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1941 GET_CURRENT_CONTEXT(ctx
);
1943 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1944 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1947 n
[2].i
= drawbuffer
;
1949 if (buffer
== GL_COLOR
) {
1960 if (ctx
->ExecuteFlag
) {
1961 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1966 static void GLAPIENTRY
1967 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1969 GET_CURRENT_CONTEXT(ctx
);
1971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1972 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1975 n
[2].i
= drawbuffer
;
1977 if (buffer
== GL_COLOR
) {
1988 if (ctx
->ExecuteFlag
) {
1989 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1994 static void GLAPIENTRY
1995 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1997 GET_CURRENT_CONTEXT(ctx
);
1999 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2000 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
2003 n
[2].i
= drawbuffer
;
2005 if (buffer
== GL_COLOR
) {
2016 if (ctx
->ExecuteFlag
) {
2017 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
2022 static void GLAPIENTRY
2023 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
2024 GLfloat depth
, GLint stencil
)
2026 GET_CURRENT_CONTEXT(ctx
);
2028 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2029 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
2032 n
[2].i
= drawbuffer
;
2036 if (ctx
->ExecuteFlag
) {
2037 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
2042 static void GLAPIENTRY
2043 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
2045 GET_CURRENT_CONTEXT(ctx
);
2047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2048 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
2055 if (ctx
->ExecuteFlag
) {
2056 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
2061 static void GLAPIENTRY
2062 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
2064 GET_CURRENT_CONTEXT(ctx
);
2066 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2067 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
2074 if (ctx
->ExecuteFlag
) {
2075 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
2080 static void GLAPIENTRY
2081 save_ClearDepth(GLclampd depth
)
2083 GET_CURRENT_CONTEXT(ctx
);
2085 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2086 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
2088 n
[1].f
= (GLfloat
) depth
;
2090 if (ctx
->ExecuteFlag
) {
2091 CALL_ClearDepth(ctx
->Exec
, (depth
));
2096 static void GLAPIENTRY
2097 save_ClearIndex(GLfloat c
)
2099 GET_CURRENT_CONTEXT(ctx
);
2101 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2102 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
2106 if (ctx
->ExecuteFlag
) {
2107 CALL_ClearIndex(ctx
->Exec
, (c
));
2112 static void GLAPIENTRY
2113 save_ClearStencil(GLint s
)
2115 GET_CURRENT_CONTEXT(ctx
);
2117 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2118 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
2122 if (ctx
->ExecuteFlag
) {
2123 CALL_ClearStencil(ctx
->Exec
, (s
));
2128 static void GLAPIENTRY
2129 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
2131 GET_CURRENT_CONTEXT(ctx
);
2133 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2134 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
2137 n
[2].f
= (GLfloat
) equ
[0];
2138 n
[3].f
= (GLfloat
) equ
[1];
2139 n
[4].f
= (GLfloat
) equ
[2];
2140 n
[5].f
= (GLfloat
) equ
[3];
2142 if (ctx
->ExecuteFlag
) {
2143 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
2149 static void GLAPIENTRY
2150 save_ColorMask(GLboolean red
, GLboolean green
,
2151 GLboolean blue
, GLboolean alpha
)
2153 GET_CURRENT_CONTEXT(ctx
);
2155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2156 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
2163 if (ctx
->ExecuteFlag
) {
2164 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
2169 static void GLAPIENTRY
2170 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
2171 GLboolean blue
, GLboolean alpha
)
2173 GET_CURRENT_CONTEXT(ctx
);
2175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2176 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
2184 if (ctx
->ExecuteFlag
) {
2185 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2190 static void GLAPIENTRY
2191 save_ColorMaterial(GLenum face
, GLenum mode
)
2193 GET_CURRENT_CONTEXT(ctx
);
2195 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2197 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
2202 if (ctx
->ExecuteFlag
) {
2203 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
2208 static void GLAPIENTRY
2209 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
2211 GET_CURRENT_CONTEXT(ctx
);
2213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2214 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
2218 n
[3].i
= (GLint
) width
;
2219 n
[4].i
= (GLint
) height
;
2222 if (ctx
->ExecuteFlag
) {
2223 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
2229 static void GLAPIENTRY
2230 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
2231 GLint x
, GLint y
, GLsizei width
, GLint border
)
2233 GET_CURRENT_CONTEXT(ctx
);
2235 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2236 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
2240 n
[3].e
= internalformat
;
2246 if (ctx
->ExecuteFlag
) {
2247 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
2248 x
, y
, width
, border
));
2253 static void GLAPIENTRY
2254 save_CopyTexImage2D(GLenum target
, GLint level
,
2255 GLenum internalformat
,
2256 GLint x
, GLint y
, GLsizei width
,
2257 GLsizei height
, GLint border
)
2259 GET_CURRENT_CONTEXT(ctx
);
2261 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2262 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
2266 n
[3].e
= internalformat
;
2273 if (ctx
->ExecuteFlag
) {
2274 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
2275 x
, y
, width
, height
, border
));
2281 static void GLAPIENTRY
2282 save_CopyTexSubImage1D(GLenum target
, GLint level
,
2283 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
2285 GET_CURRENT_CONTEXT(ctx
);
2287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2288 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
2297 if (ctx
->ExecuteFlag
) {
2298 CALL_CopyTexSubImage1D(ctx
->Exec
,
2299 (target
, level
, xoffset
, x
, y
, width
));
2304 static void GLAPIENTRY
2305 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2306 GLint xoffset
, GLint yoffset
,
2307 GLint x
, GLint y
, GLsizei width
, GLint height
)
2309 GET_CURRENT_CONTEXT(ctx
);
2311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2312 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2323 if (ctx
->ExecuteFlag
) {
2324 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2325 x
, y
, width
, height
));
2330 static void GLAPIENTRY
2331 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2332 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2333 GLint x
, GLint y
, GLsizei width
, GLint height
)
2335 GET_CURRENT_CONTEXT(ctx
);
2337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2338 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2350 if (ctx
->ExecuteFlag
) {
2351 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2352 xoffset
, yoffset
, zoffset
,
2353 x
, y
, width
, height
));
2358 static void GLAPIENTRY
2359 save_CullFace(GLenum mode
)
2361 GET_CURRENT_CONTEXT(ctx
);
2363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2364 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2368 if (ctx
->ExecuteFlag
) {
2369 CALL_CullFace(ctx
->Exec
, (mode
));
2374 static void GLAPIENTRY
2375 save_DepthFunc(GLenum func
)
2377 GET_CURRENT_CONTEXT(ctx
);
2379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2380 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2384 if (ctx
->ExecuteFlag
) {
2385 CALL_DepthFunc(ctx
->Exec
, (func
));
2390 static void GLAPIENTRY
2391 save_DepthMask(GLboolean mask
)
2393 GET_CURRENT_CONTEXT(ctx
);
2395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2396 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2400 if (ctx
->ExecuteFlag
) {
2401 CALL_DepthMask(ctx
->Exec
, (mask
));
2406 static void GLAPIENTRY
2407 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2409 GET_CURRENT_CONTEXT(ctx
);
2411 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2412 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2414 n
[1].f
= (GLfloat
) nearval
;
2415 n
[2].f
= (GLfloat
) farval
;
2417 if (ctx
->ExecuteFlag
) {
2418 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2423 static void GLAPIENTRY
2424 save_Disable(GLenum cap
)
2426 GET_CURRENT_CONTEXT(ctx
);
2428 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2429 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2433 if (ctx
->ExecuteFlag
) {
2434 CALL_Disable(ctx
->Exec
, (cap
));
2439 static void GLAPIENTRY
2440 save_DisableIndexed(GLuint index
, GLenum cap
)
2442 GET_CURRENT_CONTEXT(ctx
);
2444 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2445 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2450 if (ctx
->ExecuteFlag
) {
2451 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2456 static void GLAPIENTRY
2457 save_DrawBuffer(GLenum mode
)
2459 GET_CURRENT_CONTEXT(ctx
);
2461 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2462 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2466 if (ctx
->ExecuteFlag
) {
2467 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2472 static void GLAPIENTRY
2473 save_DrawPixels(GLsizei width
, GLsizei height
,
2474 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2476 GET_CURRENT_CONTEXT(ctx
);
2479 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2481 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2488 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2489 pixels
, &ctx
->Unpack
));
2491 if (ctx
->ExecuteFlag
) {
2492 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2498 static void GLAPIENTRY
2499 save_Enable(GLenum cap
)
2501 GET_CURRENT_CONTEXT(ctx
);
2503 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2504 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2508 if (ctx
->ExecuteFlag
) {
2509 CALL_Enable(ctx
->Exec
, (cap
));
2515 static void GLAPIENTRY
2516 save_EnableIndexed(GLuint index
, GLenum cap
)
2518 GET_CURRENT_CONTEXT(ctx
);
2520 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2521 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2526 if (ctx
->ExecuteFlag
) {
2527 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2533 static void GLAPIENTRY
2534 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2536 GET_CURRENT_CONTEXT(ctx
);
2538 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2539 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2545 if (ctx
->ExecuteFlag
) {
2546 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2551 static void GLAPIENTRY
2552 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2554 GET_CURRENT_CONTEXT(ctx
);
2556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2557 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2565 if (ctx
->ExecuteFlag
) {
2566 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2573 static void GLAPIENTRY
2574 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2576 GET_CURRENT_CONTEXT(ctx
);
2578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2579 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2587 if (ctx
->ExecuteFlag
) {
2588 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2593 static void GLAPIENTRY
2594 save_Fogf(GLenum pname
, GLfloat param
)
2598 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2599 save_Fogfv(pname
, parray
);
2603 static void GLAPIENTRY
2604 save_Fogiv(GLenum pname
, const GLint
*params
)
2609 case GL_FOG_DENSITY
:
2613 p
[0] = (GLfloat
) *params
;
2619 p
[0] = INT_TO_FLOAT(params
[0]);
2620 p
[1] = INT_TO_FLOAT(params
[1]);
2621 p
[2] = INT_TO_FLOAT(params
[2]);
2622 p
[3] = INT_TO_FLOAT(params
[3]);
2625 /* Error will be caught later in gl_Fogfv */
2626 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2628 save_Fogfv(pname
, p
);
2632 static void GLAPIENTRY
2633 save_Fogi(GLenum pname
, GLint param
)
2637 parray
[1] = parray
[2] = parray
[3] = 0;
2638 save_Fogiv(pname
, parray
);
2642 static void GLAPIENTRY
2643 save_FrontFace(GLenum mode
)
2645 GET_CURRENT_CONTEXT(ctx
);
2647 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2648 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2652 if (ctx
->ExecuteFlag
) {
2653 CALL_FrontFace(ctx
->Exec
, (mode
));
2658 static void GLAPIENTRY
2659 save_Frustum(GLdouble left
, GLdouble right
,
2660 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2662 GET_CURRENT_CONTEXT(ctx
);
2664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2665 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2667 n
[1].f
= (GLfloat
) left
;
2668 n
[2].f
= (GLfloat
) right
;
2669 n
[3].f
= (GLfloat
) bottom
;
2670 n
[4].f
= (GLfloat
) top
;
2671 n
[5].f
= (GLfloat
) nearval
;
2672 n
[6].f
= (GLfloat
) farval
;
2674 if (ctx
->ExecuteFlag
) {
2675 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2680 static void GLAPIENTRY
2681 save_Hint(GLenum target
, GLenum mode
)
2683 GET_CURRENT_CONTEXT(ctx
);
2685 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2686 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2691 if (ctx
->ExecuteFlag
) {
2692 CALL_Hint(ctx
->Exec
, (target
, mode
));
2697 static void GLAPIENTRY
2698 save_IndexMask(GLuint mask
)
2700 GET_CURRENT_CONTEXT(ctx
);
2702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2703 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2707 if (ctx
->ExecuteFlag
) {
2708 CALL_IndexMask(ctx
->Exec
, (mask
));
2713 static void GLAPIENTRY
2714 save_InitNames(void)
2716 GET_CURRENT_CONTEXT(ctx
);
2717 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2718 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2719 if (ctx
->ExecuteFlag
) {
2720 CALL_InitNames(ctx
->Exec
, ());
2725 static void GLAPIENTRY
2726 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2728 GET_CURRENT_CONTEXT(ctx
);
2730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2731 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2749 case GL_SPOT_DIRECTION
:
2752 case GL_SPOT_EXPONENT
:
2755 case GL_SPOT_CUTOFF
:
2758 case GL_CONSTANT_ATTENUATION
:
2761 case GL_LINEAR_ATTENUATION
:
2764 case GL_QUADRATIC_ATTENUATION
:
2770 for (i
= 0; i
< nParams
; i
++) {
2771 n
[3 + i
].f
= params
[i
];
2774 if (ctx
->ExecuteFlag
) {
2775 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2780 static void GLAPIENTRY
2781 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2785 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2786 save_Lightfv(light
, pname
, parray
);
2790 static void GLAPIENTRY
2791 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2798 fparam
[0] = INT_TO_FLOAT(params
[0]);
2799 fparam
[1] = INT_TO_FLOAT(params
[1]);
2800 fparam
[2] = INT_TO_FLOAT(params
[2]);
2801 fparam
[3] = INT_TO_FLOAT(params
[3]);
2804 fparam
[0] = (GLfloat
) params
[0];
2805 fparam
[1] = (GLfloat
) params
[1];
2806 fparam
[2] = (GLfloat
) params
[2];
2807 fparam
[3] = (GLfloat
) params
[3];
2809 case GL_SPOT_DIRECTION
:
2810 fparam
[0] = (GLfloat
) params
[0];
2811 fparam
[1] = (GLfloat
) params
[1];
2812 fparam
[2] = (GLfloat
) params
[2];
2814 case GL_SPOT_EXPONENT
:
2815 case GL_SPOT_CUTOFF
:
2816 case GL_CONSTANT_ATTENUATION
:
2817 case GL_LINEAR_ATTENUATION
:
2818 case GL_QUADRATIC_ATTENUATION
:
2819 fparam
[0] = (GLfloat
) params
[0];
2822 /* error will be caught later in gl_Lightfv */
2825 save_Lightfv(light
, pname
, fparam
);
2829 static void GLAPIENTRY
2830 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2834 parray
[1] = parray
[2] = parray
[3] = 0;
2835 save_Lightiv(light
, pname
, parray
);
2839 static void GLAPIENTRY
2840 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2842 GET_CURRENT_CONTEXT(ctx
);
2844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2845 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2853 if (ctx
->ExecuteFlag
) {
2854 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2859 static void GLAPIENTRY
2860 save_LightModelf(GLenum pname
, GLfloat param
)
2864 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2865 save_LightModelfv(pname
, parray
);
2869 static void GLAPIENTRY
2870 save_LightModeliv(GLenum pname
, const GLint
*params
)
2874 case GL_LIGHT_MODEL_AMBIENT
:
2875 fparam
[0] = INT_TO_FLOAT(params
[0]);
2876 fparam
[1] = INT_TO_FLOAT(params
[1]);
2877 fparam
[2] = INT_TO_FLOAT(params
[2]);
2878 fparam
[3] = INT_TO_FLOAT(params
[3]);
2880 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2881 case GL_LIGHT_MODEL_TWO_SIDE
:
2882 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2883 fparam
[0] = (GLfloat
) params
[0];
2889 /* Error will be caught later in gl_LightModelfv */
2890 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2892 save_LightModelfv(pname
, fparam
);
2896 static void GLAPIENTRY
2897 save_LightModeli(GLenum pname
, GLint param
)
2901 parray
[1] = parray
[2] = parray
[3] = 0;
2902 save_LightModeliv(pname
, parray
);
2906 static void GLAPIENTRY
2907 save_LineStipple(GLint factor
, GLushort pattern
)
2909 GET_CURRENT_CONTEXT(ctx
);
2911 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2912 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2917 if (ctx
->ExecuteFlag
) {
2918 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2923 static void GLAPIENTRY
2924 save_LineWidth(GLfloat width
)
2926 GET_CURRENT_CONTEXT(ctx
);
2928 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2929 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2933 if (ctx
->ExecuteFlag
) {
2934 CALL_LineWidth(ctx
->Exec
, (width
));
2939 static void GLAPIENTRY
2940 save_ListBase(GLuint base
)
2942 GET_CURRENT_CONTEXT(ctx
);
2944 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2945 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2949 if (ctx
->ExecuteFlag
) {
2950 CALL_ListBase(ctx
->Exec
, (base
));
2955 static void GLAPIENTRY
2956 save_LoadIdentity(void)
2958 GET_CURRENT_CONTEXT(ctx
);
2959 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2960 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2961 if (ctx
->ExecuteFlag
) {
2962 CALL_LoadIdentity(ctx
->Exec
, ());
2967 static void GLAPIENTRY
2968 save_LoadMatrixf(const GLfloat
* m
)
2970 GET_CURRENT_CONTEXT(ctx
);
2972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2973 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2976 for (i
= 0; i
< 16; i
++) {
2980 if (ctx
->ExecuteFlag
) {
2981 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2986 static void GLAPIENTRY
2987 save_LoadMatrixd(const GLdouble
* m
)
2991 for (i
= 0; i
< 16; i
++) {
2992 f
[i
] = (GLfloat
) m
[i
];
2994 save_LoadMatrixf(f
);
2998 static void GLAPIENTRY
2999 save_LoadName(GLuint name
)
3001 GET_CURRENT_CONTEXT(ctx
);
3003 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3004 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
3008 if (ctx
->ExecuteFlag
) {
3009 CALL_LoadName(ctx
->Exec
, (name
));
3014 static void GLAPIENTRY
3015 save_LogicOp(GLenum opcode
)
3017 GET_CURRENT_CONTEXT(ctx
);
3019 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3020 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
3024 if (ctx
->ExecuteFlag
) {
3025 CALL_LogicOp(ctx
->Exec
, (opcode
));
3030 static void GLAPIENTRY
3031 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
3032 GLint order
, const GLdouble
* points
)
3034 GET_CURRENT_CONTEXT(ctx
);
3036 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3037 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
3039 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
3041 n
[2].f
= (GLfloat
) u1
;
3042 n
[3].f
= (GLfloat
) u2
;
3043 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
3045 save_pointer(&n
[6], pnts
);
3047 if (ctx
->ExecuteFlag
) {
3048 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
3052 static void GLAPIENTRY
3053 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
3054 GLint order
, const GLfloat
* points
)
3056 GET_CURRENT_CONTEXT(ctx
);
3058 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3059 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
3061 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
3065 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
3067 save_pointer(&n
[6], pnts
);
3069 if (ctx
->ExecuteFlag
) {
3070 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
3075 static void GLAPIENTRY
3076 save_Map2d(GLenum target
,
3077 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
3078 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
3079 const GLdouble
* points
)
3081 GET_CURRENT_CONTEXT(ctx
);
3083 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3084 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
3086 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
3087 vstride
, vorder
, points
);
3089 n
[2].f
= (GLfloat
) u1
;
3090 n
[3].f
= (GLfloat
) u2
;
3091 n
[4].f
= (GLfloat
) v1
;
3092 n
[5].f
= (GLfloat
) v2
;
3093 /* XXX verify these strides are correct */
3094 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
3095 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
3098 save_pointer(&n
[10], pnts
);
3100 if (ctx
->ExecuteFlag
) {
3101 CALL_Map2d(ctx
->Exec
, (target
,
3102 u1
, u2
, ustride
, uorder
,
3103 v1
, v2
, vstride
, vorder
, points
));
3108 static void GLAPIENTRY
3109 save_Map2f(GLenum target
,
3110 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
3111 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
3112 const GLfloat
* points
)
3114 GET_CURRENT_CONTEXT(ctx
);
3116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3117 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
3119 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
3120 vstride
, vorder
, points
);
3126 /* XXX verify these strides are correct */
3127 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
3128 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
3131 save_pointer(&n
[10], pnts
);
3133 if (ctx
->ExecuteFlag
) {
3134 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
3135 v1
, v2
, vstride
, vorder
, points
));
3140 static void GLAPIENTRY
3141 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
3143 GET_CURRENT_CONTEXT(ctx
);
3145 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3146 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
3152 if (ctx
->ExecuteFlag
) {
3153 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
3158 static void GLAPIENTRY
3159 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
3161 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
3165 static void GLAPIENTRY
3166 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
3167 GLint vn
, GLfloat v1
, GLfloat v2
)
3169 GET_CURRENT_CONTEXT(ctx
);
3171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3172 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
3181 if (ctx
->ExecuteFlag
) {
3182 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
3188 static void GLAPIENTRY
3189 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
3190 GLint vn
, GLdouble v1
, GLdouble v2
)
3192 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
3193 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
3197 static void GLAPIENTRY
3198 save_MatrixMode(GLenum mode
)
3200 GET_CURRENT_CONTEXT(ctx
);
3202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3203 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
3207 if (ctx
->ExecuteFlag
) {
3208 CALL_MatrixMode(ctx
->Exec
, (mode
));
3213 static void GLAPIENTRY
3214 save_MultMatrixf(const GLfloat
* m
)
3216 GET_CURRENT_CONTEXT(ctx
);
3218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3219 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
3222 for (i
= 0; i
< 16; i
++) {
3226 if (ctx
->ExecuteFlag
) {
3227 CALL_MultMatrixf(ctx
->Exec
, (m
));
3232 static void GLAPIENTRY
3233 save_MultMatrixd(const GLdouble
* m
)
3237 for (i
= 0; i
< 16; i
++) {
3238 f
[i
] = (GLfloat
) m
[i
];
3240 save_MultMatrixf(f
);
3244 static void GLAPIENTRY
3245 save_NewList(GLuint name
, GLenum mode
)
3247 GET_CURRENT_CONTEXT(ctx
);
3248 /* It's an error to call this function while building a display list */
3249 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
3256 static void GLAPIENTRY
3257 save_Ortho(GLdouble left
, GLdouble right
,
3258 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
3260 GET_CURRENT_CONTEXT(ctx
);
3262 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3263 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
3265 n
[1].f
= (GLfloat
) left
;
3266 n
[2].f
= (GLfloat
) right
;
3267 n
[3].f
= (GLfloat
) bottom
;
3268 n
[4].f
= (GLfloat
) top
;
3269 n
[5].f
= (GLfloat
) nearval
;
3270 n
[6].f
= (GLfloat
) farval
;
3272 if (ctx
->ExecuteFlag
) {
3273 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
3278 static void GLAPIENTRY
3279 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
3281 GET_CURRENT_CONTEXT(ctx
);
3283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3284 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
3288 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
3290 if (ctx
->ExecuteFlag
) {
3291 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
3296 static void GLAPIENTRY
3297 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
3299 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3301 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3302 for (i
= 0; i
< mapsize
; i
++) {
3303 fvalues
[i
] = (GLfloat
) values
[i
];
3307 for (i
= 0; i
< mapsize
; i
++) {
3308 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3311 save_PixelMapfv(map
, mapsize
, fvalues
);
3315 static void GLAPIENTRY
3316 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3318 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3320 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3321 for (i
= 0; i
< mapsize
; i
++) {
3322 fvalues
[i
] = (GLfloat
) values
[i
];
3326 for (i
= 0; i
< mapsize
; i
++) {
3327 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3330 save_PixelMapfv(map
, mapsize
, fvalues
);
3334 static void GLAPIENTRY
3335 save_PixelTransferf(GLenum pname
, GLfloat param
)
3337 GET_CURRENT_CONTEXT(ctx
);
3339 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3340 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3345 if (ctx
->ExecuteFlag
) {
3346 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3351 static void GLAPIENTRY
3352 save_PixelTransferi(GLenum pname
, GLint param
)
3354 save_PixelTransferf(pname
, (GLfloat
) param
);
3358 static void GLAPIENTRY
3359 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3361 GET_CURRENT_CONTEXT(ctx
);
3363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3364 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3369 if (ctx
->ExecuteFlag
) {
3370 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3375 static void GLAPIENTRY
3376 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3378 GET_CURRENT_CONTEXT(ctx
);
3380 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3381 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3388 if (ctx
->ExecuteFlag
) {
3389 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3394 static void GLAPIENTRY
3395 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3399 parray
[1] = parray
[2] = 0.0F
;
3400 save_PointParameterfvEXT(pname
, parray
);
3403 static void GLAPIENTRY
3404 save_PointParameteriNV(GLenum pname
, GLint param
)
3407 parray
[0] = (GLfloat
) param
;
3408 parray
[1] = parray
[2] = 0.0F
;
3409 save_PointParameterfvEXT(pname
, parray
);
3412 static void GLAPIENTRY
3413 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3416 parray
[0] = (GLfloat
) param
[0];
3417 parray
[1] = parray
[2] = 0.0F
;
3418 save_PointParameterfvEXT(pname
, parray
);
3422 static void GLAPIENTRY
3423 save_PointSize(GLfloat size
)
3425 GET_CURRENT_CONTEXT(ctx
);
3427 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3428 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3432 if (ctx
->ExecuteFlag
) {
3433 CALL_PointSize(ctx
->Exec
, (size
));
3438 static void GLAPIENTRY
3439 save_PolygonMode(GLenum face
, GLenum mode
)
3441 GET_CURRENT_CONTEXT(ctx
);
3443 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3444 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3449 if (ctx
->ExecuteFlag
) {
3450 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3455 static void GLAPIENTRY
3456 save_PolygonStipple(const GLubyte
* pattern
)
3458 GET_CURRENT_CONTEXT(ctx
);
3461 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3463 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3466 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3467 pattern
, &ctx
->Unpack
));
3469 if (ctx
->ExecuteFlag
) {
3470 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3475 static void GLAPIENTRY
3476 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3478 GET_CURRENT_CONTEXT(ctx
);
3480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3481 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3486 if (ctx
->ExecuteFlag
) {
3487 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3492 static void GLAPIENTRY
3493 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3495 GET_CURRENT_CONTEXT(ctx
);
3496 /* XXX mult by DepthMaxF here??? */
3497 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3500 static void GLAPIENTRY
3501 save_PolygonOffsetClampEXT(GLfloat factor
, GLfloat units
, GLfloat clamp
)
3503 GET_CURRENT_CONTEXT(ctx
);
3505 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3506 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET_CLAMP
, 3);
3512 if (ctx
->ExecuteFlag
) {
3513 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (factor
, units
, clamp
));
3517 static void GLAPIENTRY
3518 save_PopAttrib(void)
3520 GET_CURRENT_CONTEXT(ctx
);
3521 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3522 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3523 if (ctx
->ExecuteFlag
) {
3524 CALL_PopAttrib(ctx
->Exec
, ());
3529 static void GLAPIENTRY
3530 save_PopMatrix(void)
3532 GET_CURRENT_CONTEXT(ctx
);
3533 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3534 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3535 if (ctx
->ExecuteFlag
) {
3536 CALL_PopMatrix(ctx
->Exec
, ());
3541 static void GLAPIENTRY
3544 GET_CURRENT_CONTEXT(ctx
);
3545 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3546 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3547 if (ctx
->ExecuteFlag
) {
3548 CALL_PopName(ctx
->Exec
, ());
3553 static void GLAPIENTRY
3554 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3555 const GLclampf
* priorities
)
3557 GET_CURRENT_CONTEXT(ctx
);
3559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3561 for (i
= 0; i
< num
; i
++) {
3563 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3565 n
[1].ui
= textures
[i
];
3566 n
[2].f
= priorities
[i
];
3569 if (ctx
->ExecuteFlag
) {
3570 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3575 static void GLAPIENTRY
3576 save_PushAttrib(GLbitfield mask
)
3578 GET_CURRENT_CONTEXT(ctx
);
3580 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3581 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3585 if (ctx
->ExecuteFlag
) {
3586 CALL_PushAttrib(ctx
->Exec
, (mask
));
3591 static void GLAPIENTRY
3592 save_PushMatrix(void)
3594 GET_CURRENT_CONTEXT(ctx
);
3595 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3596 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3597 if (ctx
->ExecuteFlag
) {
3598 CALL_PushMatrix(ctx
->Exec
, ());
3603 static void GLAPIENTRY
3604 save_PushName(GLuint name
)
3606 GET_CURRENT_CONTEXT(ctx
);
3608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3609 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3613 if (ctx
->ExecuteFlag
) {
3614 CALL_PushName(ctx
->Exec
, (name
));
3619 static void GLAPIENTRY
3620 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3622 GET_CURRENT_CONTEXT(ctx
);
3624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3625 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3632 if (ctx
->ExecuteFlag
) {
3633 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3637 static void GLAPIENTRY
3638 save_RasterPos2d(GLdouble x
, GLdouble y
)
3640 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3643 static void GLAPIENTRY
3644 save_RasterPos2f(GLfloat x
, GLfloat y
)
3646 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3649 static void GLAPIENTRY
3650 save_RasterPos2i(GLint x
, GLint y
)
3652 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3655 static void GLAPIENTRY
3656 save_RasterPos2s(GLshort x
, GLshort y
)
3658 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3661 static void GLAPIENTRY
3662 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3664 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3667 static void GLAPIENTRY
3668 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3670 save_RasterPos4f(x
, y
, z
, 1.0F
);
3673 static void GLAPIENTRY
3674 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3676 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3679 static void GLAPIENTRY
3680 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3682 save_RasterPos4f(x
, y
, z
, 1.0F
);
3685 static void GLAPIENTRY
3686 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3688 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3691 static void GLAPIENTRY
3692 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3694 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3697 static void GLAPIENTRY
3698 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3700 save_RasterPos4f(x
, y
, z
, w
);
3703 static void GLAPIENTRY
3704 save_RasterPos2dv(const GLdouble
* v
)
3706 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3709 static void GLAPIENTRY
3710 save_RasterPos2fv(const GLfloat
* v
)
3712 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3715 static void GLAPIENTRY
3716 save_RasterPos2iv(const GLint
* v
)
3718 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3721 static void GLAPIENTRY
3722 save_RasterPos2sv(const GLshort
* v
)
3724 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3727 static void GLAPIENTRY
3728 save_RasterPos3dv(const GLdouble
* v
)
3730 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3733 static void GLAPIENTRY
3734 save_RasterPos3fv(const GLfloat
* v
)
3736 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3739 static void GLAPIENTRY
3740 save_RasterPos3iv(const GLint
* v
)
3742 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3745 static void GLAPIENTRY
3746 save_RasterPos3sv(const GLshort
* v
)
3748 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3751 static void GLAPIENTRY
3752 save_RasterPos4dv(const GLdouble
* v
)
3754 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3755 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3758 static void GLAPIENTRY
3759 save_RasterPos4fv(const GLfloat
* v
)
3761 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3764 static void GLAPIENTRY
3765 save_RasterPos4iv(const GLint
* v
)
3767 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3768 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3771 static void GLAPIENTRY
3772 save_RasterPos4sv(const GLshort
* v
)
3774 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3778 static void GLAPIENTRY
3779 save_PassThrough(GLfloat token
)
3781 GET_CURRENT_CONTEXT(ctx
);
3783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3784 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3788 if (ctx
->ExecuteFlag
) {
3789 CALL_PassThrough(ctx
->Exec
, (token
));
3794 static void GLAPIENTRY
3795 save_ReadBuffer(GLenum mode
)
3797 GET_CURRENT_CONTEXT(ctx
);
3799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3800 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3804 if (ctx
->ExecuteFlag
) {
3805 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3810 static void GLAPIENTRY
3811 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3813 GET_CURRENT_CONTEXT(ctx
);
3815 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3816 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3823 if (ctx
->ExecuteFlag
) {
3824 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3829 static void GLAPIENTRY
3830 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3832 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3836 static void GLAPIENTRY
3837 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3839 GET_CURRENT_CONTEXT(ctx
);
3841 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3842 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3848 if (ctx
->ExecuteFlag
) {
3849 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3854 static void GLAPIENTRY
3855 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3857 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3861 static void GLAPIENTRY
3862 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3864 GET_CURRENT_CONTEXT(ctx
);
3866 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3867 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3874 if (ctx
->ExecuteFlag
) {
3875 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3880 static void GLAPIENTRY
3881 save_ShadeModel(GLenum mode
)
3883 GET_CURRENT_CONTEXT(ctx
);
3885 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3887 if (ctx
->ExecuteFlag
) {
3888 CALL_ShadeModel(ctx
->Exec
, (mode
));
3891 /* Don't compile this call if it's a no-op.
3892 * By avoiding this state change we have a better chance of
3893 * coalescing subsequent drawing commands into one batch.
3895 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3898 SAVE_FLUSH_VERTICES(ctx
);
3900 ctx
->ListState
.Current
.ShadeModel
= mode
;
3902 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3909 static void GLAPIENTRY
3910 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3912 GET_CURRENT_CONTEXT(ctx
);
3914 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3915 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3921 if (ctx
->ExecuteFlag
) {
3922 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3927 static void GLAPIENTRY
3928 save_StencilMask(GLuint mask
)
3930 GET_CURRENT_CONTEXT(ctx
);
3932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3933 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3937 if (ctx
->ExecuteFlag
) {
3938 CALL_StencilMask(ctx
->Exec
, (mask
));
3943 static void GLAPIENTRY
3944 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3946 GET_CURRENT_CONTEXT(ctx
);
3948 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3949 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3955 if (ctx
->ExecuteFlag
) {
3956 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3961 static void GLAPIENTRY
3962 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3964 GET_CURRENT_CONTEXT(ctx
);
3966 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3967 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3974 if (ctx
->ExecuteFlag
) {
3975 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3980 static void GLAPIENTRY
3981 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3984 GET_CURRENT_CONTEXT(ctx
);
3986 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3988 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3996 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
4003 if (ctx
->ExecuteFlag
) {
4004 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
4005 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
4010 static void GLAPIENTRY
4011 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
4013 GET_CURRENT_CONTEXT(ctx
);
4015 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4016 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
4021 if (ctx
->ExecuteFlag
) {
4022 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
4027 static void GLAPIENTRY
4028 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
4030 GET_CURRENT_CONTEXT(ctx
);
4032 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4033 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
4040 if (ctx
->ExecuteFlag
) {
4041 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
4046 static void GLAPIENTRY
4047 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4049 GET_CURRENT_CONTEXT(ctx
);
4051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4052 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
4056 if (pname
== GL_TEXTURE_ENV_COLOR
) {
4064 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
4067 if (ctx
->ExecuteFlag
) {
4068 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
4073 static void GLAPIENTRY
4074 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
4077 parray
[0] = (GLfloat
) param
;
4078 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4079 save_TexEnvfv(target
, pname
, parray
);
4083 static void GLAPIENTRY
4084 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
4087 p
[0] = (GLfloat
) param
;
4088 p
[1] = p
[2] = p
[3] = 0.0F
;
4089 save_TexEnvfv(target
, pname
, p
);
4093 static void GLAPIENTRY
4094 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
4097 if (pname
== GL_TEXTURE_ENV_COLOR
) {
4098 p
[0] = INT_TO_FLOAT(param
[0]);
4099 p
[1] = INT_TO_FLOAT(param
[1]);
4100 p
[2] = INT_TO_FLOAT(param
[2]);
4101 p
[3] = INT_TO_FLOAT(param
[3]);
4104 p
[0] = (GLfloat
) param
[0];
4105 p
[1] = p
[2] = p
[3] = 0.0F
;
4107 save_TexEnvfv(target
, pname
, p
);
4111 static void GLAPIENTRY
4112 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
4114 GET_CURRENT_CONTEXT(ctx
);
4116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4117 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
4126 if (ctx
->ExecuteFlag
) {
4127 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
4132 static void GLAPIENTRY
4133 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
4136 p
[0] = (GLfloat
) params
[0];
4137 p
[1] = (GLfloat
) params
[1];
4138 p
[2] = (GLfloat
) params
[2];
4139 p
[3] = (GLfloat
) params
[3];
4140 save_TexGenfv(coord
, pname
, p
);
4144 static void GLAPIENTRY
4145 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
4148 parray
[0] = (GLfloat
) param
;
4149 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4150 save_TexGenfv(coord
, pname
, parray
);
4154 static void GLAPIENTRY
4155 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
4158 p
[0] = (GLfloat
) params
[0];
4159 p
[1] = (GLfloat
) params
[1];
4160 p
[2] = (GLfloat
) params
[2];
4161 p
[3] = (GLfloat
) params
[3];
4162 save_TexGenfv(coord
, pname
, p
);
4166 static void GLAPIENTRY
4167 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
4171 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4172 save_TexGenfv(coord
, pname
, parray
);
4176 static void GLAPIENTRY
4177 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
4181 parray
[1] = parray
[2] = parray
[3] = 0;
4182 save_TexGeniv(coord
, pname
, parray
);
4186 static void GLAPIENTRY
4187 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4189 GET_CURRENT_CONTEXT(ctx
);
4191 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4192 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
4201 if (ctx
->ExecuteFlag
) {
4202 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
4207 static void GLAPIENTRY
4208 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
4212 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4213 save_TexParameterfv(target
, pname
, parray
);
4217 static void GLAPIENTRY
4218 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
4221 fparam
[0] = (GLfloat
) param
;
4222 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4223 save_TexParameterfv(target
, pname
, fparam
);
4227 static void GLAPIENTRY
4228 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
4231 fparam
[0] = (GLfloat
) params
[0];
4232 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4233 save_TexParameterfv(target
, pname
, fparam
);
4237 static void GLAPIENTRY
4238 save_TexImage1D(GLenum target
,
4239 GLint level
, GLint components
,
4240 GLsizei width
, GLint border
,
4241 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4243 GET_CURRENT_CONTEXT(ctx
);
4244 if (target
== GL_PROXY_TEXTURE_1D
) {
4245 /* don't compile, execute immediately */
4246 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4247 border
, format
, type
, pixels
));
4251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4252 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
4256 n
[3].i
= components
;
4257 n
[4].i
= (GLint
) width
;
4262 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4263 pixels
, &ctx
->Unpack
));
4265 if (ctx
->ExecuteFlag
) {
4266 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4267 border
, format
, type
, pixels
));
4273 static void GLAPIENTRY
4274 save_TexImage2D(GLenum target
,
4275 GLint level
, GLint components
,
4276 GLsizei width
, GLsizei height
, GLint border
,
4277 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4279 GET_CURRENT_CONTEXT(ctx
);
4280 if (target
== GL_PROXY_TEXTURE_2D
) {
4281 /* don't compile, execute immediately */
4282 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4283 height
, border
, format
, type
, pixels
));
4287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4288 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
4292 n
[3].i
= components
;
4293 n
[4].i
= (GLint
) width
;
4294 n
[5].i
= (GLint
) height
;
4299 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4300 pixels
, &ctx
->Unpack
));
4302 if (ctx
->ExecuteFlag
) {
4303 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4304 height
, border
, format
, type
, pixels
));
4310 static void GLAPIENTRY
4311 save_TexImage3D(GLenum target
,
4312 GLint level
, GLint internalFormat
,
4313 GLsizei width
, GLsizei height
, GLsizei depth
,
4315 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4317 GET_CURRENT_CONTEXT(ctx
);
4318 if (target
== GL_PROXY_TEXTURE_3D
) {
4319 /* don't compile, execute immediately */
4320 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4321 height
, depth
, border
, format
, type
,
4326 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4327 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
4331 n
[3].i
= (GLint
) internalFormat
;
4332 n
[4].i
= (GLint
) width
;
4333 n
[5].i
= (GLint
) height
;
4334 n
[6].i
= (GLint
) depth
;
4338 save_pointer(&n
[10],
4339 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4340 pixels
, &ctx
->Unpack
));
4342 if (ctx
->ExecuteFlag
) {
4343 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4344 height
, depth
, border
, format
, type
,
4351 static void GLAPIENTRY
4352 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4353 GLsizei width
, GLenum format
, GLenum type
,
4354 const GLvoid
* pixels
)
4356 GET_CURRENT_CONTEXT(ctx
);
4359 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4361 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
4366 n
[4].i
= (GLint
) width
;
4370 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4371 pixels
, &ctx
->Unpack
));
4373 if (ctx
->ExecuteFlag
) {
4374 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4375 format
, type
, pixels
));
4380 static void GLAPIENTRY
4381 save_TexSubImage2D(GLenum target
, GLint level
,
4382 GLint xoffset
, GLint yoffset
,
4383 GLsizei width
, GLsizei height
,
4384 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4386 GET_CURRENT_CONTEXT(ctx
);
4389 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4391 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
4397 n
[5].i
= (GLint
) width
;
4398 n
[6].i
= (GLint
) height
;
4402 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4403 pixels
, &ctx
->Unpack
));
4405 if (ctx
->ExecuteFlag
) {
4406 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4407 width
, height
, format
, type
, pixels
));
4412 static void GLAPIENTRY
4413 save_TexSubImage3D(GLenum target
, GLint level
,
4414 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4415 GLsizei width
, GLsizei height
, GLsizei depth
,
4416 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4418 GET_CURRENT_CONTEXT(ctx
);
4421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4423 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4430 n
[6].i
= (GLint
) width
;
4431 n
[7].i
= (GLint
) height
;
4432 n
[8].i
= (GLint
) depth
;
4435 save_pointer(&n
[11],
4436 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4437 pixels
, &ctx
->Unpack
));
4439 if (ctx
->ExecuteFlag
) {
4440 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4441 xoffset
, yoffset
, zoffset
,
4442 width
, height
, depth
, format
, type
,
4448 static void GLAPIENTRY
4449 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4451 GET_CURRENT_CONTEXT(ctx
);
4453 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4454 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4460 if (ctx
->ExecuteFlag
) {
4461 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4466 static void GLAPIENTRY
4467 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4469 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4474 static void GLAPIENTRY
4475 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4477 GET_CURRENT_CONTEXT(ctx
);
4479 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4480 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4484 n
[3].i
= (GLint
) width
;
4485 n
[4].i
= (GLint
) height
;
4487 if (ctx
->ExecuteFlag
) {
4488 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4493 static void GLAPIENTRY
4494 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4496 GET_CURRENT_CONTEXT(ctx
);
4498 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4499 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4506 if (ctx
->ExecuteFlag
) {
4507 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4511 static void GLAPIENTRY
4512 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4514 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4517 static void GLAPIENTRY
4518 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4520 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4523 static void GLAPIENTRY
4524 save_WindowPos2iMESA(GLint x
, GLint y
)
4526 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4529 static void GLAPIENTRY
4530 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4532 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4535 static void GLAPIENTRY
4536 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4538 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4541 static void GLAPIENTRY
4542 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4544 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4547 static void GLAPIENTRY
4548 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4550 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4553 static void GLAPIENTRY
4554 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4556 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4559 static void GLAPIENTRY
4560 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4562 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4565 static void GLAPIENTRY
4566 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4568 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4571 static void GLAPIENTRY
4572 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4574 save_WindowPos4fMESA(x
, y
, z
, w
);
4577 static void GLAPIENTRY
4578 save_WindowPos2dvMESA(const GLdouble
* v
)
4580 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4583 static void GLAPIENTRY
4584 save_WindowPos2fvMESA(const GLfloat
* v
)
4586 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4589 static void GLAPIENTRY
4590 save_WindowPos2ivMESA(const GLint
* v
)
4592 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4595 static void GLAPIENTRY
4596 save_WindowPos2svMESA(const GLshort
* v
)
4598 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4601 static void GLAPIENTRY
4602 save_WindowPos3dvMESA(const GLdouble
* v
)
4604 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4607 static void GLAPIENTRY
4608 save_WindowPos3fvMESA(const GLfloat
* v
)
4610 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4613 static void GLAPIENTRY
4614 save_WindowPos3ivMESA(const GLint
* v
)
4616 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4619 static void GLAPIENTRY
4620 save_WindowPos3svMESA(const GLshort
* v
)
4622 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4625 static void GLAPIENTRY
4626 save_WindowPos4dvMESA(const GLdouble
* v
)
4628 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4629 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4632 static void GLAPIENTRY
4633 save_WindowPos4fvMESA(const GLfloat
* v
)
4635 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4638 static void GLAPIENTRY
4639 save_WindowPos4ivMESA(const GLint
* v
)
4641 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4642 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4645 static void GLAPIENTRY
4646 save_WindowPos4svMESA(const GLshort
* v
)
4648 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4653 /* GL_ARB_multitexture */
4654 static void GLAPIENTRY
4655 save_ActiveTextureARB(GLenum target
)
4657 GET_CURRENT_CONTEXT(ctx
);
4659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4660 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4664 if (ctx
->ExecuteFlag
) {
4665 CALL_ActiveTexture(ctx
->Exec
, (target
));
4670 /* GL_ARB_transpose_matrix */
4672 static void GLAPIENTRY
4673 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4676 _math_transposefd(tm
, m
);
4677 save_LoadMatrixf(tm
);
4681 static void GLAPIENTRY
4682 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4685 _math_transposef(tm
, m
);
4686 save_LoadMatrixf(tm
);
4690 static void GLAPIENTRY
4691 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4694 _math_transposefd(tm
, m
);
4695 save_MultMatrixf(tm
);
4699 static void GLAPIENTRY
4700 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4703 _math_transposef(tm
, m
);
4704 save_MultMatrixf(tm
);
4707 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4709 GET_CURRENT_CONTEXT(ctx
);
4715 image
= malloc(size
);
4717 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4720 memcpy(image
, data
, size
);
4726 /* GL_ARB_texture_compression */
4727 static void GLAPIENTRY
4728 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4729 GLenum internalFormat
, GLsizei width
,
4730 GLint border
, GLsizei imageSize
,
4731 const GLvoid
* data
)
4733 GET_CURRENT_CONTEXT(ctx
);
4734 if (target
== GL_PROXY_TEXTURE_1D
) {
4735 /* don't compile, execute immediately */
4736 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4737 width
, border
, imageSize
,
4742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4744 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4745 6 + POINTER_DWORDS
);
4749 n
[3].e
= internalFormat
;
4750 n
[4].i
= (GLint
) width
;
4754 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4756 if (ctx
->ExecuteFlag
) {
4757 CALL_CompressedTexImage1D(ctx
->Exec
,
4758 (target
, level
, internalFormat
, width
,
4759 border
, imageSize
, data
));
4765 static void GLAPIENTRY
4766 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4767 GLenum internalFormat
, GLsizei width
,
4768 GLsizei height
, GLint border
, GLsizei imageSize
,
4769 const GLvoid
* data
)
4771 GET_CURRENT_CONTEXT(ctx
);
4772 if (target
== GL_PROXY_TEXTURE_2D
) {
4773 /* don't compile, execute immediately */
4774 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4775 width
, height
, border
,
4780 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4782 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4783 7 + POINTER_DWORDS
);
4787 n
[3].e
= internalFormat
;
4788 n
[4].i
= (GLint
) width
;
4789 n
[5].i
= (GLint
) height
;
4793 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4795 if (ctx
->ExecuteFlag
) {
4796 CALL_CompressedTexImage2D(ctx
->Exec
,
4797 (target
, level
, internalFormat
, width
,
4798 height
, border
, imageSize
, data
));
4804 static void GLAPIENTRY
4805 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4806 GLenum internalFormat
, GLsizei width
,
4807 GLsizei height
, GLsizei depth
, GLint border
,
4808 GLsizei imageSize
, const GLvoid
* data
)
4810 GET_CURRENT_CONTEXT(ctx
);
4811 if (target
== GL_PROXY_TEXTURE_3D
) {
4812 /* don't compile, execute immediately */
4813 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4814 width
, height
, depth
, border
,
4819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4821 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4822 8 + POINTER_DWORDS
);
4826 n
[3].e
= internalFormat
;
4827 n
[4].i
= (GLint
) width
;
4828 n
[5].i
= (GLint
) height
;
4829 n
[6].i
= (GLint
) depth
;
4833 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4835 if (ctx
->ExecuteFlag
) {
4836 CALL_CompressedTexImage3D(ctx
->Exec
,
4837 (target
, level
, internalFormat
, width
,
4838 height
, depth
, border
, imageSize
,
4845 static void GLAPIENTRY
4846 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4847 GLsizei width
, GLenum format
,
4848 GLsizei imageSize
, const GLvoid
* data
)
4851 GET_CURRENT_CONTEXT(ctx
);
4852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4854 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4855 6 + POINTER_DWORDS
);
4860 n
[4].i
= (GLint
) width
;
4864 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4866 if (ctx
->ExecuteFlag
) {
4867 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4868 width
, format
, imageSize
,
4874 static void GLAPIENTRY
4875 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4876 GLint yoffset
, GLsizei width
, GLsizei height
,
4877 GLenum format
, GLsizei imageSize
,
4878 const GLvoid
* data
)
4881 GET_CURRENT_CONTEXT(ctx
);
4882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4884 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4885 8 + POINTER_DWORDS
);
4891 n
[5].i
= (GLint
) width
;
4892 n
[6].i
= (GLint
) height
;
4896 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4898 if (ctx
->ExecuteFlag
) {
4899 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4900 (target
, level
, xoffset
, yoffset
, width
,
4901 height
, format
, imageSize
, data
));
4906 static void GLAPIENTRY
4907 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4908 GLint yoffset
, GLint zoffset
, GLsizei width
,
4909 GLsizei height
, GLsizei depth
, GLenum format
,
4910 GLsizei imageSize
, const GLvoid
* data
)
4913 GET_CURRENT_CONTEXT(ctx
);
4914 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4916 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4917 10 + POINTER_DWORDS
);
4924 n
[6].i
= (GLint
) width
;
4925 n
[7].i
= (GLint
) height
;
4926 n
[8].i
= (GLint
) depth
;
4928 n
[10].i
= imageSize
;
4929 save_pointer(&n
[11],
4930 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4932 if (ctx
->ExecuteFlag
) {
4933 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4934 (target
, level
, xoffset
, yoffset
,
4935 zoffset
, width
, height
, depth
, format
,
4941 /* GL_ARB_multisample */
4942 static void GLAPIENTRY
4943 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4945 GET_CURRENT_CONTEXT(ctx
);
4947 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4948 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4953 if (ctx
->ExecuteFlag
) {
4954 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4960 * GL_NV_fragment_program
4962 static void GLAPIENTRY
4963 save_BindProgramNV(GLenum target
, GLuint id
)
4965 GET_CURRENT_CONTEXT(ctx
);
4967 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4968 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4973 if (ctx
->ExecuteFlag
) {
4974 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4978 static void GLAPIENTRY
4979 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4980 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4982 GET_CURRENT_CONTEXT(ctx
);
4984 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4985 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4994 if (ctx
->ExecuteFlag
) {
4995 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5000 static void GLAPIENTRY
5001 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
5002 const GLfloat
*params
)
5004 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
5005 params
[2], params
[3]);
5009 static void GLAPIENTRY
5010 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
5011 const GLfloat
* params
)
5013 GET_CURRENT_CONTEXT(ctx
);
5015 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5019 const GLfloat
* p
= params
;
5021 for (i
= 0 ; i
< count
; i
++) {
5022 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
5035 if (ctx
->ExecuteFlag
) {
5036 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5041 static void GLAPIENTRY
5042 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
5043 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
5045 save_ProgramEnvParameter4fARB(target
, index
,
5047 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
5051 static void GLAPIENTRY
5052 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
5053 const GLdouble
*params
)
5055 save_ProgramEnvParameter4fARB(target
, index
,
5056 (GLfloat
) params
[0],
5057 (GLfloat
) params
[1],
5058 (GLfloat
) params
[2], (GLfloat
) params
[3]);
5062 static void GLAPIENTRY
5063 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
5064 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5066 GET_CURRENT_CONTEXT(ctx
);
5068 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5069 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5078 if (ctx
->ExecuteFlag
) {
5079 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5084 static void GLAPIENTRY
5085 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
5086 const GLfloat
*params
)
5088 GET_CURRENT_CONTEXT(ctx
);
5090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5091 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5100 if (ctx
->ExecuteFlag
) {
5101 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
5106 static void GLAPIENTRY
5107 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
5108 const GLfloat
*params
)
5110 GET_CURRENT_CONTEXT(ctx
);
5112 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5116 const GLfloat
* p
= params
;
5118 for (i
= 0 ; i
< count
; i
++) {
5119 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5132 if (ctx
->ExecuteFlag
) {
5133 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5138 static void GLAPIENTRY
5139 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
5140 GLdouble x
, GLdouble y
,
5141 GLdouble z
, GLdouble w
)
5143 GET_CURRENT_CONTEXT(ctx
);
5145 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5146 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5150 n
[3].f
= (GLfloat
) x
;
5151 n
[4].f
= (GLfloat
) y
;
5152 n
[5].f
= (GLfloat
) z
;
5153 n
[6].f
= (GLfloat
) w
;
5155 if (ctx
->ExecuteFlag
) {
5156 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5161 static void GLAPIENTRY
5162 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
5163 const GLdouble
*params
)
5165 GET_CURRENT_CONTEXT(ctx
);
5167 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5168 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5172 n
[3].f
= (GLfloat
) params
[0];
5173 n
[4].f
= (GLfloat
) params
[1];
5174 n
[5].f
= (GLfloat
) params
[2];
5175 n
[6].f
= (GLfloat
) params
[3];
5177 if (ctx
->ExecuteFlag
) {
5178 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
5183 /* GL_EXT_stencil_two_side */
5184 static void GLAPIENTRY
5185 save_ActiveStencilFaceEXT(GLenum face
)
5187 GET_CURRENT_CONTEXT(ctx
);
5189 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5190 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
5194 if (ctx
->ExecuteFlag
) {
5195 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
5200 /* GL_EXT_depth_bounds_test */
5201 static void GLAPIENTRY
5202 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
5204 GET_CURRENT_CONTEXT(ctx
);
5206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5207 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
5209 n
[1].f
= (GLfloat
) zmin
;
5210 n
[2].f
= (GLfloat
) zmax
;
5212 if (ctx
->ExecuteFlag
) {
5213 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
5219 static void GLAPIENTRY
5220 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
5221 const GLvoid
* string
)
5223 GET_CURRENT_CONTEXT(ctx
);
5226 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5228 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
5230 GLubyte
*programCopy
= malloc(len
);
5232 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
5235 memcpy(programCopy
, string
, len
);
5239 save_pointer(&n
[4], programCopy
);
5241 if (ctx
->ExecuteFlag
) {
5242 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
5247 static void GLAPIENTRY
5248 save_BeginQueryARB(GLenum target
, GLuint id
)
5250 GET_CURRENT_CONTEXT(ctx
);
5252 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5253 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
5258 if (ctx
->ExecuteFlag
) {
5259 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
5263 static void GLAPIENTRY
5264 save_EndQueryARB(GLenum target
)
5266 GET_CURRENT_CONTEXT(ctx
);
5268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5269 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
5273 if (ctx
->ExecuteFlag
) {
5274 CALL_EndQuery(ctx
->Exec
, (target
));
5278 static void GLAPIENTRY
5279 save_QueryCounter(GLuint id
, GLenum target
)
5281 GET_CURRENT_CONTEXT(ctx
);
5283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5284 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
5289 if (ctx
->ExecuteFlag
) {
5290 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
5294 static void GLAPIENTRY
5295 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
5297 GET_CURRENT_CONTEXT(ctx
);
5299 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5300 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
5306 if (ctx
->ExecuteFlag
) {
5307 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5311 static void GLAPIENTRY
5312 save_EndQueryIndexed(GLenum target
, GLuint index
)
5314 GET_CURRENT_CONTEXT(ctx
);
5316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5317 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5322 if (ctx
->ExecuteFlag
) {
5323 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5328 static void GLAPIENTRY
5329 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5331 GET_CURRENT_CONTEXT(ctx
);
5333 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5334 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5338 if (count
> MAX_DRAW_BUFFERS
)
5339 count
= MAX_DRAW_BUFFERS
;
5340 for (i
= 0; i
< count
; i
++) {
5341 n
[2 + i
].e
= buffers
[i
];
5344 if (ctx
->ExecuteFlag
) {
5345 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5349 static void GLAPIENTRY
5350 save_BindFragmentShaderATI(GLuint id
)
5352 GET_CURRENT_CONTEXT(ctx
);
5355 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5359 if (ctx
->ExecuteFlag
) {
5360 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5364 static void GLAPIENTRY
5365 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5367 GET_CURRENT_CONTEXT(ctx
);
5370 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5378 if (ctx
->ExecuteFlag
) {
5379 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5383 static void GLAPIENTRY
5384 save_Attr1fNV(GLenum attr
, GLfloat x
)
5386 GET_CURRENT_CONTEXT(ctx
);
5388 SAVE_FLUSH_VERTICES(ctx
);
5389 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5395 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5396 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5397 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5399 if (ctx
->ExecuteFlag
) {
5400 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5404 static void GLAPIENTRY
5405 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5407 GET_CURRENT_CONTEXT(ctx
);
5409 SAVE_FLUSH_VERTICES(ctx
);
5410 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5417 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5418 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5419 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5421 if (ctx
->ExecuteFlag
) {
5422 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5426 static void GLAPIENTRY
5427 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5429 GET_CURRENT_CONTEXT(ctx
);
5431 SAVE_FLUSH_VERTICES(ctx
);
5432 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5440 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5441 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5442 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5444 if (ctx
->ExecuteFlag
) {
5445 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5449 static void GLAPIENTRY
5450 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5452 GET_CURRENT_CONTEXT(ctx
);
5454 SAVE_FLUSH_VERTICES(ctx
);
5455 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5464 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5465 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5466 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5468 if (ctx
->ExecuteFlag
) {
5469 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5474 static void GLAPIENTRY
5475 save_Attr1fARB(GLenum attr
, GLfloat x
)
5477 GET_CURRENT_CONTEXT(ctx
);
5479 SAVE_FLUSH_VERTICES(ctx
);
5480 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5486 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5487 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5488 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5490 if (ctx
->ExecuteFlag
) {
5491 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5495 static void GLAPIENTRY
5496 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5498 GET_CURRENT_CONTEXT(ctx
);
5500 SAVE_FLUSH_VERTICES(ctx
);
5501 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5508 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5509 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5510 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5512 if (ctx
->ExecuteFlag
) {
5513 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5517 static void GLAPIENTRY
5518 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5520 GET_CURRENT_CONTEXT(ctx
);
5522 SAVE_FLUSH_VERTICES(ctx
);
5523 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5531 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5532 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5533 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5535 if (ctx
->ExecuteFlag
) {
5536 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5540 static void GLAPIENTRY
5541 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5543 GET_CURRENT_CONTEXT(ctx
);
5545 SAVE_FLUSH_VERTICES(ctx
);
5546 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5555 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5556 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5557 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5559 if (ctx
->ExecuteFlag
) {
5560 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5565 static void GLAPIENTRY
5566 save_EvalCoord1f(GLfloat x
)
5568 GET_CURRENT_CONTEXT(ctx
);
5570 SAVE_FLUSH_VERTICES(ctx
);
5571 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5575 if (ctx
->ExecuteFlag
) {
5576 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5580 static void GLAPIENTRY
5581 save_EvalCoord1fv(const GLfloat
* v
)
5583 save_EvalCoord1f(v
[0]);
5586 static void GLAPIENTRY
5587 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5589 GET_CURRENT_CONTEXT(ctx
);
5591 SAVE_FLUSH_VERTICES(ctx
);
5592 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5597 if (ctx
->ExecuteFlag
) {
5598 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5602 static void GLAPIENTRY
5603 save_EvalCoord2fv(const GLfloat
* v
)
5605 save_EvalCoord2f(v
[0], v
[1]);
5609 static void GLAPIENTRY
5610 save_EvalPoint1(GLint x
)
5612 GET_CURRENT_CONTEXT(ctx
);
5614 SAVE_FLUSH_VERTICES(ctx
);
5615 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5619 if (ctx
->ExecuteFlag
) {
5620 CALL_EvalPoint1(ctx
->Exec
, (x
));
5624 static void GLAPIENTRY
5625 save_EvalPoint2(GLint x
, GLint y
)
5627 GET_CURRENT_CONTEXT(ctx
);
5629 SAVE_FLUSH_VERTICES(ctx
);
5630 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5635 if (ctx
->ExecuteFlag
) {
5636 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5640 static void GLAPIENTRY
5641 save_Indexf(GLfloat x
)
5643 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5646 static void GLAPIENTRY
5647 save_Indexfv(const GLfloat
* v
)
5649 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5652 static void GLAPIENTRY
5653 save_EdgeFlag(GLboolean x
)
5655 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5660 * Compare 'count' elements of vectors 'a' and 'b'.
5661 * \return GL_TRUE if equal, GL_FALSE if different.
5663 static inline GLboolean
5664 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5666 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5671 * This glMaterial function is used for glMaterial calls that are outside
5672 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5674 static void GLAPIENTRY
5675 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5677 GET_CURRENT_CONTEXT(ctx
);
5685 case GL_FRONT_AND_BACK
:
5688 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5697 case GL_AMBIENT_AND_DIFFUSE
:
5703 case GL_COLOR_INDEXES
:
5707 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5711 if (ctx
->ExecuteFlag
) {
5712 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5715 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5717 /* Try to eliminate redundant statechanges. Because it is legal to
5718 * call glMaterial even inside begin/end calls, don't need to worry
5719 * about ctx->Driver.CurrentSavePrimitive here.
5721 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5722 if (bitmask
& (1 << i
)) {
5723 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5724 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5725 /* no change in material value */
5726 bitmask
&= ~(1 << i
);
5729 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5730 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5735 /* If this call has no effect, return early */
5739 SAVE_FLUSH_VERTICES(ctx
);
5741 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5745 for (i
= 0; i
< args
; i
++)
5746 n
[3 + i
].f
= param
[i
];
5750 static void GLAPIENTRY
5751 save_Begin(GLenum mode
)
5753 GET_CURRENT_CONTEXT(ctx
);
5755 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5756 /* compile this error into the display list */
5757 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5759 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5760 /* compile this error into the display list */
5761 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5766 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5768 /* Give the driver an opportunity to hook in an optimized
5769 * display list compiler.
5771 if (vbo_save_NotifyBegin(ctx
, mode
))
5774 SAVE_FLUSH_VERTICES(ctx
);
5775 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5780 if (ctx
->ExecuteFlag
) {
5781 CALL_Begin(ctx
->Exec
, (mode
));
5786 static void GLAPIENTRY
5789 GET_CURRENT_CONTEXT(ctx
);
5790 SAVE_FLUSH_VERTICES(ctx
);
5791 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5792 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5793 if (ctx
->ExecuteFlag
) {
5794 CALL_End(ctx
->Exec
, ());
5798 static void GLAPIENTRY
5799 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5801 GET_CURRENT_CONTEXT(ctx
);
5803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5804 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5811 if (ctx
->ExecuteFlag
) {
5812 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5817 static void GLAPIENTRY
5818 save_Vertex2f(GLfloat x
, GLfloat y
)
5820 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5823 static void GLAPIENTRY
5824 save_Vertex2fv(const GLfloat
* v
)
5826 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5829 static void GLAPIENTRY
5830 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5832 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5835 static void GLAPIENTRY
5836 save_Vertex3fv(const GLfloat
* v
)
5838 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5841 static void GLAPIENTRY
5842 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5844 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5847 static void GLAPIENTRY
5848 save_Vertex4fv(const GLfloat
* v
)
5850 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5853 static void GLAPIENTRY
5854 save_TexCoord1f(GLfloat x
)
5856 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5859 static void GLAPIENTRY
5860 save_TexCoord1fv(const GLfloat
* v
)
5862 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5865 static void GLAPIENTRY
5866 save_TexCoord2f(GLfloat x
, GLfloat y
)
5868 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5871 static void GLAPIENTRY
5872 save_TexCoord2fv(const GLfloat
* v
)
5874 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5877 static void GLAPIENTRY
5878 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5880 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5883 static void GLAPIENTRY
5884 save_TexCoord3fv(const GLfloat
* v
)
5886 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5889 static void GLAPIENTRY
5890 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5892 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5895 static void GLAPIENTRY
5896 save_TexCoord4fv(const GLfloat
* v
)
5898 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5901 static void GLAPIENTRY
5902 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5904 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5907 static void GLAPIENTRY
5908 save_Normal3fv(const GLfloat
* v
)
5910 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5913 static void GLAPIENTRY
5914 save_FogCoordfEXT(GLfloat x
)
5916 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5919 static void GLAPIENTRY
5920 save_FogCoordfvEXT(const GLfloat
* v
)
5922 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5925 static void GLAPIENTRY
5926 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5928 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5931 static void GLAPIENTRY
5932 save_Color3fv(const GLfloat
* v
)
5934 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5937 static void GLAPIENTRY
5938 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5940 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5943 static void GLAPIENTRY
5944 save_Color4fv(const GLfloat
* v
)
5946 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5949 static void GLAPIENTRY
5950 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5952 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5955 static void GLAPIENTRY
5956 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5958 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5962 /* Just call the respective ATTR for texcoord
5964 static void GLAPIENTRY
5965 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5967 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5968 save_Attr1fNV(attr
, x
);
5971 static void GLAPIENTRY
5972 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5974 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5975 save_Attr1fNV(attr
, v
[0]);
5978 static void GLAPIENTRY
5979 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5981 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5982 save_Attr2fNV(attr
, x
, y
);
5985 static void GLAPIENTRY
5986 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5988 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5989 save_Attr2fNV(attr
, v
[0], v
[1]);
5992 static void GLAPIENTRY
5993 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5995 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5996 save_Attr3fNV(attr
, x
, y
, z
);
5999 static void GLAPIENTRY
6000 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
6002 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6003 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
6006 static void GLAPIENTRY
6007 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
6008 GLfloat z
, GLfloat w
)
6010 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6011 save_Attr4fNV(attr
, x
, y
, z
, w
);
6014 static void GLAPIENTRY
6015 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
6017 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
6018 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
6023 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
6029 GET_CURRENT_CONTEXT(ctx
);
6030 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
6035 static void GLAPIENTRY
6036 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
6038 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6039 save_Attr1fARB(index
, x
);
6044 static void GLAPIENTRY
6045 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
6047 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6048 save_Attr1fARB(index
, v
[0]);
6053 static void GLAPIENTRY
6054 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
6056 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6057 save_Attr2fARB(index
, x
, y
);
6062 static void GLAPIENTRY
6063 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
6065 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6066 save_Attr2fARB(index
, v
[0], v
[1]);
6071 static void GLAPIENTRY
6072 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
6074 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6075 save_Attr3fARB(index
, x
, y
, z
);
6080 static void GLAPIENTRY
6081 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
6083 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6084 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
6089 static void GLAPIENTRY
6090 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
6093 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6094 save_Attr4fARB(index
, x
, y
, z
, w
);
6099 static void GLAPIENTRY
6100 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
6102 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6103 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
6108 static void GLAPIENTRY
6109 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
6110 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
6111 GLbitfield mask
, GLenum filter
)
6113 GET_CURRENT_CONTEXT(ctx
);
6115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6116 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
6129 if (ctx
->ExecuteFlag
) {
6130 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
6131 dstX0
, dstY0
, dstX1
, dstY1
,
6137 /** GL_EXT_provoking_vertex */
6138 static void GLAPIENTRY
6139 save_ProvokingVertexEXT(GLenum mode
)
6141 GET_CURRENT_CONTEXT(ctx
);
6143 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6144 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
6148 if (ctx
->ExecuteFlag
) {
6149 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6150 _mesa_ProvokingVertex(mode
);
6155 /** GL_EXT_transform_feedback */
6156 static void GLAPIENTRY
6157 save_BeginTransformFeedback(GLenum mode
)
6159 GET_CURRENT_CONTEXT(ctx
);
6161 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6162 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
6166 if (ctx
->ExecuteFlag
) {
6167 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
6172 /** GL_EXT_transform_feedback */
6173 static void GLAPIENTRY
6174 save_EndTransformFeedback(void)
6176 GET_CURRENT_CONTEXT(ctx
);
6177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6178 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
6179 if (ctx
->ExecuteFlag
) {
6180 CALL_EndTransformFeedback(ctx
->Exec
, ());
6184 static void GLAPIENTRY
6185 save_BindTransformFeedback(GLenum target
, GLuint name
)
6187 GET_CURRENT_CONTEXT(ctx
);
6189 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6190 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
6195 if (ctx
->ExecuteFlag
) {
6196 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
6200 static void GLAPIENTRY
6201 save_PauseTransformFeedback(void)
6203 GET_CURRENT_CONTEXT(ctx
);
6204 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6205 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
6206 if (ctx
->ExecuteFlag
) {
6207 CALL_PauseTransformFeedback(ctx
->Exec
, ());
6211 static void GLAPIENTRY
6212 save_ResumeTransformFeedback(void)
6214 GET_CURRENT_CONTEXT(ctx
);
6215 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6216 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
6217 if (ctx
->ExecuteFlag
) {
6218 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
6222 static void GLAPIENTRY
6223 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
6225 GET_CURRENT_CONTEXT(ctx
);
6227 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6228 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
6233 if (ctx
->ExecuteFlag
) {
6234 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
6238 static void GLAPIENTRY
6239 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
6241 GET_CURRENT_CONTEXT(ctx
);
6243 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6244 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
6250 if (ctx
->ExecuteFlag
) {
6251 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
6255 static void GLAPIENTRY
6256 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
6259 GET_CURRENT_CONTEXT(ctx
);
6261 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6262 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
6266 n
[3].si
= primcount
;
6268 if (ctx
->ExecuteFlag
) {
6269 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
6273 static void GLAPIENTRY
6274 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
6275 GLuint stream
, GLsizei primcount
)
6277 GET_CURRENT_CONTEXT(ctx
);
6279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6280 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
6285 n
[4].si
= primcount
;
6287 if (ctx
->ExecuteFlag
) {
6288 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
6293 static void GLAPIENTRY
6294 save_UseProgram(GLuint program
)
6296 GET_CURRENT_CONTEXT(ctx
);
6298 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6299 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
6303 if (ctx
->ExecuteFlag
) {
6304 CALL_UseProgram(ctx
->Exec
, (program
));
6309 static void GLAPIENTRY
6310 save_Uniform1fARB(GLint location
, GLfloat x
)
6312 GET_CURRENT_CONTEXT(ctx
);
6314 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6315 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6320 if (ctx
->ExecuteFlag
) {
6321 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6326 static void GLAPIENTRY
6327 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6329 GET_CURRENT_CONTEXT(ctx
);
6331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6332 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6338 if (ctx
->ExecuteFlag
) {
6339 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6344 static void GLAPIENTRY
6345 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6347 GET_CURRENT_CONTEXT(ctx
);
6349 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6350 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6357 if (ctx
->ExecuteFlag
) {
6358 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6363 static void GLAPIENTRY
6364 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6366 GET_CURRENT_CONTEXT(ctx
);
6368 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6369 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6377 if (ctx
->ExecuteFlag
) {
6378 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6383 static void GLAPIENTRY
6384 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6386 GET_CURRENT_CONTEXT(ctx
);
6388 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6389 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
6393 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6395 if (ctx
->ExecuteFlag
) {
6396 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6400 static void GLAPIENTRY
6401 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6403 GET_CURRENT_CONTEXT(ctx
);
6405 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6406 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6410 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6412 if (ctx
->ExecuteFlag
) {
6413 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6417 static void GLAPIENTRY
6418 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6420 GET_CURRENT_CONTEXT(ctx
);
6422 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6423 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6427 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6429 if (ctx
->ExecuteFlag
) {
6430 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6434 static void GLAPIENTRY
6435 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6437 GET_CURRENT_CONTEXT(ctx
);
6439 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6440 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6444 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6446 if (ctx
->ExecuteFlag
) {
6447 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6452 static void GLAPIENTRY
6453 save_Uniform1iARB(GLint location
, GLint x
)
6455 GET_CURRENT_CONTEXT(ctx
);
6457 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6458 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6463 if (ctx
->ExecuteFlag
) {
6464 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6468 static void GLAPIENTRY
6469 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6471 GET_CURRENT_CONTEXT(ctx
);
6473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6474 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6480 if (ctx
->ExecuteFlag
) {
6481 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6485 static void GLAPIENTRY
6486 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6488 GET_CURRENT_CONTEXT(ctx
);
6490 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6491 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6498 if (ctx
->ExecuteFlag
) {
6499 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6503 static void GLAPIENTRY
6504 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6506 GET_CURRENT_CONTEXT(ctx
);
6508 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6509 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6517 if (ctx
->ExecuteFlag
) {
6518 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6524 static void GLAPIENTRY
6525 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6527 GET_CURRENT_CONTEXT(ctx
);
6529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6530 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6534 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6536 if (ctx
->ExecuteFlag
) {
6537 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6541 static void GLAPIENTRY
6542 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6544 GET_CURRENT_CONTEXT(ctx
);
6546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6547 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6551 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6553 if (ctx
->ExecuteFlag
) {
6554 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6558 static void GLAPIENTRY
6559 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6561 GET_CURRENT_CONTEXT(ctx
);
6563 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6564 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6568 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6570 if (ctx
->ExecuteFlag
) {
6571 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6575 static void GLAPIENTRY
6576 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6578 GET_CURRENT_CONTEXT(ctx
);
6580 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6581 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6585 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6587 if (ctx
->ExecuteFlag
) {
6588 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6594 static void GLAPIENTRY
6595 save_Uniform1ui(GLint location
, GLuint x
)
6597 GET_CURRENT_CONTEXT(ctx
);
6599 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6600 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6605 if (ctx
->ExecuteFlag
) {
6606 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6610 static void GLAPIENTRY
6611 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6613 GET_CURRENT_CONTEXT(ctx
);
6615 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6616 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6622 if (ctx
->ExecuteFlag
) {
6623 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6627 static void GLAPIENTRY
6628 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6630 GET_CURRENT_CONTEXT(ctx
);
6632 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6633 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6640 if (ctx
->ExecuteFlag
) {
6641 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6645 static void GLAPIENTRY
6646 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6648 GET_CURRENT_CONTEXT(ctx
);
6650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6651 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6659 if (ctx
->ExecuteFlag
) {
6660 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6666 static void GLAPIENTRY
6667 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6669 GET_CURRENT_CONTEXT(ctx
);
6671 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6672 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6676 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6678 if (ctx
->ExecuteFlag
) {
6679 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6683 static void GLAPIENTRY
6684 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6686 GET_CURRENT_CONTEXT(ctx
);
6688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6689 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6693 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6695 if (ctx
->ExecuteFlag
) {
6696 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6700 static void GLAPIENTRY
6701 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6703 GET_CURRENT_CONTEXT(ctx
);
6705 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6706 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6710 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6712 if (ctx
->ExecuteFlag
) {
6713 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6717 static void GLAPIENTRY
6718 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6720 GET_CURRENT_CONTEXT(ctx
);
6722 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6723 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6727 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6729 if (ctx
->ExecuteFlag
) {
6730 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6736 static void GLAPIENTRY
6737 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6740 GET_CURRENT_CONTEXT(ctx
);
6742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6743 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6748 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6750 if (ctx
->ExecuteFlag
) {
6751 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6755 static void GLAPIENTRY
6756 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6759 GET_CURRENT_CONTEXT(ctx
);
6761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6762 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6767 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6769 if (ctx
->ExecuteFlag
) {
6770 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6774 static void GLAPIENTRY
6775 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6778 GET_CURRENT_CONTEXT(ctx
);
6780 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6781 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6786 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6788 if (ctx
->ExecuteFlag
) {
6789 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6794 static void GLAPIENTRY
6795 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6798 GET_CURRENT_CONTEXT(ctx
);
6800 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6801 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6806 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6808 if (ctx
->ExecuteFlag
) {
6809 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6813 static void GLAPIENTRY
6814 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6817 GET_CURRENT_CONTEXT(ctx
);
6819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6820 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6825 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6827 if (ctx
->ExecuteFlag
) {
6828 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6833 static void GLAPIENTRY
6834 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6837 GET_CURRENT_CONTEXT(ctx
);
6839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6840 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6845 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6847 if (ctx
->ExecuteFlag
) {
6848 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6852 static void GLAPIENTRY
6853 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6856 GET_CURRENT_CONTEXT(ctx
);
6858 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6859 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6864 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6866 if (ctx
->ExecuteFlag
) {
6867 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6872 static void GLAPIENTRY
6873 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6876 GET_CURRENT_CONTEXT(ctx
);
6878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6879 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6884 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6886 if (ctx
->ExecuteFlag
) {
6887 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6891 static void GLAPIENTRY
6892 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6895 GET_CURRENT_CONTEXT(ctx
);
6897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6898 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6903 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6905 if (ctx
->ExecuteFlag
) {
6906 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6910 static void GLAPIENTRY
6911 save_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
6913 GET_CURRENT_CONTEXT(ctx
);
6915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6916 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM_STAGES
, 3);
6922 if (ctx
->ExecuteFlag
) {
6923 CALL_UseProgramStages(ctx
->Exec
, (pipeline
, stages
, program
));
6927 static void GLAPIENTRY
6928 save_ProgramUniform1f(GLuint program
, GLint location
, GLfloat x
)
6930 GET_CURRENT_CONTEXT(ctx
);
6932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6933 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1F
, 3);
6939 if (ctx
->ExecuteFlag
) {
6940 CALL_ProgramUniform1f(ctx
->Exec
, (program
, location
, x
));
6944 static void GLAPIENTRY
6945 save_ProgramUniform2f(GLuint program
, GLint location
, GLfloat x
, GLfloat y
)
6947 GET_CURRENT_CONTEXT(ctx
);
6949 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6950 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2F
, 4);
6957 if (ctx
->ExecuteFlag
) {
6958 CALL_ProgramUniform2f(ctx
->Exec
, (program
, location
, x
, y
));
6962 static void GLAPIENTRY
6963 save_ProgramUniform3f(GLuint program
, GLint location
,
6964 GLfloat x
, GLfloat y
, GLfloat z
)
6966 GET_CURRENT_CONTEXT(ctx
);
6968 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6969 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3F
, 5);
6977 if (ctx
->ExecuteFlag
) {
6978 CALL_ProgramUniform3f(ctx
->Exec
, (program
, location
, x
, y
, z
));
6982 static void GLAPIENTRY
6983 save_ProgramUniform4f(GLuint program
, GLint location
,
6984 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6986 GET_CURRENT_CONTEXT(ctx
);
6988 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6989 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4F
, 6);
6998 if (ctx
->ExecuteFlag
) {
6999 CALL_ProgramUniform4f(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7003 static void GLAPIENTRY
7004 save_ProgramUniform1fv(GLuint program
, GLint location
, GLsizei count
,
7007 GET_CURRENT_CONTEXT(ctx
);
7009 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7010 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1FV
, 3 + POINTER_DWORDS
);
7015 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLfloat
)));
7017 if (ctx
->ExecuteFlag
) {
7018 CALL_ProgramUniform1fv(ctx
->Exec
, (program
, location
, count
, v
));
7022 static void GLAPIENTRY
7023 save_ProgramUniform2fv(GLuint program
, GLint location
, GLsizei count
,
7026 GET_CURRENT_CONTEXT(ctx
);
7028 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7029 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2FV
, 3 + POINTER_DWORDS
);
7034 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLfloat
)));
7036 if (ctx
->ExecuteFlag
) {
7037 CALL_ProgramUniform2fv(ctx
->Exec
, (program
, location
, count
, v
));
7041 static void GLAPIENTRY
7042 save_ProgramUniform3fv(GLuint program
, GLint location
, GLsizei count
,
7045 GET_CURRENT_CONTEXT(ctx
);
7047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7048 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3FV
, 3 + POINTER_DWORDS
);
7053 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLfloat
)));
7055 if (ctx
->ExecuteFlag
) {
7056 CALL_ProgramUniform3fv(ctx
->Exec
, (program
, location
, count
, v
));
7060 static void GLAPIENTRY
7061 save_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
7064 GET_CURRENT_CONTEXT(ctx
);
7066 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7067 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4FV
, 3 + POINTER_DWORDS
);
7072 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLfloat
)));
7074 if (ctx
->ExecuteFlag
) {
7075 CALL_ProgramUniform4fv(ctx
->Exec
, (program
, location
, count
, v
));
7079 static void GLAPIENTRY
7080 save_ProgramUniform1i(GLuint program
, GLint location
, GLint x
)
7082 GET_CURRENT_CONTEXT(ctx
);
7084 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7085 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1I
, 3);
7091 if (ctx
->ExecuteFlag
) {
7092 CALL_ProgramUniform1i(ctx
->Exec
, (program
, location
, x
));
7096 static void GLAPIENTRY
7097 save_ProgramUniform2i(GLuint program
, GLint location
, GLint x
, GLint y
)
7099 GET_CURRENT_CONTEXT(ctx
);
7101 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7102 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2I
, 4);
7109 if (ctx
->ExecuteFlag
) {
7110 CALL_ProgramUniform2i(ctx
->Exec
, (program
, location
, x
, y
));
7114 static void GLAPIENTRY
7115 save_ProgramUniform3i(GLuint program
, GLint location
,
7116 GLint x
, GLint y
, GLint z
)
7118 GET_CURRENT_CONTEXT(ctx
);
7120 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7121 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3I
, 5);
7129 if (ctx
->ExecuteFlag
) {
7130 CALL_ProgramUniform3i(ctx
->Exec
, (program
, location
, x
, y
, z
));
7134 static void GLAPIENTRY
7135 save_ProgramUniform4i(GLuint program
, GLint location
,
7136 GLint x
, GLint y
, GLint z
, GLint w
)
7138 GET_CURRENT_CONTEXT(ctx
);
7140 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7141 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4I
, 6);
7150 if (ctx
->ExecuteFlag
) {
7151 CALL_ProgramUniform4i(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7155 static void GLAPIENTRY
7156 save_ProgramUniform1iv(GLuint program
, GLint location
, GLsizei count
,
7159 GET_CURRENT_CONTEXT(ctx
);
7161 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7162 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1IV
, 3 + POINTER_DWORDS
);
7167 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLint
)));
7169 if (ctx
->ExecuteFlag
) {
7170 CALL_ProgramUniform1iv(ctx
->Exec
, (program
, location
, count
, v
));
7174 static void GLAPIENTRY
7175 save_ProgramUniform2iv(GLuint program
, GLint location
, GLsizei count
,
7178 GET_CURRENT_CONTEXT(ctx
);
7180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7181 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2IV
, 3 + POINTER_DWORDS
);
7186 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLint
)));
7188 if (ctx
->ExecuteFlag
) {
7189 CALL_ProgramUniform2iv(ctx
->Exec
, (program
, location
, count
, v
));
7193 static void GLAPIENTRY
7194 save_ProgramUniform3iv(GLuint program
, GLint location
, GLsizei count
,
7197 GET_CURRENT_CONTEXT(ctx
);
7199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7200 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3IV
, 3 + POINTER_DWORDS
);
7205 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLint
)));
7207 if (ctx
->ExecuteFlag
) {
7208 CALL_ProgramUniform3iv(ctx
->Exec
, (program
, location
, count
, v
));
7212 static void GLAPIENTRY
7213 save_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
7216 GET_CURRENT_CONTEXT(ctx
);
7218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7219 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4IV
, 3 + POINTER_DWORDS
);
7224 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLint
)));
7226 if (ctx
->ExecuteFlag
) {
7227 CALL_ProgramUniform4iv(ctx
->Exec
, (program
, location
, count
, v
));
7231 static void GLAPIENTRY
7232 save_ProgramUniform1ui(GLuint program
, GLint location
, GLuint x
)
7234 GET_CURRENT_CONTEXT(ctx
);
7236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7237 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UI
, 3);
7243 if (ctx
->ExecuteFlag
) {
7244 CALL_ProgramUniform1ui(ctx
->Exec
, (program
, location
, x
));
7248 static void GLAPIENTRY
7249 save_ProgramUniform2ui(GLuint program
, GLint location
, GLuint x
, GLuint y
)
7251 GET_CURRENT_CONTEXT(ctx
);
7253 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7254 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UI
, 4);
7261 if (ctx
->ExecuteFlag
) {
7262 CALL_ProgramUniform2ui(ctx
->Exec
, (program
, location
, x
, y
));
7266 static void GLAPIENTRY
7267 save_ProgramUniform3ui(GLuint program
, GLint location
,
7268 GLuint x
, GLuint y
, GLuint z
)
7270 GET_CURRENT_CONTEXT(ctx
);
7272 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7273 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UI
, 5);
7281 if (ctx
->ExecuteFlag
) {
7282 CALL_ProgramUniform3ui(ctx
->Exec
, (program
, location
, x
, y
, z
));
7286 static void GLAPIENTRY
7287 save_ProgramUniform4ui(GLuint program
, GLint location
,
7288 GLuint x
, GLuint y
, GLuint z
, GLuint w
)
7290 GET_CURRENT_CONTEXT(ctx
);
7292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7293 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UI
, 6);
7302 if (ctx
->ExecuteFlag
) {
7303 CALL_ProgramUniform4ui(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7307 static void GLAPIENTRY
7308 save_ProgramUniform1uiv(GLuint program
, GLint location
, GLsizei count
,
7311 GET_CURRENT_CONTEXT(ctx
);
7313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7314 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UIV
, 3 + POINTER_DWORDS
);
7319 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLuint
)));
7321 if (ctx
->ExecuteFlag
) {
7322 CALL_ProgramUniform1uiv(ctx
->Exec
, (program
, location
, count
, v
));
7326 static void GLAPIENTRY
7327 save_ProgramUniform2uiv(GLuint program
, GLint location
, GLsizei count
,
7330 GET_CURRENT_CONTEXT(ctx
);
7332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7333 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UIV
, 3 + POINTER_DWORDS
);
7338 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLuint
)));
7340 if (ctx
->ExecuteFlag
) {
7341 CALL_ProgramUniform2uiv(ctx
->Exec
, (program
, location
, count
, v
));
7345 static void GLAPIENTRY
7346 save_ProgramUniform3uiv(GLuint program
, GLint location
, GLsizei count
,
7349 GET_CURRENT_CONTEXT(ctx
);
7351 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7352 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UIV
, 3 + POINTER_DWORDS
);
7357 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLuint
)));
7359 if (ctx
->ExecuteFlag
) {
7360 CALL_ProgramUniform3uiv(ctx
->Exec
, (program
, location
, count
, v
));
7364 static void GLAPIENTRY
7365 save_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
7368 GET_CURRENT_CONTEXT(ctx
);
7370 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7371 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UIV
, 3 + POINTER_DWORDS
);
7376 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLuint
)));
7378 if (ctx
->ExecuteFlag
) {
7379 CALL_ProgramUniform4uiv(ctx
->Exec
, (program
, location
, count
, v
));
7383 static void GLAPIENTRY
7384 save_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
7385 GLboolean transpose
, const GLfloat
*v
)
7387 GET_CURRENT_CONTEXT(ctx
);
7389 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7390 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
7391 4 + POINTER_DWORDS
);
7397 save_pointer(&n
[5], memdup(v
, count
* 2 * 2 * sizeof(GLfloat
)));
7399 if (ctx
->ExecuteFlag
) {
7400 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
7401 (program
, location
, count
, transpose
, v
));
7405 static void GLAPIENTRY
7406 save_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
7407 GLboolean transpose
, const GLfloat
*v
)
7409 GET_CURRENT_CONTEXT(ctx
);
7411 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7412 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
7413 4 + POINTER_DWORDS
);
7419 save_pointer(&n
[5], memdup(v
, count
* 2 * 3 * sizeof(GLfloat
)));
7421 if (ctx
->ExecuteFlag
) {
7422 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
7423 (program
, location
, count
, transpose
, v
));
7427 static void GLAPIENTRY
7428 save_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
7429 GLboolean transpose
, const GLfloat
*v
)
7431 GET_CURRENT_CONTEXT(ctx
);
7433 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7434 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
7435 4 + POINTER_DWORDS
);
7441 save_pointer(&n
[5], memdup(v
, count
* 2 * 4 * sizeof(GLfloat
)));
7443 if (ctx
->ExecuteFlag
) {
7444 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
7445 (program
, location
, count
, transpose
, v
));
7449 static void GLAPIENTRY
7450 save_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
7451 GLboolean transpose
, const GLfloat
*v
)
7453 GET_CURRENT_CONTEXT(ctx
);
7455 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7456 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
7457 4 + POINTER_DWORDS
);
7463 save_pointer(&n
[5], memdup(v
, count
* 3 * 2 * sizeof(GLfloat
)));
7465 if (ctx
->ExecuteFlag
) {
7466 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
7467 (program
, location
, count
, transpose
, v
));
7471 static void GLAPIENTRY
7472 save_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
7473 GLboolean transpose
, const GLfloat
*v
)
7475 GET_CURRENT_CONTEXT(ctx
);
7477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7478 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
7479 4 + POINTER_DWORDS
);
7485 save_pointer(&n
[5], memdup(v
, count
* 3 * 3 * sizeof(GLfloat
)));
7487 if (ctx
->ExecuteFlag
) {
7488 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
7489 (program
, location
, count
, transpose
, v
));
7493 static void GLAPIENTRY
7494 save_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
7495 GLboolean transpose
, const GLfloat
*v
)
7497 GET_CURRENT_CONTEXT(ctx
);
7499 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7500 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
7501 4 + POINTER_DWORDS
);
7507 save_pointer(&n
[5], memdup(v
, count
* 3 * 4 * sizeof(GLfloat
)));
7509 if (ctx
->ExecuteFlag
) {
7510 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
7511 (program
, location
, count
, transpose
, v
));
7515 static void GLAPIENTRY
7516 save_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
7517 GLboolean transpose
, const GLfloat
*v
)
7519 GET_CURRENT_CONTEXT(ctx
);
7521 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7522 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
7523 4 + POINTER_DWORDS
);
7529 save_pointer(&n
[5], memdup(v
, count
* 4 * 2 * sizeof(GLfloat
)));
7531 if (ctx
->ExecuteFlag
) {
7532 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
7533 (program
, location
, count
, transpose
, v
));
7537 static void GLAPIENTRY
7538 save_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
7539 GLboolean transpose
, const GLfloat
*v
)
7541 GET_CURRENT_CONTEXT(ctx
);
7543 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7544 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
7545 4 + POINTER_DWORDS
);
7551 save_pointer(&n
[5], memdup(v
, count
* 4 * 3 * sizeof(GLfloat
)));
7553 if (ctx
->ExecuteFlag
) {
7554 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
7555 (program
, location
, count
, transpose
, v
));
7559 static void GLAPIENTRY
7560 save_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
7561 GLboolean transpose
, const GLfloat
*v
)
7563 GET_CURRENT_CONTEXT(ctx
);
7565 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7566 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
7567 4 + POINTER_DWORDS
);
7573 save_pointer(&n
[5], memdup(v
, count
* 4 * 4 * sizeof(GLfloat
)));
7575 if (ctx
->ExecuteFlag
) {
7576 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
7577 (program
, location
, count
, transpose
, v
));
7581 static void GLAPIENTRY
7582 save_ClipControl(GLenum origin
, GLenum depth
)
7584 GET_CURRENT_CONTEXT(ctx
);
7586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7587 n
= alloc_instruction(ctx
, OPCODE_CLIP_CONTROL
, 2);
7592 if (ctx
->ExecuteFlag
) {
7593 CALL_ClipControl(ctx
->Exec
, (origin
, depth
));
7597 static void GLAPIENTRY
7598 save_ClampColorARB(GLenum target
, GLenum clamp
)
7600 GET_CURRENT_CONTEXT(ctx
);
7602 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7603 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
7608 if (ctx
->ExecuteFlag
) {
7609 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
7613 /** GL_EXT_texture_integer */
7614 static void GLAPIENTRY
7615 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
7617 GET_CURRENT_CONTEXT(ctx
);
7619 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7620 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
7627 if (ctx
->ExecuteFlag
) {
7628 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7632 /** GL_EXT_texture_integer */
7633 static void GLAPIENTRY
7634 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
7636 GET_CURRENT_CONTEXT(ctx
);
7638 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7639 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
7646 if (ctx
->ExecuteFlag
) {
7647 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7651 /** GL_EXT_texture_integer */
7652 static void GLAPIENTRY
7653 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
7655 GET_CURRENT_CONTEXT(ctx
);
7657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7658 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
7667 if (ctx
->ExecuteFlag
) {
7668 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
7672 /** GL_EXT_texture_integer */
7673 static void GLAPIENTRY
7674 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
7676 GET_CURRENT_CONTEXT(ctx
);
7678 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7679 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
7683 n
[3].ui
= params
[0];
7684 n
[4].ui
= params
[1];
7685 n
[5].ui
= params
[2];
7686 n
[6].ui
= params
[3];
7688 if (ctx
->ExecuteFlag
) {
7689 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
7693 /* GL_ARB_instanced_arrays */
7694 static void GLAPIENTRY
7695 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
7697 GET_CURRENT_CONTEXT(ctx
);
7699 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7700 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
7705 if (ctx
->ExecuteFlag
) {
7706 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
7711 /* GL_NV_texture_barrier */
7712 static void GLAPIENTRY
7713 save_TextureBarrierNV(void)
7715 GET_CURRENT_CONTEXT(ctx
);
7716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7717 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
7718 if (ctx
->ExecuteFlag
) {
7719 CALL_TextureBarrierNV(ctx
->Exec
, ());
7724 /* GL_ARB_sampler_objects */
7725 static void GLAPIENTRY
7726 save_BindSampler(GLuint unit
, GLuint sampler
)
7729 GET_CURRENT_CONTEXT(ctx
);
7730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7731 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
7736 if (ctx
->ExecuteFlag
) {
7737 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
7741 static void GLAPIENTRY
7742 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7745 GET_CURRENT_CONTEXT(ctx
);
7746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7747 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7752 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7758 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7761 if (ctx
->ExecuteFlag
) {
7762 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7766 static void GLAPIENTRY
7767 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7771 parray
[1] = parray
[2] = parray
[3] = 0;
7772 save_SamplerParameteriv(sampler
, pname
, parray
);
7775 static void GLAPIENTRY
7776 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7779 GET_CURRENT_CONTEXT(ctx
);
7780 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7781 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7786 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7792 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7795 if (ctx
->ExecuteFlag
) {
7796 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7800 static void GLAPIENTRY
7801 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7805 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7806 save_SamplerParameterfv(sampler
, pname
, parray
);
7809 static void GLAPIENTRY
7810 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7813 GET_CURRENT_CONTEXT(ctx
);
7814 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7815 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7820 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7826 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7829 if (ctx
->ExecuteFlag
) {
7830 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7834 static void GLAPIENTRY
7835 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7838 GET_CURRENT_CONTEXT(ctx
);
7839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7840 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7844 n
[3].ui
= params
[0];
7845 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7846 n
[4].ui
= params
[1];
7847 n
[5].ui
= params
[2];
7848 n
[6].ui
= params
[3];
7851 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7854 if (ctx
->ExecuteFlag
) {
7855 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7859 static void GLAPIENTRY
7860 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7863 GET_CURRENT_CONTEXT(ctx
);
7864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7865 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7867 union uint64_pair p
;
7870 n
[2].ui
= p
.uint32
[0];
7871 n
[3].ui
= p
.uint32
[1];
7872 save_pointer(&n
[4], sync
);
7874 if (ctx
->ExecuteFlag
) {
7875 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7880 /** GL_NV_conditional_render */
7881 static void GLAPIENTRY
7882 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7884 GET_CURRENT_CONTEXT(ctx
);
7886 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7887 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7892 if (ctx
->ExecuteFlag
) {
7893 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7897 static void GLAPIENTRY
7898 save_EndConditionalRender(void)
7900 GET_CURRENT_CONTEXT(ctx
);
7901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7902 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7903 if (ctx
->ExecuteFlag
) {
7904 CALL_EndConditionalRender(ctx
->Exec
, ());
7908 static void GLAPIENTRY
7909 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7911 GET_CURRENT_CONTEXT(ctx
);
7913 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7914 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7920 if (ctx
->ExecuteFlag
) {
7921 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7927 * Save an error-generating command into display list.
7929 * KW: Will appear in the list before the vertex buffer containing the
7930 * command that provoked the error. I don't see this as a problem.
7933 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7936 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
7939 save_pointer(&n
[2], (void *) s
);
7940 /* note: the data/string here doesn't have to be freed in
7941 * _mesa_delete_list() since the string is never dynamically
7949 * Compile an error into current display list.
7952 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7954 if (ctx
->CompileFlag
)
7955 save_error(ctx
, error
, s
);
7956 if (ctx
->ExecuteFlag
)
7957 _mesa_error(ctx
, error
, "%s", s
);
7962 * Test if ID names a display list.
7965 islist(struct gl_context
*ctx
, GLuint list
)
7967 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
7977 /**********************************************************************/
7978 /* Display list execution */
7979 /**********************************************************************/
7983 * Execute a display list. Note that the ListBase offset must have already
7984 * been added before calling this function. I.e. the list argument is
7985 * the absolute list number, not relative to ListBase.
7986 * \param list - display list number
7989 execute_list(struct gl_context
*ctx
, GLuint list
)
7991 struct gl_display_list
*dlist
;
7995 if (list
== 0 || !islist(ctx
, list
))
7998 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7999 /* raise an error? */
8003 dlist
= _mesa_lookup_list(ctx
, list
);
8007 ctx
->ListState
.CallDepth
++;
8009 vbo_save_BeginCallList(ctx
, dlist
);
8015 const OpCode opcode
= n
[0].opcode
;
8017 if (is_ext_opcode(opcode
)) {
8018 n
+= ext_opcode_execute(ctx
, n
);
8023 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
8026 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8028 case OPCODE_ALPHA_FUNC
:
8029 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8031 case OPCODE_BIND_TEXTURE
:
8032 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8036 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8037 ctx
->Unpack
= ctx
->DefaultPacking
;
8038 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
8039 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
8040 get_pointer(&n
[7])));
8041 ctx
->Unpack
= save
; /* restore */
8044 case OPCODE_BLEND_COLOR
:
8045 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8047 case OPCODE_BLEND_EQUATION
:
8048 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
8050 case OPCODE_BLEND_EQUATION_SEPARATE
:
8051 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8053 case OPCODE_BLEND_FUNC_SEPARATE
:
8054 CALL_BlendFuncSeparate(ctx
->Exec
,
8055 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8058 case OPCODE_BLEND_FUNC_I
:
8059 /* GL_ARB_draw_buffers_blend */
8060 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
8062 case OPCODE_BLEND_FUNC_SEPARATE_I
:
8063 /* GL_ARB_draw_buffers_blend */
8064 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
8067 case OPCODE_BLEND_EQUATION_I
:
8068 /* GL_ARB_draw_buffers_blend */
8069 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8071 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
8072 /* GL_ARB_draw_buffers_blend */
8073 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
8074 (n
[1].ui
, n
[2].e
, n
[3].e
));
8077 case OPCODE_CALL_LIST
:
8078 /* Generated by glCallList(), don't add ListBase */
8079 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
8080 execute_list(ctx
, n
[1].ui
);
8083 case OPCODE_CALL_LISTS
:
8084 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
8085 CALL_CallLists(ctx
->Exec
, (n
[1].i
, n
[2].e
, get_pointer(&n
[3])));
8089 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
8091 case OPCODE_CLEAR_BUFFER_IV
:
8098 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8101 case OPCODE_CLEAR_BUFFER_UIV
:
8108 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8111 case OPCODE_CLEAR_BUFFER_FV
:
8118 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8121 case OPCODE_CLEAR_BUFFER_FI
:
8122 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
8124 case OPCODE_CLEAR_COLOR
:
8125 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8127 case OPCODE_CLEAR_ACCUM
:
8128 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8130 case OPCODE_CLEAR_DEPTH
:
8131 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
8133 case OPCODE_CLEAR_INDEX
:
8134 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
8136 case OPCODE_CLEAR_STENCIL
:
8137 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
8139 case OPCODE_CLIP_PLANE
:
8146 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
8149 case OPCODE_COLOR_MASK
:
8150 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
8152 case OPCODE_COLOR_MASK_INDEXED
:
8153 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
8156 case OPCODE_COLOR_MATERIAL
:
8157 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8159 case OPCODE_COPY_PIXELS
:
8160 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8161 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
8164 case OPCODE_COPY_TEX_IMAGE1D
:
8165 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
8166 n
[5].i
, n
[6].i
, n
[7].i
));
8168 case OPCODE_COPY_TEX_IMAGE2D
:
8169 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
8170 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
8172 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
8173 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8174 n
[4].i
, n
[5].i
, n
[6].i
));
8176 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
8177 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8178 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8181 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
8182 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8183 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8186 case OPCODE_CULL_FACE
:
8187 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
8189 case OPCODE_DEPTH_FUNC
:
8190 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
8192 case OPCODE_DEPTH_MASK
:
8193 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
8195 case OPCODE_DEPTH_RANGE
:
8196 CALL_DepthRange(ctx
->Exec
,
8197 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
8199 case OPCODE_DISABLE
:
8200 CALL_Disable(ctx
->Exec
, (n
[1].e
));
8202 case OPCODE_DISABLE_INDEXED
:
8203 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8205 case OPCODE_DRAW_BUFFER
:
8206 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
8208 case OPCODE_DRAW_PIXELS
:
8210 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8211 ctx
->Unpack
= ctx
->DefaultPacking
;
8212 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
8213 get_pointer(&n
[5])));
8214 ctx
->Unpack
= save
; /* restore */
8218 CALL_Enable(ctx
->Exec
, (n
[1].e
));
8220 case OPCODE_ENABLE_INDEXED
:
8221 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8223 case OPCODE_EVALMESH1
:
8224 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
8226 case OPCODE_EVALMESH2
:
8227 CALL_EvalMesh2(ctx
->Exec
,
8228 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8237 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
8240 case OPCODE_FRONT_FACE
:
8241 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
8243 case OPCODE_FRUSTUM
:
8244 CALL_Frustum(ctx
->Exec
,
8245 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8248 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8250 case OPCODE_INDEX_MASK
:
8251 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
8253 case OPCODE_INIT_NAMES
:
8254 CALL_InitNames(ctx
->Exec
, ());
8263 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
8266 case OPCODE_LIGHT_MODEL
:
8273 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
8276 case OPCODE_LINE_STIPPLE
:
8277 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
8279 case OPCODE_LINE_WIDTH
:
8280 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
8282 case OPCODE_LIST_BASE
:
8283 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
8285 case OPCODE_LOAD_IDENTITY
:
8286 CALL_LoadIdentity(ctx
->Exec
, ());
8288 case OPCODE_LOAD_MATRIX
:
8289 STATIC_ASSERT(sizeof(Node
) == sizeof(GLfloat
));
8290 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
8292 case OPCODE_LOAD_NAME
:
8293 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
8295 case OPCODE_LOGIC_OP
:
8296 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
8300 GLenum target
= n
[1].e
;
8301 GLint ustride
= _mesa_evaluator_components(target
);
8302 GLint uorder
= n
[5].i
;
8303 GLfloat u1
= n
[2].f
;
8304 GLfloat u2
= n
[3].f
;
8305 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8306 (GLfloat
*) get_pointer(&n
[6])));
8311 GLenum target
= n
[1].e
;
8312 GLfloat u1
= n
[2].f
;
8313 GLfloat u2
= n
[3].f
;
8314 GLfloat v1
= n
[4].f
;
8315 GLfloat v2
= n
[5].f
;
8316 GLint ustride
= n
[6].i
;
8317 GLint vstride
= n
[7].i
;
8318 GLint uorder
= n
[8].i
;
8319 GLint vorder
= n
[9].i
;
8320 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8321 v1
, v2
, vstride
, vorder
,
8322 (GLfloat
*) get_pointer(&n
[10])));
8325 case OPCODE_MAPGRID1
:
8326 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8328 case OPCODE_MAPGRID2
:
8329 CALL_MapGrid2f(ctx
->Exec
,
8330 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
8332 case OPCODE_MATRIX_MODE
:
8333 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
8335 case OPCODE_MULT_MATRIX
:
8336 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
8339 CALL_Ortho(ctx
->Exec
,
8340 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8342 case OPCODE_PASSTHROUGH
:
8343 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
8345 case OPCODE_PIXEL_MAP
:
8346 CALL_PixelMapfv(ctx
->Exec
,
8347 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
8349 case OPCODE_PIXEL_TRANSFER
:
8350 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8352 case OPCODE_PIXEL_ZOOM
:
8353 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8355 case OPCODE_POINT_SIZE
:
8356 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
8358 case OPCODE_POINT_PARAMETERS
:
8364 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8367 case OPCODE_POLYGON_MODE
:
8368 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8370 case OPCODE_POLYGON_STIPPLE
:
8372 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8373 ctx
->Unpack
= ctx
->DefaultPacking
;
8374 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
8375 ctx
->Unpack
= save
; /* restore */
8378 case OPCODE_POLYGON_OFFSET
:
8379 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8381 case OPCODE_POLYGON_OFFSET_CLAMP
:
8382 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8384 case OPCODE_POP_ATTRIB
:
8385 CALL_PopAttrib(ctx
->Exec
, ());
8387 case OPCODE_POP_MATRIX
:
8388 CALL_PopMatrix(ctx
->Exec
, ());
8390 case OPCODE_POP_NAME
:
8391 CALL_PopName(ctx
->Exec
, ());
8393 case OPCODE_PRIORITIZE_TEXTURE
:
8394 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
8396 case OPCODE_PUSH_ATTRIB
:
8397 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
8399 case OPCODE_PUSH_MATRIX
:
8400 CALL_PushMatrix(ctx
->Exec
, ());
8402 case OPCODE_PUSH_NAME
:
8403 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
8405 case OPCODE_RASTER_POS
:
8406 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8408 case OPCODE_READ_BUFFER
:
8409 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
8412 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8415 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8417 case OPCODE_SCISSOR
:
8418 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8420 case OPCODE_SHADE_MODEL
:
8421 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
8423 case OPCODE_PROVOKING_VERTEX
:
8424 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
8426 case OPCODE_STENCIL_FUNC
:
8427 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
8429 case OPCODE_STENCIL_MASK
:
8430 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
8432 case OPCODE_STENCIL_OP
:
8433 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
8435 case OPCODE_STENCIL_FUNC_SEPARATE
:
8436 CALL_StencilFuncSeparate(ctx
->Exec
,
8437 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
8439 case OPCODE_STENCIL_MASK_SEPARATE
:
8440 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8442 case OPCODE_STENCIL_OP_SEPARATE
:
8443 CALL_StencilOpSeparate(ctx
->Exec
,
8444 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8453 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8463 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8466 case OPCODE_TEXPARAMETER
:
8473 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8476 case OPCODE_TEX_IMAGE1D
:
8478 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8479 ctx
->Unpack
= ctx
->DefaultPacking
;
8480 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
8482 n
[3].i
, /* components */
8484 n
[5].e
, /* border */
8485 n
[6].e
, /* format */
8487 get_pointer(&n
[8])));
8488 ctx
->Unpack
= save
; /* restore */
8491 case OPCODE_TEX_IMAGE2D
:
8493 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8494 ctx
->Unpack
= ctx
->DefaultPacking
;
8495 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
8497 n
[3].i
, /* components */
8499 n
[5].i
, /* height */
8500 n
[6].e
, /* border */
8501 n
[7].e
, /* format */
8503 get_pointer(&n
[9])));
8504 ctx
->Unpack
= save
; /* restore */
8507 case OPCODE_TEX_IMAGE3D
:
8509 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8510 ctx
->Unpack
= ctx
->DefaultPacking
;
8511 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
8513 n
[3].i
, /* components */
8515 n
[5].i
, /* height */
8517 n
[7].e
, /* border */
8518 n
[8].e
, /* format */
8520 get_pointer(&n
[10])));
8521 ctx
->Unpack
= save
; /* restore */
8524 case OPCODE_TEX_SUB_IMAGE1D
:
8526 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8527 ctx
->Unpack
= ctx
->DefaultPacking
;
8528 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8530 n
[6].e
, get_pointer(&n
[7])));
8531 ctx
->Unpack
= save
; /* restore */
8534 case OPCODE_TEX_SUB_IMAGE2D
:
8536 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8537 ctx
->Unpack
= ctx
->DefaultPacking
;
8538 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8540 n
[6].i
, n
[7].e
, n
[8].e
,
8541 get_pointer(&n
[9])));
8542 ctx
->Unpack
= save
; /* restore */
8545 case OPCODE_TEX_SUB_IMAGE3D
:
8547 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8548 ctx
->Unpack
= ctx
->DefaultPacking
;
8549 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8550 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8551 n
[8].i
, n
[9].e
, n
[10].e
,
8552 get_pointer(&n
[11])));
8553 ctx
->Unpack
= save
; /* restore */
8556 case OPCODE_TRANSLATE
:
8557 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8559 case OPCODE_VIEWPORT
:
8560 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8561 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8563 case OPCODE_WINDOW_POS
:
8564 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8566 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8567 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8569 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8570 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8571 n
[4].i
, n
[5].i
, n
[6].i
,
8572 get_pointer(&n
[7])));
8574 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8575 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8576 n
[4].i
, n
[5].i
, n
[6].i
,
8577 n
[7].i
, get_pointer(&n
[8])));
8579 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8580 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8581 n
[4].i
, n
[5].i
, n
[6].i
,
8583 get_pointer(&n
[9])));
8585 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8586 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8587 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8589 get_pointer(&n
[7])));
8591 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8592 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8593 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8594 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8595 get_pointer(&n
[9])));
8597 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8598 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8599 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8600 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8602 get_pointer(&n
[11])));
8604 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8605 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8607 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8608 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8610 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
8611 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8613 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8614 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8615 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8618 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8619 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8621 case OPCODE_DEPTH_BOUNDS_EXT
:
8622 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8624 case OPCODE_PROGRAM_STRING_ARB
:
8625 CALL_ProgramStringARB(ctx
->Exec
,
8626 (n
[1].e
, n
[2].e
, n
[3].i
,
8627 get_pointer(&n
[4])));
8629 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8630 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8634 case OPCODE_BEGIN_QUERY_ARB
:
8635 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8637 case OPCODE_END_QUERY_ARB
:
8638 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8640 case OPCODE_QUERY_COUNTER
:
8641 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8643 case OPCODE_BEGIN_QUERY_INDEXED
:
8644 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8646 case OPCODE_END_QUERY_INDEXED
:
8647 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8649 case OPCODE_DRAW_BUFFERS_ARB
:
8651 GLenum buffers
[MAX_DRAW_BUFFERS
];
8652 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8653 for (i
= 0; i
< count
; i
++)
8654 buffers
[i
] = n
[2 + i
].e
;
8655 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8658 case OPCODE_BLIT_FRAMEBUFFER
:
8659 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8660 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8663 case OPCODE_USE_PROGRAM
:
8664 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8666 case OPCODE_UNIFORM_1F
:
8667 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8669 case OPCODE_UNIFORM_2F
:
8670 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8672 case OPCODE_UNIFORM_3F
:
8673 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8675 case OPCODE_UNIFORM_4F
:
8676 CALL_Uniform4f(ctx
->Exec
,
8677 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8679 case OPCODE_UNIFORM_1FV
:
8680 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8682 case OPCODE_UNIFORM_2FV
:
8683 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8685 case OPCODE_UNIFORM_3FV
:
8686 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8688 case OPCODE_UNIFORM_4FV
:
8689 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8691 case OPCODE_UNIFORM_1I
:
8692 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8694 case OPCODE_UNIFORM_2I
:
8695 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8697 case OPCODE_UNIFORM_3I
:
8698 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8700 case OPCODE_UNIFORM_4I
:
8701 CALL_Uniform4i(ctx
->Exec
,
8702 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8704 case OPCODE_UNIFORM_1IV
:
8705 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8707 case OPCODE_UNIFORM_2IV
:
8708 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8710 case OPCODE_UNIFORM_3IV
:
8711 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8713 case OPCODE_UNIFORM_4IV
:
8714 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8716 case OPCODE_UNIFORM_1UI
:
8717 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8719 case OPCODE_UNIFORM_2UI
:
8720 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8722 case OPCODE_UNIFORM_3UI
:
8723 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8725 case OPCODE_UNIFORM_4UI
:
8726 /*CALL_Uniform4uiARB(ctx->Exec,
8727 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8730 case OPCODE_UNIFORM_1UIV
:
8731 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
8732 get_pointer(&n[3])));*/
8734 case OPCODE_UNIFORM_2UIV
:
8735 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
8736 get_pointer(&n[3])));*/
8738 case OPCODE_UNIFORM_3UIV
:
8739 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
8740 get_pointer(&n[3])));*/
8742 case OPCODE_UNIFORM_4UIV
:
8743 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
8744 get_pointer(&n[3])));*/
8746 case OPCODE_UNIFORM_MATRIX22
:
8747 CALL_UniformMatrix2fv(ctx
->Exec
,
8748 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8750 case OPCODE_UNIFORM_MATRIX33
:
8751 CALL_UniformMatrix3fv(ctx
->Exec
,
8752 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8754 case OPCODE_UNIFORM_MATRIX44
:
8755 CALL_UniformMatrix4fv(ctx
->Exec
,
8756 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8758 case OPCODE_UNIFORM_MATRIX23
:
8759 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8760 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8762 case OPCODE_UNIFORM_MATRIX32
:
8763 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8764 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8766 case OPCODE_UNIFORM_MATRIX24
:
8767 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8768 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8770 case OPCODE_UNIFORM_MATRIX42
:
8771 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8772 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8774 case OPCODE_UNIFORM_MATRIX34
:
8775 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8776 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8778 case OPCODE_UNIFORM_MATRIX43
:
8779 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8780 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8783 case OPCODE_USE_PROGRAM_STAGES
:
8784 CALL_UseProgramStages(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8786 case OPCODE_PROGRAM_UNIFORM_1F
:
8787 CALL_ProgramUniform1f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
));
8789 case OPCODE_PROGRAM_UNIFORM_2F
:
8790 CALL_ProgramUniform2f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
, n
[4].f
));
8792 case OPCODE_PROGRAM_UNIFORM_3F
:
8793 CALL_ProgramUniform3f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8794 n
[3].f
, n
[4].f
, n
[5].f
));
8796 case OPCODE_PROGRAM_UNIFORM_4F
:
8797 CALL_ProgramUniform4f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8798 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8800 case OPCODE_PROGRAM_UNIFORM_1FV
:
8801 CALL_ProgramUniform1fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8802 get_pointer(&n
[4])));
8804 case OPCODE_PROGRAM_UNIFORM_2FV
:
8805 CALL_ProgramUniform2fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8806 get_pointer(&n
[4])));
8808 case OPCODE_PROGRAM_UNIFORM_3FV
:
8809 CALL_ProgramUniform3fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8810 get_pointer(&n
[4])));
8812 case OPCODE_PROGRAM_UNIFORM_4FV
:
8813 CALL_ProgramUniform4fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8814 get_pointer(&n
[4])));
8816 case OPCODE_PROGRAM_UNIFORM_1I
:
8817 CALL_ProgramUniform1i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
));
8819 case OPCODE_PROGRAM_UNIFORM_2I
:
8820 CALL_ProgramUniform2i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].i
));
8822 case OPCODE_PROGRAM_UNIFORM_3I
:
8823 CALL_ProgramUniform3i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8824 n
[3].i
, n
[4].i
, n
[5].i
));
8826 case OPCODE_PROGRAM_UNIFORM_4I
:
8827 CALL_ProgramUniform4i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8828 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
));
8830 case OPCODE_PROGRAM_UNIFORM_1IV
:
8831 CALL_ProgramUniform1iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8832 get_pointer(&n
[4])));
8834 case OPCODE_PROGRAM_UNIFORM_2IV
:
8835 CALL_ProgramUniform2iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8836 get_pointer(&n
[4])));
8838 case OPCODE_PROGRAM_UNIFORM_3IV
:
8839 CALL_ProgramUniform3iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8840 get_pointer(&n
[4])));
8842 case OPCODE_PROGRAM_UNIFORM_4IV
:
8843 CALL_ProgramUniform4iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8844 get_pointer(&n
[4])));
8846 case OPCODE_PROGRAM_UNIFORM_1UI
:
8847 CALL_ProgramUniform1ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].ui
));
8849 case OPCODE_PROGRAM_UNIFORM_2UI
:
8850 CALL_ProgramUniform2ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8853 case OPCODE_PROGRAM_UNIFORM_3UI
:
8854 CALL_ProgramUniform3ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8855 n
[3].ui
, n
[4].ui
, n
[5].ui
));
8857 case OPCODE_PROGRAM_UNIFORM_4UI
:
8858 CALL_ProgramUniform4ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8860 n
[4].ui
, n
[5].ui
, n
[6].ui
));
8862 case OPCODE_PROGRAM_UNIFORM_1UIV
:
8863 CALL_ProgramUniform1uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8864 get_pointer(&n
[4])));
8866 case OPCODE_PROGRAM_UNIFORM_2UIV
:
8867 CALL_ProgramUniform2uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8868 get_pointer(&n
[4])));
8870 case OPCODE_PROGRAM_UNIFORM_3UIV
:
8871 CALL_ProgramUniform3uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8872 get_pointer(&n
[4])));
8874 case OPCODE_PROGRAM_UNIFORM_4UIV
:
8875 CALL_ProgramUniform4uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8876 get_pointer(&n
[4])));
8878 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
8879 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
8880 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8881 get_pointer(&n
[5])));
8883 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
8884 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
8885 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8886 get_pointer(&n
[5])));
8888 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
8889 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
8890 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8891 get_pointer(&n
[5])));
8893 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
8894 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
8895 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8896 get_pointer(&n
[5])));
8898 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
8899 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
8900 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8901 get_pointer(&n
[5])));
8903 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
8904 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
8905 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8906 get_pointer(&n
[5])));
8908 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
8909 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
8910 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8911 get_pointer(&n
[5])));
8913 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
8914 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
8915 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8916 get_pointer(&n
[5])));
8918 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
8919 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
8920 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8921 get_pointer(&n
[5])));
8924 case OPCODE_CLIP_CONTROL
:
8925 CALL_ClipControl(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8928 case OPCODE_CLAMP_COLOR
:
8929 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8932 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8933 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8935 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8936 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (n
[1].ui
, &n
[2].f
));
8938 case OPCODE_ATTR_1F_NV
:
8939 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8941 case OPCODE_ATTR_2F_NV
:
8942 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8944 case OPCODE_ATTR_3F_NV
:
8945 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8947 case OPCODE_ATTR_4F_NV
:
8948 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8950 case OPCODE_ATTR_1F_ARB
:
8951 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8953 case OPCODE_ATTR_2F_ARB
:
8954 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8956 case OPCODE_ATTR_3F_ARB
:
8957 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8959 case OPCODE_ATTR_4F_ARB
:
8960 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8962 case OPCODE_MATERIAL
:
8963 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8966 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8969 CALL_End(ctx
->Exec
, ());
8972 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8974 case OPCODE_EVAL_C1
:
8975 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8977 case OPCODE_EVAL_C2
:
8978 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8980 case OPCODE_EVAL_P1
:
8981 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8983 case OPCODE_EVAL_P2
:
8984 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8987 /* GL_EXT_texture_integer */
8988 case OPCODE_CLEARCOLOR_I
:
8989 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8991 case OPCODE_CLEARCOLOR_UI
:
8992 CALL_ClearColorIuiEXT(ctx
->Exec
,
8993 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
8995 case OPCODE_TEXPARAMETER_I
:
9002 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
9005 case OPCODE_TEXPARAMETER_UI
:
9008 params
[0] = n
[3].ui
;
9009 params
[1] = n
[4].ui
;
9010 params
[2] = n
[5].ui
;
9011 params
[3] = n
[6].ui
;
9012 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
9016 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
9017 /* GL_ARB_instanced_arrays */
9018 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
9021 case OPCODE_TEXTURE_BARRIER_NV
:
9022 CALL_TextureBarrierNV(ctx
->Exec
, ());
9025 /* GL_EXT/ARB_transform_feedback */
9026 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
9027 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
9029 case OPCODE_END_TRANSFORM_FEEDBACK
:
9030 CALL_EndTransformFeedback(ctx
->Exec
, ());
9032 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
9033 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
9035 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
9036 CALL_PauseTransformFeedback(ctx
->Exec
, ());
9038 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
9039 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
9041 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
9042 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
9044 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
9045 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
9046 (n
[1].e
, n
[2].ui
, n
[3].ui
));
9048 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
9049 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
9050 (n
[1].e
, n
[2].ui
, n
[3].si
));
9052 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
9053 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
9054 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
9058 case OPCODE_BIND_SAMPLER
:
9059 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
9061 case OPCODE_SAMPLER_PARAMETERIV
:
9068 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9071 case OPCODE_SAMPLER_PARAMETERFV
:
9078 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9081 case OPCODE_SAMPLER_PARAMETERIIV
:
9088 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9091 case OPCODE_SAMPLER_PARAMETERUIV
:
9094 params
[0] = n
[3].ui
;
9095 params
[1] = n
[4].ui
;
9096 params
[2] = n
[5].ui
;
9097 params
[3] = n
[6].ui
;
9098 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9103 case OPCODE_WAIT_SYNC
:
9105 union uint64_pair p
;
9106 p
.uint32
[0] = n
[2].ui
;
9107 p
.uint32
[1] = n
[3].ui
;
9108 CALL_WaitSync(ctx
->Exec
,
9109 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
9113 /* GL_NV_conditional_render */
9114 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
9115 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
9117 case OPCODE_END_CONDITIONAL_RENDER
:
9118 CALL_EndConditionalRender(ctx
->Exec
, ());
9121 case OPCODE_UNIFORM_BLOCK_BINDING
:
9122 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
9125 case OPCODE_CONTINUE
:
9126 n
= (Node
*) get_pointer(&n
[1]);
9131 case OPCODE_END_OF_LIST
:
9137 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
9139 _mesa_problem(ctx
, "%s", msg
);
9144 /* increment n to point to next compiled command */
9145 if (opcode
!= OPCODE_CONTINUE
) {
9146 n
+= InstSize
[opcode
];
9151 vbo_save_EndCallList(ctx
);
9153 ctx
->ListState
.CallDepth
--;
9158 /**********************************************************************/
9160 /**********************************************************************/
9163 * Test if a display list number is valid.
9165 GLboolean GLAPIENTRY
9166 _mesa_IsList(GLuint list
)
9168 GET_CURRENT_CONTEXT(ctx
);
9169 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9170 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
9171 return islist(ctx
, list
);
9176 * Delete a sequence of consecutive display lists.
9179 _mesa_DeleteLists(GLuint list
, GLsizei range
)
9181 GET_CURRENT_CONTEXT(ctx
);
9183 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9184 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9187 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
9192 /* We may be deleting a set of bitmap lists. See if there's a
9193 * bitmap atlas to free.
9195 struct gl_bitmap_atlas
*atlas
= lookup_bitmap_atlas(ctx
, list
);
9197 _mesa_delete_bitmap_atlas(ctx
, atlas
);
9198 _mesa_HashRemove(ctx
->Shared
->BitmapAtlas
, list
);
9202 for (i
= list
; i
< list
+ range
; i
++) {
9203 destroy_list(ctx
, i
);
9209 * Return a display list number, n, such that lists n through n+range-1
9213 _mesa_GenLists(GLsizei range
)
9215 GET_CURRENT_CONTEXT(ctx
);
9217 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9218 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
9221 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
9229 * Make this an atomic operation
9231 mtx_lock(&ctx
->Shared
->Mutex
);
9233 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
9235 /* reserve the list IDs by with empty/dummy lists */
9237 for (i
= 0; i
< range
; i
++) {
9238 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
9239 make_list(base
+ i
, 1));
9243 if (USE_BITMAP_ATLAS
&&
9245 ctx
->Driver
.DrawAtlasBitmaps
) {
9246 /* "range > 16" is a rough heuristic to guess when glGenLists might be
9247 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
9248 * Create the empty atlas now.
9250 struct gl_bitmap_atlas
*atlas
= lookup_bitmap_atlas(ctx
, base
);
9252 atlas
= alloc_bitmap_atlas(ctx
, base
);
9255 /* Atlas _should_ be new/empty now, but clobbering is OK */
9256 assert(atlas
->numBitmaps
== 0);
9257 atlas
->numBitmaps
= range
;
9261 mtx_unlock(&ctx
->Shared
->Mutex
);
9268 * Begin a new display list.
9271 _mesa_NewList(GLuint name
, GLenum mode
)
9273 GET_CURRENT_CONTEXT(ctx
);
9275 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
9276 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9278 if (MESA_VERBOSE
& VERBOSE_API
)
9279 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
9280 _mesa_enum_to_string(mode
));
9283 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
9287 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
9288 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
9292 if (ctx
->ListState
.CurrentList
) {
9293 /* already compiling a display list */
9294 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
9298 ctx
->CompileFlag
= GL_TRUE
;
9299 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
9301 /* Reset accumulated list state */
9302 invalidate_saved_current_state( ctx
);
9304 /* Allocate new display list */
9305 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
9306 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
9307 ctx
->ListState
.CurrentPos
= 0;
9309 vbo_save_NewList(ctx
, name
, mode
);
9311 ctx
->CurrentDispatch
= ctx
->Save
;
9312 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9317 * End definition of current display list.
9322 GET_CURRENT_CONTEXT(ctx
);
9323 SAVE_FLUSH_VERTICES(ctx
);
9324 FLUSH_VERTICES(ctx
, 0);
9326 if (MESA_VERBOSE
& VERBOSE_API
)
9327 _mesa_debug(ctx
, "glEndList\n");
9329 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
9330 _mesa_error(ctx
, GL_INVALID_OPERATION
,
9331 "glEndList() called inside glBegin/End");
9334 /* Check that a list is under construction */
9335 if (!ctx
->ListState
.CurrentList
) {
9336 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
9340 /* Call before emitting END_OF_LIST, in case the driver wants to
9341 * emit opcodes itself.
9343 vbo_save_EndList(ctx
);
9345 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
9349 /* Destroy old list, if any */
9350 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
9352 /* Install the new list */
9353 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
9354 ctx
->ListState
.CurrentList
->Name
,
9355 ctx
->ListState
.CurrentList
);
9358 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
9359 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
9361 ctx
->ListState
.CurrentList
= NULL
;
9362 ctx
->ListState
.CurrentBlock
= NULL
;
9363 ctx
->ListState
.CurrentPos
= 0;
9364 ctx
->ExecuteFlag
= GL_TRUE
;
9365 ctx
->CompileFlag
= GL_FALSE
;
9367 ctx
->CurrentDispatch
= ctx
->Exec
;
9368 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9373 _mesa_CallList(GLuint list
)
9375 GLboolean save_compile_flag
;
9376 GET_CURRENT_CONTEXT(ctx
);
9377 FLUSH_CURRENT(ctx
, 0);
9379 if (MESA_VERBOSE
& VERBOSE_API
)
9380 _mesa_debug(ctx
, "glCallList %d\n", list
);
9383 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
9388 mesa_print_display_list( list
);
9390 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9391 * execute the display list, and restore the CompileFlag.
9393 save_compile_flag
= ctx
->CompileFlag
;
9394 if (save_compile_flag
) {
9395 ctx
->CompileFlag
= GL_FALSE
;
9398 execute_list(ctx
, list
);
9399 ctx
->CompileFlag
= save_compile_flag
;
9401 /* also restore API function pointers to point to "save" versions */
9402 if (save_compile_flag
) {
9403 ctx
->CurrentDispatch
= ctx
->Save
;
9404 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9410 * Try to execute a glCallLists() command where the display lists contain
9411 * glBitmap commands with a texture atlas.
9412 * \return true for success, false otherwise
9415 render_bitmap_atlas(struct gl_context
*ctx
, GLsizei n
, GLenum type
,
9418 struct gl_bitmap_atlas
*atlas
;
9421 if (!USE_BITMAP_ATLAS
||
9422 !ctx
->Current
.RasterPosValid
||
9423 ctx
->List
.ListBase
== 0 ||
9424 type
!= GL_UNSIGNED_BYTE
||
9425 !ctx
->Driver
.DrawAtlasBitmaps
) {
9430 atlas
= lookup_bitmap_atlas(ctx
, ctx
->List
.ListBase
);
9433 /* Even if glGenLists wasn't called, we can still try to create
9436 atlas
= alloc_bitmap_atlas(ctx
, ctx
->List
.ListBase
);
9439 if (atlas
&& !atlas
->complete
&& !atlas
->incomplete
) {
9440 /* Try to build the bitmap atlas now.
9441 * If the atlas was created in glGenLists, we'll have recorded the
9442 * number of lists (bitmaps). Otherwise, take a guess at 256.
9444 if (atlas
->numBitmaps
== 0)
9445 atlas
->numBitmaps
= 256;
9446 build_bitmap_atlas(ctx
, atlas
, ctx
->List
.ListBase
);
9449 if (!atlas
|| !atlas
->complete
) {
9453 /* check that all display list IDs are in the atlas */
9454 for (i
= 0; i
< n
; i
++) {
9455 const GLubyte
*ids
= (const GLubyte
*) lists
;
9457 if (ids
[i
] >= atlas
->numBitmaps
) {
9462 ctx
->Driver
.DrawAtlasBitmaps(ctx
, atlas
, n
, (const GLubyte
*) lists
);
9469 * Execute glCallLists: call multiple display lists.
9472 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
9474 GET_CURRENT_CONTEXT(ctx
);
9476 GLboolean save_compile_flag
;
9478 if (MESA_VERBOSE
& VERBOSE_API
)
9479 _mesa_debug(ctx
, "glCallLists %d\n", n
);
9483 case GL_UNSIGNED_BYTE
:
9485 case GL_UNSIGNED_SHORT
:
9487 case GL_UNSIGNED_INT
:
9495 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
9500 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallLists(n < 0)");
9502 } else if (n
== 0 || lists
== NULL
) {
9507 if (render_bitmap_atlas(ctx
, n
, type
, lists
)) {
9511 /* Save the CompileFlag status, turn it off, execute display list,
9512 * and restore the CompileFlag.
9514 save_compile_flag
= ctx
->CompileFlag
;
9515 ctx
->CompileFlag
= GL_FALSE
;
9517 for (i
= 0; i
< n
; i
++) {
9518 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
9519 execute_list(ctx
, list
);
9522 ctx
->CompileFlag
= save_compile_flag
;
9524 /* also restore API function pointers to point to "save" versions */
9525 if (save_compile_flag
) {
9526 ctx
->CurrentDispatch
= ctx
->Save
;
9527 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9533 * Set the offset added to list numbers in glCallLists.
9536 _mesa_ListBase(GLuint base
)
9538 GET_CURRENT_CONTEXT(ctx
);
9539 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9540 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9541 ctx
->List
.ListBase
= base
;
9545 * Setup the given dispatch table to point to Mesa's display list
9546 * building functions.
9548 * This does not include any of the tnl functions - they are
9549 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9553 _mesa_initialize_save_table(const struct gl_context
*ctx
)
9555 struct _glapi_table
*table
= ctx
->Save
;
9556 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
9558 /* Initially populate the dispatch table with the contents of the
9559 * normal-execution dispatch table. This lets us skip populating functions
9560 * that should be called directly instead of compiled into display lists.
9562 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
9564 _mesa_loopback_init_api_table(ctx
, table
);
9567 vbo_initialize_save_dispatch(ctx
, table
);
9570 SET_Accum(table
, save_Accum
);
9571 SET_AlphaFunc(table
, save_AlphaFunc
);
9572 SET_Bitmap(table
, save_Bitmap
);
9573 SET_BlendFunc(table
, save_BlendFunc
);
9574 SET_CallList(table
, save_CallList
);
9575 SET_CallLists(table
, save_CallLists
);
9576 SET_Clear(table
, save_Clear
);
9577 SET_ClearAccum(table
, save_ClearAccum
);
9578 SET_ClearColor(table
, save_ClearColor
);
9579 SET_ClearDepth(table
, save_ClearDepth
);
9580 SET_ClearIndex(table
, save_ClearIndex
);
9581 SET_ClearStencil(table
, save_ClearStencil
);
9582 SET_ClipPlane(table
, save_ClipPlane
);
9583 SET_ColorMask(table
, save_ColorMask
);
9584 SET_ColorMaski(table
, save_ColorMaskIndexed
);
9585 SET_ColorMaterial(table
, save_ColorMaterial
);
9586 SET_CopyPixels(table
, save_CopyPixels
);
9587 SET_CullFace(table
, save_CullFace
);
9588 SET_DepthFunc(table
, save_DepthFunc
);
9589 SET_DepthMask(table
, save_DepthMask
);
9590 SET_DepthRange(table
, save_DepthRange
);
9591 SET_Disable(table
, save_Disable
);
9592 SET_Disablei(table
, save_DisableIndexed
);
9593 SET_DrawBuffer(table
, save_DrawBuffer
);
9594 SET_DrawPixels(table
, save_DrawPixels
);
9595 SET_Enable(table
, save_Enable
);
9596 SET_Enablei(table
, save_EnableIndexed
);
9597 SET_EvalMesh1(table
, save_EvalMesh1
);
9598 SET_EvalMesh2(table
, save_EvalMesh2
);
9599 SET_Fogf(table
, save_Fogf
);
9600 SET_Fogfv(table
, save_Fogfv
);
9601 SET_Fogi(table
, save_Fogi
);
9602 SET_Fogiv(table
, save_Fogiv
);
9603 SET_FrontFace(table
, save_FrontFace
);
9604 SET_Frustum(table
, save_Frustum
);
9605 SET_Hint(table
, save_Hint
);
9606 SET_IndexMask(table
, save_IndexMask
);
9607 SET_InitNames(table
, save_InitNames
);
9608 SET_LightModelf(table
, save_LightModelf
);
9609 SET_LightModelfv(table
, save_LightModelfv
);
9610 SET_LightModeli(table
, save_LightModeli
);
9611 SET_LightModeliv(table
, save_LightModeliv
);
9612 SET_Lightf(table
, save_Lightf
);
9613 SET_Lightfv(table
, save_Lightfv
);
9614 SET_Lighti(table
, save_Lighti
);
9615 SET_Lightiv(table
, save_Lightiv
);
9616 SET_LineStipple(table
, save_LineStipple
);
9617 SET_LineWidth(table
, save_LineWidth
);
9618 SET_ListBase(table
, save_ListBase
);
9619 SET_LoadIdentity(table
, save_LoadIdentity
);
9620 SET_LoadMatrixd(table
, save_LoadMatrixd
);
9621 SET_LoadMatrixf(table
, save_LoadMatrixf
);
9622 SET_LoadName(table
, save_LoadName
);
9623 SET_LogicOp(table
, save_LogicOp
);
9624 SET_Map1d(table
, save_Map1d
);
9625 SET_Map1f(table
, save_Map1f
);
9626 SET_Map2d(table
, save_Map2d
);
9627 SET_Map2f(table
, save_Map2f
);
9628 SET_MapGrid1d(table
, save_MapGrid1d
);
9629 SET_MapGrid1f(table
, save_MapGrid1f
);
9630 SET_MapGrid2d(table
, save_MapGrid2d
);
9631 SET_MapGrid2f(table
, save_MapGrid2f
);
9632 SET_MatrixMode(table
, save_MatrixMode
);
9633 SET_MultMatrixd(table
, save_MultMatrixd
);
9634 SET_MultMatrixf(table
, save_MultMatrixf
);
9635 SET_NewList(table
, save_NewList
);
9636 SET_Ortho(table
, save_Ortho
);
9637 SET_PassThrough(table
, save_PassThrough
);
9638 SET_PixelMapfv(table
, save_PixelMapfv
);
9639 SET_PixelMapuiv(table
, save_PixelMapuiv
);
9640 SET_PixelMapusv(table
, save_PixelMapusv
);
9641 SET_PixelTransferf(table
, save_PixelTransferf
);
9642 SET_PixelTransferi(table
, save_PixelTransferi
);
9643 SET_PixelZoom(table
, save_PixelZoom
);
9644 SET_PointSize(table
, save_PointSize
);
9645 SET_PolygonMode(table
, save_PolygonMode
);
9646 SET_PolygonOffset(table
, save_PolygonOffset
);
9647 SET_PolygonStipple(table
, save_PolygonStipple
);
9648 SET_PopAttrib(table
, save_PopAttrib
);
9649 SET_PopMatrix(table
, save_PopMatrix
);
9650 SET_PopName(table
, save_PopName
);
9651 SET_PushAttrib(table
, save_PushAttrib
);
9652 SET_PushMatrix(table
, save_PushMatrix
);
9653 SET_PushName(table
, save_PushName
);
9654 SET_RasterPos2d(table
, save_RasterPos2d
);
9655 SET_RasterPos2dv(table
, save_RasterPos2dv
);
9656 SET_RasterPos2f(table
, save_RasterPos2f
);
9657 SET_RasterPos2fv(table
, save_RasterPos2fv
);
9658 SET_RasterPos2i(table
, save_RasterPos2i
);
9659 SET_RasterPos2iv(table
, save_RasterPos2iv
);
9660 SET_RasterPos2s(table
, save_RasterPos2s
);
9661 SET_RasterPos2sv(table
, save_RasterPos2sv
);
9662 SET_RasterPos3d(table
, save_RasterPos3d
);
9663 SET_RasterPos3dv(table
, save_RasterPos3dv
);
9664 SET_RasterPos3f(table
, save_RasterPos3f
);
9665 SET_RasterPos3fv(table
, save_RasterPos3fv
);
9666 SET_RasterPos3i(table
, save_RasterPos3i
);
9667 SET_RasterPos3iv(table
, save_RasterPos3iv
);
9668 SET_RasterPos3s(table
, save_RasterPos3s
);
9669 SET_RasterPos3sv(table
, save_RasterPos3sv
);
9670 SET_RasterPos4d(table
, save_RasterPos4d
);
9671 SET_RasterPos4dv(table
, save_RasterPos4dv
);
9672 SET_RasterPos4f(table
, save_RasterPos4f
);
9673 SET_RasterPos4fv(table
, save_RasterPos4fv
);
9674 SET_RasterPos4i(table
, save_RasterPos4i
);
9675 SET_RasterPos4iv(table
, save_RasterPos4iv
);
9676 SET_RasterPos4s(table
, save_RasterPos4s
);
9677 SET_RasterPos4sv(table
, save_RasterPos4sv
);
9678 SET_ReadBuffer(table
, save_ReadBuffer
);
9679 SET_Rectf(table
, save_Rectf
);
9680 SET_Rotated(table
, save_Rotated
);
9681 SET_Rotatef(table
, save_Rotatef
);
9682 SET_Scaled(table
, save_Scaled
);
9683 SET_Scalef(table
, save_Scalef
);
9684 SET_Scissor(table
, save_Scissor
);
9685 SET_ShadeModel(table
, save_ShadeModel
);
9686 SET_StencilFunc(table
, save_StencilFunc
);
9687 SET_StencilMask(table
, save_StencilMask
);
9688 SET_StencilOp(table
, save_StencilOp
);
9689 SET_TexEnvf(table
, save_TexEnvf
);
9690 SET_TexEnvfv(table
, save_TexEnvfv
);
9691 SET_TexEnvi(table
, save_TexEnvi
);
9692 SET_TexEnviv(table
, save_TexEnviv
);
9693 SET_TexGend(table
, save_TexGend
);
9694 SET_TexGendv(table
, save_TexGendv
);
9695 SET_TexGenf(table
, save_TexGenf
);
9696 SET_TexGenfv(table
, save_TexGenfv
);
9697 SET_TexGeni(table
, save_TexGeni
);
9698 SET_TexGeniv(table
, save_TexGeniv
);
9699 SET_TexImage1D(table
, save_TexImage1D
);
9700 SET_TexImage2D(table
, save_TexImage2D
);
9701 SET_TexParameterf(table
, save_TexParameterf
);
9702 SET_TexParameterfv(table
, save_TexParameterfv
);
9703 SET_TexParameteri(table
, save_TexParameteri
);
9704 SET_TexParameteriv(table
, save_TexParameteriv
);
9705 SET_Translated(table
, save_Translated
);
9706 SET_Translatef(table
, save_Translatef
);
9707 SET_Viewport(table
, save_Viewport
);
9710 SET_BindTexture(table
, save_BindTexture
);
9711 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
9712 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
9713 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
9714 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
9715 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
9716 SET_TexSubImage1D(table
, save_TexSubImage1D
);
9717 SET_TexSubImage2D(table
, save_TexSubImage2D
);
9720 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
9721 SET_TexImage3D(table
, save_TexImage3D
);
9722 SET_TexSubImage3D(table
, save_TexSubImage3D
);
9725 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
9726 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
9727 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
9729 /* ATI_separate_stencil */
9730 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
9732 /* GL_ARB_imaging */
9733 /* Not all are supported */
9734 SET_BlendColor(table
, save_BlendColor
);
9735 SET_BlendEquation(table
, save_BlendEquation
);
9737 /* 2. GL_EXT_blend_color */
9739 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9742 /* 3. GL_EXT_polygon_offset */
9743 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9745 /* 6. GL_EXT_texture3d */
9747 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9748 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9749 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9752 /* 37. GL_EXT_blend_minmax */
9754 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9757 /* 54. GL_EXT_point_parameters */
9758 SET_PointParameterf(table
, save_PointParameterfEXT
);
9759 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9761 /* 173. GL_EXT_blend_func_separate */
9762 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9764 /* 197. GL_MESA_window_pos */
9765 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9766 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9767 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9768 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9769 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9770 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9771 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9772 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9773 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9774 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9775 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9776 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9777 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9778 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9779 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9780 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9781 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9782 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9783 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9784 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9785 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9786 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9787 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9788 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9790 /* 233. GL_NV_vertex_program */
9791 /* The following commands DO NOT go into display lists:
9792 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9793 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9795 SET_BindProgramARB(table
, save_BindProgramNV
);
9797 /* 245. GL_ATI_fragment_shader */
9798 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9799 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9801 /* 262. GL_NV_point_sprite */
9802 SET_PointParameteri(table
, save_PointParameteriNV
);
9803 SET_PointParameteriv(table
, save_PointParameterivNV
);
9805 /* 268. GL_EXT_stencil_two_side */
9806 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9808 /* ???. GL_EXT_depth_bounds_test */
9809 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9811 /* ARB 1. GL_ARB_multitexture */
9812 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9814 /* ARB 3. GL_ARB_transpose_matrix */
9815 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9816 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9817 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9818 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9820 /* ARB 5. GL_ARB_multisample */
9821 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9823 /* ARB 12. GL_ARB_texture_compression */
9824 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9825 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9826 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9827 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9828 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9829 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9831 /* ARB 14. GL_ARB_point_parameters */
9832 /* aliased with EXT_point_parameters functions */
9834 /* ARB 25. GL_ARB_window_pos */
9835 /* aliased with MESA_window_pos functions */
9837 /* ARB 26. GL_ARB_vertex_program */
9838 /* ARB 27. GL_ARB_fragment_program */
9839 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9840 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9841 SET_BindProgramARB(table
, save_BindProgramNV
);
9842 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9843 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9844 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9845 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9846 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9847 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9848 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9849 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9851 SET_BeginQuery(table
, save_BeginQueryARB
);
9852 SET_EndQuery(table
, save_EndQueryARB
);
9853 SET_QueryCounter(table
, save_QueryCounter
);
9855 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9857 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9859 SET_UseProgram(table
, save_UseProgram
);
9860 SET_Uniform1f(table
, save_Uniform1fARB
);
9861 SET_Uniform2f(table
, save_Uniform2fARB
);
9862 SET_Uniform3f(table
, save_Uniform3fARB
);
9863 SET_Uniform4f(table
, save_Uniform4fARB
);
9864 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9865 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9866 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9867 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9868 SET_Uniform1i(table
, save_Uniform1iARB
);
9869 SET_Uniform2i(table
, save_Uniform2iARB
);
9870 SET_Uniform3i(table
, save_Uniform3iARB
);
9871 SET_Uniform4i(table
, save_Uniform4iARB
);
9872 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9873 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9874 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9875 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9876 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9877 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9878 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9879 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9880 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9881 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9882 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9883 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9884 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9886 /* 299. GL_EXT_blend_equation_separate */
9887 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9889 /* GL_EXT_gpu_program_parameters */
9890 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9891 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9893 /* 364. GL_EXT_provoking_vertex */
9894 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9896 /* GL_EXT_texture_integer */
9897 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9898 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9899 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9900 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9902 /* GL_ARB_clip_control */
9903 SET_ClipControl(table
, save_ClipControl
);
9905 /* GL_ARB_color_buffer_float */
9906 SET_ClampColor(table
, save_ClampColorARB
);
9909 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9910 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9911 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9912 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9914 SET_Uniform1ui(table
, save_Uniform1ui
);
9915 SET_Uniform2ui(table
, save_Uniform2ui
);
9916 SET_Uniform3ui(table
, save_Uniform3ui
);
9917 SET_Uniform4ui(table
, save_Uniform4ui
);
9918 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9919 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9920 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9921 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9923 (void) save_Uniform1ui
;
9924 (void) save_Uniform2ui
;
9925 (void) save_Uniform3ui
;
9926 (void) save_Uniform4ui
;
9927 (void) save_Uniform1uiv
;
9928 (void) save_Uniform2uiv
;
9929 (void) save_Uniform3uiv
;
9930 (void) save_Uniform4uiv
;
9934 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9935 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9936 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9937 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9938 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9939 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9940 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9941 SET_DrawTransformFeedbackInstanced(table
,
9942 save_DrawTransformFeedbackInstanced
);
9943 SET_DrawTransformFeedbackStreamInstanced(table
,
9944 save_DrawTransformFeedbackStreamInstanced
);
9945 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9946 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9948 /* GL_ARB_instanced_arrays */
9949 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9951 /* GL_NV_texture_barrier */
9952 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9954 SET_BindSampler(table
, save_BindSampler
);
9955 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9956 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9957 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9958 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9959 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9960 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9962 /* GL_ARB_draw_buffer_blend */
9963 SET_BlendFunciARB(table
, save_BlendFunci
);
9964 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9965 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9966 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9968 /* GL_NV_conditional_render */
9969 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9970 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9973 SET_WaitSync(table
, save_WaitSync
);
9975 /* GL_ARB_uniform_buffer_object */
9976 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9978 /* GL_ARB_draw_instanced */
9979 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
9980 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
9982 /* GL_ARB_draw_elements_base_vertex */
9983 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
9985 /* GL_ARB_base_instance */
9986 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
9987 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
9988 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
9990 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
9991 SET_UseProgramStages(table
, save_UseProgramStages
);
9992 SET_ProgramUniform1f(table
, save_ProgramUniform1f
);
9993 SET_ProgramUniform2f(table
, save_ProgramUniform2f
);
9994 SET_ProgramUniform3f(table
, save_ProgramUniform3f
);
9995 SET_ProgramUniform4f(table
, save_ProgramUniform4f
);
9996 SET_ProgramUniform1fv(table
, save_ProgramUniform1fv
);
9997 SET_ProgramUniform2fv(table
, save_ProgramUniform2fv
);
9998 SET_ProgramUniform3fv(table
, save_ProgramUniform3fv
);
9999 SET_ProgramUniform4fv(table
, save_ProgramUniform4fv
);
10000 SET_ProgramUniform1i(table
, save_ProgramUniform1i
);
10001 SET_ProgramUniform2i(table
, save_ProgramUniform2i
);
10002 SET_ProgramUniform3i(table
, save_ProgramUniform3i
);
10003 SET_ProgramUniform4i(table
, save_ProgramUniform4i
);
10004 SET_ProgramUniform1iv(table
, save_ProgramUniform1iv
);
10005 SET_ProgramUniform2iv(table
, save_ProgramUniform2iv
);
10006 SET_ProgramUniform3iv(table
, save_ProgramUniform3iv
);
10007 SET_ProgramUniform4iv(table
, save_ProgramUniform4iv
);
10008 SET_ProgramUniform1ui(table
, save_ProgramUniform1ui
);
10009 SET_ProgramUniform2ui(table
, save_ProgramUniform2ui
);
10010 SET_ProgramUniform3ui(table
, save_ProgramUniform3ui
);
10011 SET_ProgramUniform4ui(table
, save_ProgramUniform4ui
);
10012 SET_ProgramUniform1uiv(table
, save_ProgramUniform1uiv
);
10013 SET_ProgramUniform2uiv(table
, save_ProgramUniform2uiv
);
10014 SET_ProgramUniform3uiv(table
, save_ProgramUniform3uiv
);
10015 SET_ProgramUniform4uiv(table
, save_ProgramUniform4uiv
);
10016 SET_ProgramUniformMatrix2fv(table
, save_ProgramUniformMatrix2fv
);
10017 SET_ProgramUniformMatrix3fv(table
, save_ProgramUniformMatrix3fv
);
10018 SET_ProgramUniformMatrix4fv(table
, save_ProgramUniformMatrix4fv
);
10019 SET_ProgramUniformMatrix2x3fv(table
, save_ProgramUniformMatrix2x3fv
);
10020 SET_ProgramUniformMatrix3x2fv(table
, save_ProgramUniformMatrix3x2fv
);
10021 SET_ProgramUniformMatrix2x4fv(table
, save_ProgramUniformMatrix2x4fv
);
10022 SET_ProgramUniformMatrix4x2fv(table
, save_ProgramUniformMatrix4x2fv
);
10023 SET_ProgramUniformMatrix3x4fv(table
, save_ProgramUniformMatrix3x4fv
);
10024 SET_ProgramUniformMatrix4x3fv(table
, save_ProgramUniformMatrix4x3fv
);
10026 /* GL_EXT_polygon_offset_clamp */
10027 SET_PolygonOffsetClampEXT(table
, save_PolygonOffsetClampEXT
);
10032 static const char *
10033 enum_string(GLenum k
)
10035 return _mesa_enum_to_string(k
);
10040 * Print the commands in a display list. For debugging only.
10041 * TODO: many commands aren't handled yet.
10042 * \param fname filename to write display list to. If null, use stdout.
10044 static void GLAPIENTRY
10045 print_list(struct gl_context
*ctx
, GLuint list
, const char *fname
)
10047 struct gl_display_list
*dlist
;
10053 f
= fopen(fname
, "w");
10058 if (!islist(ctx
, list
)) {
10059 fprintf(f
, "%u is not a display list ID\n", list
);
10063 dlist
= _mesa_lookup_list(ctx
, list
);
10069 fprintf(f
, "START-LIST %u, address %p\n", list
, (void *) n
);
10071 done
= n
? GL_FALSE
: GL_TRUE
;
10073 const OpCode opcode
= n
[0].opcode
;
10075 if (is_ext_opcode(opcode
)) {
10076 n
+= ext_opcode_print(ctx
, n
, f
);
10081 fprintf(f
, "Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
10083 case OPCODE_ACTIVE_TEXTURE
:
10084 fprintf(f
, "ActiveTexture(%s)\n", enum_string(n
[1].e
));
10086 case OPCODE_BITMAP
:
10087 fprintf(f
, "Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
10088 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
10089 get_pointer(&n
[7]));
10091 case OPCODE_BLEND_COLOR
:
10092 fprintf(f
, "BlendColor %f, %f, %f, %f\n",
10093 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10095 case OPCODE_BLEND_EQUATION
:
10096 fprintf(f
, "BlendEquation %s\n",
10097 enum_string(n
[1].e
));
10099 case OPCODE_BLEND_EQUATION_SEPARATE
:
10100 fprintf(f
, "BlendEquationSeparate %s, %s\n",
10101 enum_string(n
[1].e
),
10102 enum_string(n
[2].e
));
10104 case OPCODE_BLEND_FUNC_SEPARATE
:
10105 fprintf(f
, "BlendFuncSeparate %s, %s, %s, %s\n",
10106 enum_string(n
[1].e
),
10107 enum_string(n
[2].e
),
10108 enum_string(n
[3].e
),
10109 enum_string(n
[4].e
));
10111 case OPCODE_BLEND_EQUATION_I
:
10112 fprintf(f
, "BlendEquationi %u, %s\n",
10113 n
[1].ui
, enum_string(n
[2].e
));
10115 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
10116 fprintf(f
, "BlendEquationSeparatei %u, %s, %s\n",
10117 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
10119 case OPCODE_BLEND_FUNC_I
:
10120 fprintf(f
, "BlendFunci %u, %s, %s\n",
10121 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
10123 case OPCODE_BLEND_FUNC_SEPARATE_I
:
10124 fprintf(f
, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
10126 enum_string(n
[2].e
),
10127 enum_string(n
[3].e
),
10128 enum_string(n
[4].e
),
10129 enum_string(n
[5].e
));
10131 case OPCODE_CALL_LIST
:
10132 fprintf(f
, "CallList %d\n", (int) n
[1].ui
);
10134 case OPCODE_CALL_LISTS
:
10135 fprintf(f
, "CallLists %d, %s\n", n
[1].i
, enum_string(n
[1].e
));
10137 case OPCODE_DISABLE
:
10138 fprintf(f
, "Disable %s\n", enum_string(n
[1].e
));
10140 case OPCODE_ENABLE
:
10141 fprintf(f
, "Enable %s\n", enum_string(n
[1].e
));
10143 case OPCODE_FRUSTUM
:
10144 fprintf(f
, "Frustum %g %g %g %g %g %g\n",
10145 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10147 case OPCODE_LINE_STIPPLE
:
10148 fprintf(f
, "LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
10150 case OPCODE_LINE_WIDTH
:
10151 fprintf(f
, "LineWidth %f\n", n
[1].f
);
10153 case OPCODE_LOAD_IDENTITY
:
10154 fprintf(f
, "LoadIdentity\n");
10156 case OPCODE_LOAD_MATRIX
:
10157 fprintf(f
, "LoadMatrix\n");
10158 fprintf(f
, " %8f %8f %8f %8f\n",
10159 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
10160 fprintf(f
, " %8f %8f %8f %8f\n",
10161 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
10162 fprintf(f
, " %8f %8f %8f %8f\n",
10163 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
10164 fprintf(f
, " %8f %8f %8f %8f\n",
10165 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
10167 case OPCODE_MULT_MATRIX
:
10168 fprintf(f
, "MultMatrix (or Rotate)\n");
10169 fprintf(f
, " %8f %8f %8f %8f\n",
10170 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
10171 fprintf(f
, " %8f %8f %8f %8f\n",
10172 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
10173 fprintf(f
, " %8f %8f %8f %8f\n",
10174 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
10175 fprintf(f
, " %8f %8f %8f %8f\n",
10176 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
10179 fprintf(f
, "Ortho %g %g %g %g %g %g\n",
10180 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10182 case OPCODE_POINT_SIZE
:
10183 fprintf(f
, "PointSize %f\n", n
[1].f
);
10185 case OPCODE_POP_ATTRIB
:
10186 fprintf(f
, "PopAttrib\n");
10188 case OPCODE_POP_MATRIX
:
10189 fprintf(f
, "PopMatrix\n");
10191 case OPCODE_POP_NAME
:
10192 fprintf(f
, "PopName\n");
10194 case OPCODE_PUSH_ATTRIB
:
10195 fprintf(f
, "PushAttrib %x\n", n
[1].bf
);
10197 case OPCODE_PUSH_MATRIX
:
10198 fprintf(f
, "PushMatrix\n");
10200 case OPCODE_PUSH_NAME
:
10201 fprintf(f
, "PushName %d\n", (int) n
[1].ui
);
10203 case OPCODE_RASTER_POS
:
10204 fprintf(f
, "RasterPos %g %g %g %g\n",
10205 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10207 case OPCODE_ROTATE
:
10208 fprintf(f
, "Rotate %g %g %g %g\n",
10209 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10212 fprintf(f
, "Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
10214 case OPCODE_TRANSLATE
:
10215 fprintf(f
, "Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
10217 case OPCODE_BIND_TEXTURE
:
10218 fprintf(f
, "BindTexture %s %d\n",
10219 _mesa_enum_to_string(n
[1].ui
), n
[2].ui
);
10221 case OPCODE_SHADE_MODEL
:
10222 fprintf(f
, "ShadeModel %s\n", _mesa_enum_to_string(n
[1].ui
));
10225 fprintf(f
, "Map1 %s %.3f %.3f %d %d\n",
10226 _mesa_enum_to_string(n
[1].ui
),
10227 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
10230 fprintf(f
, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
10231 _mesa_enum_to_string(n
[1].ui
),
10232 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
10233 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
10235 case OPCODE_MAPGRID1
:
10236 fprintf(f
, "MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
10238 case OPCODE_MAPGRID2
:
10239 fprintf(f
, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
10240 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
10242 case OPCODE_EVALMESH1
:
10243 fprintf(f
, "EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
10245 case OPCODE_EVALMESH2
:
10246 fprintf(f
, "EvalMesh2 %d %d %d %d\n",
10247 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
10250 case OPCODE_ATTR_1F_NV
:
10251 fprintf(f
, "ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
10253 case OPCODE_ATTR_2F_NV
:
10254 fprintf(f
, "ATTR_2F_NV attr %d: %f %f\n",
10255 n
[1].i
, n
[2].f
, n
[3].f
);
10257 case OPCODE_ATTR_3F_NV
:
10258 fprintf(f
, "ATTR_3F_NV attr %d: %f %f %f\n",
10259 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
10261 case OPCODE_ATTR_4F_NV
:
10262 fprintf(f
, "ATTR_4F_NV attr %d: %f %f %f %f\n",
10263 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
10265 case OPCODE_ATTR_1F_ARB
:
10266 fprintf(f
, "ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
10268 case OPCODE_ATTR_2F_ARB
:
10269 fprintf(f
, "ATTR_2F_ARB attr %d: %f %f\n",
10270 n
[1].i
, n
[2].f
, n
[3].f
);
10272 case OPCODE_ATTR_3F_ARB
:
10273 fprintf(f
, "ATTR_3F_ARB attr %d: %f %f %f\n",
10274 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
10276 case OPCODE_ATTR_4F_ARB
:
10277 fprintf(f
, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
10278 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
10281 case OPCODE_MATERIAL
:
10282 fprintf(f
, "MATERIAL %x %x: %f %f %f %f\n",
10283 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10286 fprintf(f
, "BEGIN %x\n", n
[1].i
);
10289 fprintf(f
, "END\n");
10292 fprintf(f
, "RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
10295 case OPCODE_EVAL_C1
:
10296 fprintf(f
, "EVAL_C1 %f\n", n
[1].f
);
10298 case OPCODE_EVAL_C2
:
10299 fprintf(f
, "EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
10301 case OPCODE_EVAL_P1
:
10302 fprintf(f
, "EVAL_P1 %d\n", n
[1].i
);
10304 case OPCODE_EVAL_P2
:
10305 fprintf(f
, "EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
10308 case OPCODE_PROVOKING_VERTEX
:
10309 fprintf(f
, "ProvokingVertex %s\n",
10310 _mesa_enum_to_string(n
[1].ui
));
10314 * meta opcodes/commands
10317 fprintf(f
, "Error: %s %s\n", enum_string(n
[1].e
),
10318 (const char *) get_pointer(&n
[2]));
10320 case OPCODE_CONTINUE
:
10321 fprintf(f
, "DISPLAY-LIST-CONTINUE\n");
10322 n
= (Node
*) get_pointer(&n
[1]);
10325 fprintf(f
, "NOP\n");
10327 case OPCODE_END_OF_LIST
:
10328 fprintf(f
, "END-LIST %u\n", list
);
10332 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
10334 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
10335 opcode
, (void *) n
);
10339 fprintf(f
, "command %d, %u operands\n", opcode
,
10343 /* increment n to point to next compiled command */
10344 if (opcode
!= OPCODE_CONTINUE
) {
10345 n
+= InstSize
[opcode
];
10358 * Clients may call this function to help debug display list problems.
10359 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
10360 * changed, or break in the future without notice.
10363 mesa_print_display_list(GLuint list
)
10365 GET_CURRENT_CONTEXT(ctx
);
10366 print_list(ctx
, list
, NULL
);
10370 /**********************************************************************/
10371 /***** Initialization *****/
10372 /**********************************************************************/
10375 save_vtxfmt_init(GLvertexformat
* vfmt
)
10377 vfmt
->ArrayElement
= _ae_ArrayElement
;
10379 vfmt
->Begin
= save_Begin
;
10381 vfmt
->CallList
= save_CallList
;
10382 vfmt
->CallLists
= save_CallLists
;
10384 vfmt
->Color3f
= save_Color3f
;
10385 vfmt
->Color3fv
= save_Color3fv
;
10386 vfmt
->Color4f
= save_Color4f
;
10387 vfmt
->Color4fv
= save_Color4fv
;
10388 vfmt
->EdgeFlag
= save_EdgeFlag
;
10389 vfmt
->End
= save_End
;
10391 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
10392 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
10393 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
10394 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
10395 vfmt
->EvalPoint1
= save_EvalPoint1
;
10396 vfmt
->EvalPoint2
= save_EvalPoint2
;
10398 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
10399 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
10400 vfmt
->Indexf
= save_Indexf
;
10401 vfmt
->Indexfv
= save_Indexfv
;
10402 vfmt
->Materialfv
= save_Materialfv
;
10403 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
10404 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
10405 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
10406 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
10407 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
10408 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
10409 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
10410 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
10411 vfmt
->Normal3f
= save_Normal3f
;
10412 vfmt
->Normal3fv
= save_Normal3fv
;
10413 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
10414 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
10415 vfmt
->TexCoord1f
= save_TexCoord1f
;
10416 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
10417 vfmt
->TexCoord2f
= save_TexCoord2f
;
10418 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
10419 vfmt
->TexCoord3f
= save_TexCoord3f
;
10420 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
10421 vfmt
->TexCoord4f
= save_TexCoord4f
;
10422 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
10423 vfmt
->Vertex2f
= save_Vertex2f
;
10424 vfmt
->Vertex2fv
= save_Vertex2fv
;
10425 vfmt
->Vertex3f
= save_Vertex3f
;
10426 vfmt
->Vertex3fv
= save_Vertex3fv
;
10427 vfmt
->Vertex4f
= save_Vertex4f
;
10428 vfmt
->Vertex4fv
= save_Vertex4fv
;
10429 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
10430 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
10431 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
10432 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
10433 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
10434 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
10435 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
10436 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
10441 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
10442 const GLvertexformat
*vfmt
)
10444 SET_CallList(disp
, vfmt
->CallList
);
10445 SET_CallLists(disp
, vfmt
->CallLists
);
10450 * Initialize display list state for given context.
10453 _mesa_init_display_list(struct gl_context
*ctx
)
10455 static GLboolean tableInitialized
= GL_FALSE
;
10457 /* zero-out the instruction size table, just once */
10458 if (!tableInitialized
) {
10459 memset(InstSize
, 0, sizeof(InstSize
));
10460 tableInitialized
= GL_TRUE
;
10463 /* extension info */
10464 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
10467 ctx
->ListState
.CallDepth
= 0;
10468 ctx
->ExecuteFlag
= GL_TRUE
;
10469 ctx
->CompileFlag
= GL_FALSE
;
10470 ctx
->ListState
.CurrentBlock
= NULL
;
10471 ctx
->ListState
.CurrentPos
= 0;
10473 /* Display List group */
10474 ctx
->List
.ListBase
= 0;
10476 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
10478 InstSize
[OPCODE_NOP
] = 1;
10483 _mesa_free_display_list_data(struct gl_context
*ctx
)
10485 free(ctx
->ListExt
);
10486 ctx
->ListExt
= NULL
;