2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
29 * Display lists management functions.
35 #include "api_arrayelt.h"
37 #include "api_loopback.h"
38 #include "draw_validate.h"
39 #include "atifragshader.h"
41 #include "bufferobj.h"
48 #include "framebuffer.h"
49 #include "glapi/glapi.h"
50 #include "glformats.h"
58 #include "samplerobj.h"
59 #include "shaderapi.h"
62 #include "texstorage.h"
65 #include "arbprogram.h"
66 #include "transformfeedback.h"
68 #include "math/m_matrix.h"
70 #include "main/dispatch.h"
75 #define USE_BITMAP_ATLAS 1
80 * Other parts of Mesa (such as the VBO module) can plug into the display
81 * list system. This structure describes new display list instructions.
83 struct gl_list_instruction
86 void (*Execute
)( struct gl_context
*ctx
, void *data
);
87 void (*Destroy
)( struct gl_context
*ctx
, void *data
);
88 void (*Print
)( struct gl_context
*ctx
, void *data
, FILE *f
);
92 #define MAX_DLIST_EXT_OPCODES 16
95 * Used by device drivers to hook new commands into display lists.
97 struct gl_list_extensions
99 struct gl_list_instruction Opcode
[MAX_DLIST_EXT_OPCODES
];
108 * \param ctx GL context.
110 * Checks if dd_function_table::SaveNeedFlush is marked to flush
111 * stored (save) vertices, and calls vbo_save_SaveFlushVertices if so.
113 #define SAVE_FLUSH_VERTICES(ctx) \
115 if (ctx->Driver.SaveNeedFlush) \
116 vbo_save_SaveFlushVertices(ctx); \
121 * Macro to assert that the API call was made outside the
122 * glBegin()/glEnd() pair, with return value.
124 * \param ctx GL context.
125 * \param retval value to return value in case the assertion fails.
127 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
129 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
130 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
136 * Macro to assert that the API call was made outside the
137 * glBegin()/glEnd() pair.
139 * \param ctx GL context.
141 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
143 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
144 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
150 * Macro to assert that the API call was made outside the
151 * glBegin()/glEnd() pair and flush the vertices.
153 * \param ctx GL context.
155 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
157 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
158 SAVE_FLUSH_VERTICES(ctx); \
162 * Macro to assert that the API call was made outside the
163 * glBegin()/glEnd() pair and flush the vertices, with return value.
165 * \param ctx GL context.
166 * \param retval value to return value in case the assertion fails.
168 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
170 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
171 SAVE_FLUSH_VERTICES(ctx); \
176 * Display list opcodes.
178 * The fact that these identifiers are assigned consecutive
179 * integer values starting at 0 is very important, see InstSize array usage)
183 OPCODE_INVALID
= -1, /* Force signed enum */
189 OPCODE_BLEND_EQUATION
,
190 OPCODE_BLEND_EQUATION_SEPARATE
,
191 OPCODE_BLEND_FUNC_SEPARATE
,
193 OPCODE_BLEND_EQUATION_I
,
194 OPCODE_BLEND_EQUATION_SEPARATE_I
,
196 OPCODE_BLEND_FUNC_SEPARATE_I
,
205 OPCODE_CLEAR_STENCIL
,
206 OPCODE_CLEAR_BUFFER_IV
,
207 OPCODE_CLEAR_BUFFER_UIV
,
208 OPCODE_CLEAR_BUFFER_FV
,
209 OPCODE_CLEAR_BUFFER_FI
,
212 OPCODE_COLOR_MASK_INDEXED
,
213 OPCODE_COLOR_MATERIAL
,
215 OPCODE_COPY_TEX_IMAGE1D
,
216 OPCODE_COPY_TEX_IMAGE2D
,
217 OPCODE_COPY_TEX_SUB_IMAGE1D
,
218 OPCODE_COPY_TEX_SUB_IMAGE2D
,
219 OPCODE_COPY_TEX_SUB_IMAGE3D
,
225 OPCODE_DISABLE_INDEXED
,
229 OPCODE_ENABLE_INDEXED
,
243 OPCODE_LOAD_IDENTITY
,
256 OPCODE_PIXEL_TRANSFER
,
259 OPCODE_POINT_PARAMETERS
,
261 OPCODE_POLYGON_STIPPLE
,
262 OPCODE_POLYGON_OFFSET
,
266 OPCODE_PRIORITIZE_TEXTURE
,
275 OPCODE_SELECT_TEXTURE_SGIS
,
276 OPCODE_SELECT_TEXTURE_COORD_SET
,
287 OPCODE_TEX_SUB_IMAGE1D
,
288 OPCODE_TEX_SUB_IMAGE2D
,
289 OPCODE_TEX_SUB_IMAGE3D
,
293 /* GL_ARB_multitexture */
294 OPCODE_ACTIVE_TEXTURE
,
295 /* GL_ARB_texture_compression */
296 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
297 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
298 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
299 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
300 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
301 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
302 /* GL_ARB_multisample */
303 OPCODE_SAMPLE_COVERAGE
,
304 /* GL_ARB_window_pos */
305 OPCODE_WINDOW_POS_ARB
,
306 /* GL_ARB_vertex_program */
307 OPCODE_BIND_PROGRAM_ARB
,
308 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
309 /* GL_EXT_stencil_two_side */
310 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
311 /* GL_EXT_depth_bounds_test */
312 OPCODE_DEPTH_BOUNDS_EXT
,
313 /* GL_ARB_vertex/fragment_program */
314 OPCODE_PROGRAM_STRING_ARB
,
315 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
316 /* GL_ARB_occlusion_query */
317 OPCODE_BEGIN_QUERY_ARB
,
318 OPCODE_END_QUERY_ARB
,
319 /* GL_ARB_draw_buffers */
320 OPCODE_DRAW_BUFFERS_ARB
,
321 /* GL_ATI_fragment_shader */
322 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
323 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
325 OPCODE_STENCIL_FUNC_SEPARATE
,
326 OPCODE_STENCIL_OP_SEPARATE
,
327 OPCODE_STENCIL_MASK_SEPARATE
,
328 /* GL_NV_primitive_restart */
329 OPCODE_PRIMITIVE_RESTART_NV
,
330 /* GL_ARB_shader_objects */
348 OPCODE_UNIFORM_MATRIX22
,
349 OPCODE_UNIFORM_MATRIX33
,
350 OPCODE_UNIFORM_MATRIX44
,
351 OPCODE_UNIFORM_MATRIX23
,
352 OPCODE_UNIFORM_MATRIX32
,
353 OPCODE_UNIFORM_MATRIX24
,
354 OPCODE_UNIFORM_MATRIX42
,
355 OPCODE_UNIFORM_MATRIX34
,
356 OPCODE_UNIFORM_MATRIX43
,
368 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
369 OPCODE_USE_PROGRAM_STAGES
,
370 OPCODE_PROGRAM_UNIFORM_1F
,
371 OPCODE_PROGRAM_UNIFORM_2F
,
372 OPCODE_PROGRAM_UNIFORM_3F
,
373 OPCODE_PROGRAM_UNIFORM_4F
,
374 OPCODE_PROGRAM_UNIFORM_1FV
,
375 OPCODE_PROGRAM_UNIFORM_2FV
,
376 OPCODE_PROGRAM_UNIFORM_3FV
,
377 OPCODE_PROGRAM_UNIFORM_4FV
,
378 OPCODE_PROGRAM_UNIFORM_1I
,
379 OPCODE_PROGRAM_UNIFORM_2I
,
380 OPCODE_PROGRAM_UNIFORM_3I
,
381 OPCODE_PROGRAM_UNIFORM_4I
,
382 OPCODE_PROGRAM_UNIFORM_1IV
,
383 OPCODE_PROGRAM_UNIFORM_2IV
,
384 OPCODE_PROGRAM_UNIFORM_3IV
,
385 OPCODE_PROGRAM_UNIFORM_4IV
,
386 OPCODE_PROGRAM_UNIFORM_1UI
,
387 OPCODE_PROGRAM_UNIFORM_2UI
,
388 OPCODE_PROGRAM_UNIFORM_3UI
,
389 OPCODE_PROGRAM_UNIFORM_4UI
,
390 OPCODE_PROGRAM_UNIFORM_1UIV
,
391 OPCODE_PROGRAM_UNIFORM_2UIV
,
392 OPCODE_PROGRAM_UNIFORM_3UIV
,
393 OPCODE_PROGRAM_UNIFORM_4UIV
,
394 OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
395 OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
396 OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
397 OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
398 OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
399 OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
400 OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
401 OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
402 OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
404 /* GL_ARB_clip_control */
407 /* GL_ARB_color_buffer_float */
410 /* GL_EXT_framebuffer_blit */
411 OPCODE_BLIT_FRAMEBUFFER
,
413 /* Vertex attributes -- fallback for when optimized display
414 * list build isn't active.
433 /* GL_EXT_provoking_vertex */
434 OPCODE_PROVOKING_VERTEX
,
436 /* GL_EXT_transform_feedback */
437 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
438 OPCODE_END_TRANSFORM_FEEDBACK
,
439 OPCODE_BIND_TRANSFORM_FEEDBACK
,
440 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
441 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
442 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
444 /* GL_EXT_texture_integer */
446 OPCODE_CLEARCOLOR_UI
,
447 OPCODE_TEXPARAMETER_I
,
448 OPCODE_TEXPARAMETER_UI
,
450 /* GL_ARB_instanced_arrays */
451 OPCODE_VERTEX_ATTRIB_DIVISOR
,
453 /* GL_NV_texture_barrier */
454 OPCODE_TEXTURE_BARRIER_NV
,
456 /* GL_ARB_sampler_object */
458 OPCODE_SAMPLER_PARAMETERIV
,
459 OPCODE_SAMPLER_PARAMETERFV
,
460 OPCODE_SAMPLER_PARAMETERIIV
,
461 OPCODE_SAMPLER_PARAMETERUIV
,
466 /* GL_NV_conditional_render */
467 OPCODE_BEGIN_CONDITIONAL_RENDER
,
468 OPCODE_END_CONDITIONAL_RENDER
,
470 /* ARB_timer_query */
471 OPCODE_QUERY_COUNTER
,
473 /* ARB_transform_feedback3 */
474 OPCODE_BEGIN_QUERY_INDEXED
,
475 OPCODE_END_QUERY_INDEXED
,
476 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
478 /* ARB_transform_feedback_instanced */
479 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
480 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
482 /* ARB_uniform_buffer_object */
483 OPCODE_UNIFORM_BLOCK_BINDING
,
485 /* EXT_polygon_offset_clamp */
486 OPCODE_POLYGON_OFFSET_CLAMP
,
488 /* EXT_window_rectangles */
489 OPCODE_WINDOW_RECTANGLES
,
491 /* NV_conservative_raster */
492 OPCODE_SUBPIXEL_PRECISION_BIAS
,
494 /* NV_conservative_raster_dilate */
495 OPCODE_CONSERVATIVE_RASTER_PARAMETER_F
,
497 /* NV_conservative_raster_pre_snap_triangles */
498 OPCODE_CONSERVATIVE_RASTER_PARAMETER_I
,
500 /* The following three are meta instructions */
501 OPCODE_ERROR
, /* raise compiled-in error */
503 OPCODE_NOP
, /* No-op (used for 8-byte alignment */
513 * Display list instructions are stored as sequences of "nodes". Nodes
514 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
515 * are linked together with a pointer.
517 * Each instruction in the display list is stored as a sequence of
518 * contiguous nodes in memory.
519 * Each node is the union of a variety of data types.
521 * Note, all of these members should be 4 bytes in size or less for the
522 * sake of compact display lists. We store 8-byte pointers in a pair of
523 * these nodes using the save/get_pointer() functions below.
541 typedef union gl_dlist_node Node
;
544 /** How many 4-byte dwords to store a pointer */
545 #define POINTER_DWORDS (sizeof(void *) / 4)
547 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
548 * space for display lists. The following types and functions are
549 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
554 GLuint dwords
[POINTER_DWORDS
];
559 * Save a 4 or 8-byte pointer at dest (and dest+1).
562 save_pointer(Node
*dest
, void *src
)
567 STATIC_ASSERT(POINTER_DWORDS
== 1 || POINTER_DWORDS
== 2);
568 STATIC_ASSERT(sizeof(Node
) == 4);
572 for (i
= 0; i
< POINTER_DWORDS
; i
++)
573 dest
[i
].ui
= p
.dwords
[i
];
578 * Retrieve a 4 or 8-byte pointer from node (node+1).
581 get_pointer(const Node
*node
)
586 for (i
= 0; i
< POINTER_DWORDS
; i
++)
587 p
.dwords
[i
] = node
[i
].ui
;
594 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
605 * How many nodes to allocate at a time. Note that bulk vertex data
606 * from glBegin/glVertex/glEnd primitives will typically wind up in
607 * a VBO, and not directly in the display list itself.
609 #define BLOCK_SIZE 256
614 * Number of nodes of storage needed for each instruction.
615 * Sizes for dynamically allocated opcodes are stored in the context struct.
617 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
620 void mesa_print_display_list(GLuint list
);
624 * Does the given display list only contain a single glBitmap call?
627 is_bitmap_list(const struct gl_display_list
*dlist
)
629 const Node
*n
= dlist
->Head
;
630 if (n
[0].opcode
== OPCODE_BITMAP
) {
631 n
+= InstSize
[OPCODE_BITMAP
];
632 if (n
[0].opcode
== OPCODE_END_OF_LIST
)
640 * Is the given display list an empty list?
643 is_empty_list(const struct gl_display_list
*dlist
)
645 const Node
*n
= dlist
->Head
;
646 return n
[0].opcode
== OPCODE_END_OF_LIST
;
651 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
654 _mesa_delete_bitmap_atlas(struct gl_context
*ctx
, struct gl_bitmap_atlas
*atlas
)
657 ctx
->Driver
.DeleteTexture(ctx
, atlas
->texObj
);
664 * Lookup a gl_bitmap_atlas by listBase ID.
666 static struct gl_bitmap_atlas
*
667 lookup_bitmap_atlas(struct gl_context
*ctx
, GLuint listBase
)
669 struct gl_bitmap_atlas
*atlas
;
671 assert(listBase
> 0);
672 atlas
= _mesa_HashLookup(ctx
->Shared
->BitmapAtlas
, listBase
);
678 * Create new bitmap atlas and insert into hash table.
680 static struct gl_bitmap_atlas
*
681 alloc_bitmap_atlas(struct gl_context
*ctx
, GLuint listBase
)
683 struct gl_bitmap_atlas
*atlas
;
685 assert(listBase
> 0);
686 assert(_mesa_HashLookup(ctx
->Shared
->BitmapAtlas
, listBase
) == NULL
);
688 atlas
= calloc(1, sizeof(*atlas
));
690 _mesa_HashInsert(ctx
->Shared
->BitmapAtlas
, listBase
, atlas
);
698 * Try to build a bitmap atlas. This involves examining a sequence of
699 * display lists which contain glBitmap commands and putting the bitmap
700 * images into a texture map (the atlas).
701 * If we succeed, gl_bitmap_atlas::complete will be set to true.
702 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
705 build_bitmap_atlas(struct gl_context
*ctx
, struct gl_bitmap_atlas
*atlas
,
708 unsigned i
, row_height
= 0, xpos
= 0, ypos
= 0;
713 assert(!atlas
->complete
);
714 assert(atlas
->numBitmaps
> 0);
716 /* We use a rectangle texture (non-normalized coords) for the atlas */
717 assert(ctx
->Extensions
.NV_texture_rectangle
);
718 assert(ctx
->Const
.MaxTextureRectSize
>= 1024);
720 atlas
->texWidth
= 1024;
721 atlas
->texHeight
= 0; /* determined below */
723 atlas
->glyphs
= malloc(atlas
->numBitmaps
* sizeof(atlas
->glyphs
[0]));
724 if (!atlas
->glyphs
) {
726 atlas
->incomplete
= true;
730 /* Loop over the display lists. They should all contain a single glBitmap
731 * call. If not, bail out. Also, compute the position and sizes of each
732 * bitmap in the atlas to determine the texture atlas size.
734 for (i
= 0; i
< atlas
->numBitmaps
; i
++) {
735 const struct gl_display_list
*list
= _mesa_lookup_list(ctx
, listBase
+ i
);
737 struct gl_bitmap_glyph
*g
= &atlas
->glyphs
[i
];
738 unsigned bitmap_width
, bitmap_height
;
739 float bitmap_xmove
, bitmap_ymove
, bitmap_xorig
, bitmap_yorig
;
741 if (!list
|| is_empty_list(list
)) {
743 atlas
->numBitmaps
= i
;
747 if (!is_bitmap_list(list
)) {
748 /* This list does not contain exactly one glBitmap command. Give up. */
749 atlas
->incomplete
= true;
753 /* get bitmap info from the display list command */
755 assert(n
[0].opcode
== OPCODE_BITMAP
);
756 bitmap_width
= n
[1].i
;
757 bitmap_height
= n
[2].i
;
758 bitmap_xorig
= n
[3].f
;
759 bitmap_yorig
= n
[4].f
;
760 bitmap_xmove
= n
[5].f
;
761 bitmap_ymove
= n
[6].f
;
763 if (xpos
+ bitmap_width
> atlas
->texWidth
) {
764 /* advance to the next row of the texture */
770 /* save the bitmap's position in the atlas */
774 g
->h
= bitmap_height
;
775 g
->xorig
= bitmap_xorig
;
776 g
->yorig
= bitmap_yorig
;
777 g
->xmove
= bitmap_xmove
;
778 g
->ymove
= bitmap_ymove
;
780 xpos
+= bitmap_width
;
782 /* keep track of tallest bitmap in the row */
783 row_height
= MAX2(row_height
, bitmap_height
);
786 /* Now we know the texture height */
787 atlas
->texHeight
= ypos
+ row_height
;
789 if (atlas
->texHeight
== 0) {
790 /* no glyphs found, give up */
793 else if (atlas
->texHeight
> ctx
->Const
.MaxTextureRectSize
) {
794 /* too large, give up */
798 /* Create atlas texture (texture ID is irrelevant) */
799 atlas
->texObj
= ctx
->Driver
.NewTextureObject(ctx
, 999, GL_TEXTURE_RECTANGLE
);
800 if (!atlas
->texObj
) {
804 atlas
->texObj
->Sampler
.MinFilter
= GL_NEAREST
;
805 atlas
->texObj
->Sampler
.MagFilter
= GL_NEAREST
;
806 atlas
->texObj
->MaxLevel
= 0;
807 atlas
->texObj
->Immutable
= GL_TRUE
;
809 atlas
->texImage
= _mesa_get_tex_image(ctx
, atlas
->texObj
,
810 GL_TEXTURE_RECTANGLE
, 0);
811 if (!atlas
->texImage
) {
815 _mesa_init_teximage_fields(ctx
, atlas
->texImage
,
816 atlas
->texWidth
, atlas
->texHeight
, 1, 0,
817 GL_ALPHA
, MESA_FORMAT_A_UNORM8
);
819 /* alloc image storage */
820 if (!ctx
->Driver
.AllocTextureImageBuffer(ctx
, atlas
->texImage
)) {
824 /* map teximage, load with bitmap glyphs */
825 ctx
->Driver
.MapTextureImage(ctx
, atlas
->texImage
, 0,
826 0, 0, atlas
->texWidth
, atlas
->texHeight
,
827 GL_MAP_WRITE_BIT
, &map
, &map_stride
);
832 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
833 memset(map
, 0xff, map_stride
* atlas
->texHeight
);
835 for (i
= 0; i
< atlas
->numBitmaps
; i
++) {
836 const struct gl_display_list
*list
= _mesa_lookup_list(ctx
, listBase
+ i
);
837 const Node
*n
= list
->Head
;
839 assert(n
[0].opcode
== OPCODE_BITMAP
||
840 n
[0].opcode
== OPCODE_END_OF_LIST
);
842 if (n
[0].opcode
== OPCODE_BITMAP
) {
843 unsigned bitmap_width
= n
[1].i
;
844 unsigned bitmap_height
= n
[2].i
;
845 unsigned xpos
= atlas
->glyphs
[i
].x
;
846 unsigned ypos
= atlas
->glyphs
[i
].y
;
847 const void *bitmap_image
= get_pointer(&n
[7]);
849 assert(atlas
->glyphs
[i
].w
== bitmap_width
);
850 assert(atlas
->glyphs
[i
].h
== bitmap_height
);
852 /* put the bitmap image into the texture image */
853 _mesa_expand_bitmap(bitmap_width
, bitmap_height
,
854 &ctx
->DefaultPacking
, bitmap_image
,
855 map
+ map_stride
* ypos
+ xpos
, /* dest addr */
860 ctx
->Driver
.UnmapTextureImage(ctx
, atlas
->texImage
, 0);
862 atlas
->complete
= true;
867 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Display list bitmap atlas");
870 ctx
->Driver
.DeleteTexture(ctx
, atlas
->texObj
);
873 atlas
->glyphs
= NULL
;
874 atlas
->incomplete
= true;
879 * Allocate a gl_display_list object with an initial block of storage.
880 * \param count how many display list nodes/tokens to allocate
882 static struct gl_display_list
*
883 make_list(GLuint name
, GLuint count
)
885 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
887 dlist
->Head
= malloc(sizeof(Node
) * count
);
888 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
894 * Lookup function to just encapsulate casting.
896 struct gl_display_list
*
897 _mesa_lookup_list(struct gl_context
*ctx
, GLuint list
)
899 return (struct gl_display_list
*)
900 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
904 /** Is the given opcode an extension code? */
905 static inline GLboolean
906 is_ext_opcode(OpCode opcode
)
908 return (opcode
>= OPCODE_EXT_0
);
912 /** Destroy an extended opcode instruction */
914 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
916 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
918 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
919 step
= ctx
->ListExt
->Opcode
[i
].Size
;
924 /** Execute an extended opcode instruction */
926 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
928 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
930 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
931 step
= ctx
->ListExt
->Opcode
[i
].Size
;
936 /** Print an extended opcode instruction */
938 ext_opcode_print(struct gl_context
*ctx
, Node
*node
, FILE *f
)
940 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
942 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1], f
);
943 step
= ctx
->ListExt
->Opcode
[i
].Size
;
949 * Delete the named display list, but don't remove from hash table.
950 * \param dlist - display list pointer
953 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
958 n
= block
= dlist
->Head
;
960 done
= block
? GL_FALSE
: GL_TRUE
;
962 const OpCode opcode
= n
[0].opcode
;
964 /* check for extension opcodes first */
965 if (is_ext_opcode(opcode
)) {
966 n
+= ext_opcode_destroy(ctx
, n
);
970 /* for some commands, we need to free malloc'd memory */
972 free(get_pointer(&n
[6]));
975 free(get_pointer(&n
[10]));
977 case OPCODE_CALL_LISTS
:
978 free(get_pointer(&n
[3]));
980 case OPCODE_DRAW_PIXELS
:
981 free(get_pointer(&n
[5]));
984 free(get_pointer(&n
[7]));
986 case OPCODE_POLYGON_STIPPLE
:
987 free(get_pointer(&n
[1]));
989 case OPCODE_TEX_IMAGE1D
:
990 free(get_pointer(&n
[8]));
992 case OPCODE_TEX_IMAGE2D
:
993 free(get_pointer(&n
[9]));
995 case OPCODE_TEX_IMAGE3D
:
996 free(get_pointer(&n
[10]));
998 case OPCODE_TEX_SUB_IMAGE1D
:
999 free(get_pointer(&n
[7]));
1001 case OPCODE_TEX_SUB_IMAGE2D
:
1002 free(get_pointer(&n
[9]));
1004 case OPCODE_TEX_SUB_IMAGE3D
:
1005 free(get_pointer(&n
[11]));
1007 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
1008 free(get_pointer(&n
[7]));
1010 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
1011 free(get_pointer(&n
[8]));
1013 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
1014 free(get_pointer(&n
[9]));
1016 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
1017 free(get_pointer(&n
[7]));
1019 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
1020 free(get_pointer(&n
[9]));
1022 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
1023 free(get_pointer(&n
[11]));
1025 case OPCODE_PROGRAM_STRING_ARB
:
1026 free(get_pointer(&n
[4])); /* program string */
1028 case OPCODE_UNIFORM_1FV
:
1029 case OPCODE_UNIFORM_2FV
:
1030 case OPCODE_UNIFORM_3FV
:
1031 case OPCODE_UNIFORM_4FV
:
1032 case OPCODE_UNIFORM_1IV
:
1033 case OPCODE_UNIFORM_2IV
:
1034 case OPCODE_UNIFORM_3IV
:
1035 case OPCODE_UNIFORM_4IV
:
1036 case OPCODE_UNIFORM_1UIV
:
1037 case OPCODE_UNIFORM_2UIV
:
1038 case OPCODE_UNIFORM_3UIV
:
1039 case OPCODE_UNIFORM_4UIV
:
1040 free(get_pointer(&n
[3]));
1042 case OPCODE_UNIFORM_MATRIX22
:
1043 case OPCODE_UNIFORM_MATRIX33
:
1044 case OPCODE_UNIFORM_MATRIX44
:
1045 case OPCODE_UNIFORM_MATRIX24
:
1046 case OPCODE_UNIFORM_MATRIX42
:
1047 case OPCODE_UNIFORM_MATRIX23
:
1048 case OPCODE_UNIFORM_MATRIX32
:
1049 case OPCODE_UNIFORM_MATRIX34
:
1050 case OPCODE_UNIFORM_MATRIX43
:
1051 free(get_pointer(&n
[4]));
1053 case OPCODE_PROGRAM_UNIFORM_1FV
:
1054 case OPCODE_PROGRAM_UNIFORM_2FV
:
1055 case OPCODE_PROGRAM_UNIFORM_3FV
:
1056 case OPCODE_PROGRAM_UNIFORM_4FV
:
1057 case OPCODE_PROGRAM_UNIFORM_1IV
:
1058 case OPCODE_PROGRAM_UNIFORM_2IV
:
1059 case OPCODE_PROGRAM_UNIFORM_3IV
:
1060 case OPCODE_PROGRAM_UNIFORM_4IV
:
1061 case OPCODE_PROGRAM_UNIFORM_1UIV
:
1062 case OPCODE_PROGRAM_UNIFORM_2UIV
:
1063 case OPCODE_PROGRAM_UNIFORM_3UIV
:
1064 case OPCODE_PROGRAM_UNIFORM_4UIV
:
1065 free(get_pointer(&n
[4]));
1067 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
1068 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
1069 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
1070 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
1071 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
1072 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
1073 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
1074 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
1075 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
1076 free(get_pointer(&n
[5]));
1078 case OPCODE_PIXEL_MAP
:
1079 free(get_pointer(&n
[3]));
1081 case OPCODE_WINDOW_RECTANGLES
:
1082 free(get_pointer(&n
[3]));
1084 case OPCODE_CONTINUE
:
1085 n
= (Node
*) get_pointer(&n
[1]);
1089 case OPCODE_END_OF_LIST
:
1094 /* just increment 'n' pointer, below */
1098 if (opcode
!= OPCODE_CONTINUE
) {
1099 assert(InstSize
[opcode
] > 0);
1100 n
+= InstSize
[opcode
];
1111 * Called by _mesa_HashWalk() to check if a display list which is being
1112 * deleted belongs to a bitmap texture atlas.
1115 check_atlas_for_deleted_list(GLuint atlas_id
, void *data
, void *userData
)
1117 struct gl_bitmap_atlas
*atlas
= (struct gl_bitmap_atlas
*) data
;
1118 GLuint list_id
= *((GLuint
*) userData
); /* the list being deleted */
1120 /* See if the list_id falls in the range contained in this texture atlas */
1121 if (atlas
->complete
&&
1122 list_id
>= atlas_id
&&
1123 list_id
< atlas_id
+ atlas
->numBitmaps
) {
1124 /* Mark the atlas as incomplete so it doesn't get used. But don't
1125 * delete it yet since we don't want to try to recreate it in the next
1128 atlas
->complete
= false;
1129 atlas
->incomplete
= true;
1135 * Destroy a display list and remove from hash table.
1136 * \param list - display list number
1139 destroy_list(struct gl_context
*ctx
, GLuint list
)
1141 struct gl_display_list
*dlist
;
1146 dlist
= _mesa_lookup_list(ctx
, list
);
1150 if (is_bitmap_list(dlist
)) {
1151 /* If we're destroying a simple glBitmap display list, there's a
1152 * chance that we're destroying a bitmap image that's in a texture
1153 * atlas. Examine all atlases to see if that's the case. There's
1154 * usually few (if any) atlases so this isn't expensive.
1156 _mesa_HashWalk(ctx
->Shared
->BitmapAtlas
,
1157 check_atlas_for_deleted_list
, &list
);
1160 _mesa_delete_list(ctx
, dlist
);
1161 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
1166 * Translate the nth element of list from <type> to GLint.
1169 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
1181 bptr
= (GLbyte
*) list
;
1182 return (GLint
) bptr
[n
];
1183 case GL_UNSIGNED_BYTE
:
1184 ubptr
= (GLubyte
*) list
;
1185 return (GLint
) ubptr
[n
];
1187 sptr
= (GLshort
*) list
;
1188 return (GLint
) sptr
[n
];
1189 case GL_UNSIGNED_SHORT
:
1190 usptr
= (GLushort
*) list
;
1191 return (GLint
) usptr
[n
];
1193 iptr
= (GLint
*) list
;
1195 case GL_UNSIGNED_INT
:
1196 uiptr
= (GLuint
*) list
;
1197 return (GLint
) uiptr
[n
];
1199 fptr
= (GLfloat
*) list
;
1200 return (GLint
) floorf(fptr
[n
]);
1202 ubptr
= ((GLubyte
*) list
) + 2 * n
;
1203 return (GLint
) ubptr
[0] * 256
1206 ubptr
= ((GLubyte
*) list
) + 3 * n
;
1207 return (GLint
) ubptr
[0] * 65536
1208 + (GLint
) ubptr
[1] * 256
1211 ubptr
= ((GLubyte
*) list
) + 4 * n
;
1212 return (GLint
) ubptr
[0] * 16777216
1213 + (GLint
) ubptr
[1] * 65536
1214 + (GLint
) ubptr
[2] * 256
1223 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1224 * If width < 0 or height < 0 or format or type are invalid we'll just
1225 * return NULL. We will not generate an error since OpenGL command
1226 * arguments aren't error-checked until the command is actually executed
1227 * (not when they're compiled).
1228 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1231 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
1232 GLsizei width
, GLsizei height
, GLsizei depth
,
1233 GLenum format
, GLenum type
, const GLvoid
* pixels
,
1234 const struct gl_pixelstore_attrib
*unpack
)
1236 if (width
<= 0 || height
<= 0) {
1240 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
1241 /* bad format and/or type */
1245 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
1249 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
1250 format
, type
, pixels
, unpack
);
1251 if (pixels
&& !image
) {
1252 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1256 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
1257 depth
, format
, type
, INT_MAX
, pixels
)) {
1258 const GLubyte
*map
, *src
;
1262 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
1263 GL_MAP_READ_BIT
, unpack
->BufferObj
,
1266 /* unable to map src buffer! */
1267 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
1271 src
= ADD_POINTERS(map
, pixels
);
1272 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
1273 format
, type
, src
, unpack
);
1275 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
, MAP_INTERNAL
);
1278 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1284 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
1289 /** Return copy of memory */
1291 memdup(const void *src
, GLsizei bytes
)
1293 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
1295 memcpy(b
, src
, bytes
);
1301 * Allocate space for a display list instruction (opcode + payload space).
1302 * \param opcode the instruction opcode (OPCODE_* value)
1303 * \param bytes instruction payload size (not counting opcode)
1304 * \param align8 does the payload need to be 8-byte aligned?
1305 * This is only relevant in 64-bit environments.
1306 * \return pointer to allocated memory (the payload will be at pointer+1)
1309 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
, bool align8
)
1311 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
1312 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
1316 assert(bytes
<= BLOCK_SIZE
* sizeof(Node
));
1318 if (opcode
< OPCODE_EXT_0
) {
1319 if (InstSize
[opcode
] == 0) {
1320 /* save instruction size now */
1321 InstSize
[opcode
] = numNodes
;
1324 /* make sure instruction size agrees */
1325 assert(numNodes
== InstSize
[opcode
]);
1329 if (sizeof(void *) > sizeof(Node
) && align8
1330 && ctx
->ListState
.CurrentPos
% 2 == 0) {
1331 /* The opcode would get placed at node[0] and the payload would start
1332 * at node[1]. But the payload needs to be at an even offset (8-byte
1341 if (ctx
->ListState
.CurrentPos
+ nopNode
+ numNodes
+ contNodes
1343 /* This block is full. Allocate a new block and chain to it */
1345 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1346 n
[0].opcode
= OPCODE_CONTINUE
;
1347 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
1349 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
1353 /* a fresh block should be 8-byte aligned on 64-bit systems */
1354 assert(((GLintptr
) newblock
) % sizeof(void *) == 0);
1356 save_pointer(&n
[1], newblock
);
1357 ctx
->ListState
.CurrentBlock
= newblock
;
1358 ctx
->ListState
.CurrentPos
= 0;
1360 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1361 * we have to insert a NOP so that the payload of the real opcode lands
1362 * on an even location:
1363 * node[0] = OPCODE_NOP
1364 * node[1] = OPCODE_x;
1365 * node[2] = start of payload
1367 nopNode
= sizeof(void *) > sizeof(Node
) && align8
;
1370 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1372 assert(ctx
->ListState
.CurrentPos
% 2 == 0); /* even value */
1373 n
[0].opcode
= OPCODE_NOP
;
1375 /* The "real" opcode will now be at an odd location and the payload
1376 * will be at an even location.
1379 ctx
->ListState
.CurrentPos
+= nopNode
+ numNodes
;
1381 n
[0].opcode
= opcode
;
1389 * Allocate space for a display list instruction. Used by callers outside
1390 * this file for things like VBO vertex data.
1392 * \param opcode the instruction opcode (OPCODE_* value)
1393 * \param bytes instruction size in bytes, not counting opcode.
1394 * \return pointer to the usable data area (not including the internal
1398 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1400 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, false);
1402 return n
+ 1; /* return pointer to payload area, after opcode */
1409 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1410 * aligned in 64-bit environments, 4-byte aligned otherwise.
1413 _mesa_dlist_alloc_aligned(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1415 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, true);
1417 return n
+ 1; /* return pointer to payload area, after opcode */
1424 * This function allows modules and drivers to get their own opcodes
1425 * for extending display list functionality.
1426 * \param ctx the rendering context
1427 * \param size number of bytes for storing the new display list command
1428 * \param execute function to execute the new display list command
1429 * \param destroy function to destroy the new display list command
1430 * \param print function to print the new display list command
1431 * \return the new opcode number or -1 if error
1434 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1436 void (*execute
) (struct gl_context
*, void *),
1437 void (*destroy
) (struct gl_context
*, void *),
1438 void (*print
) (struct gl_context
*, void *, FILE *))
1440 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1441 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1442 ctx
->ListExt
->Opcode
[i
].Size
=
1443 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1444 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1445 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1446 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1447 return i
+ OPCODE_EXT_0
;
1454 * Allocate space for a display list instruction. The space is basically
1455 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1456 * function parameter, node[2] is the second parameter, etc.
1458 * \param opcode one of OPCODE_x
1459 * \param nparams number of function parameters
1460 * \return pointer to start of instruction space
1462 static inline Node
*
1463 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1465 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
), false);
1470 * Called by EndList to try to reduce memory used for the list.
1473 trim_list(struct gl_context
*ctx
)
1475 /* If the list we're ending only has one allocated block of nodes/tokens
1476 * and its size isn't a full block size, realloc the block to use less
1477 * memory. This is important for apps that create many small display
1478 * lists and apps that use glXUseXFont (many lists each containing one
1480 * Note: we currently only trim display lists that allocated one block
1481 * of tokens. That hits the short list case which is what we're mainly
1482 * concerned with. Trimming longer lists would involve traversing the
1483 * linked list of blocks.
1485 struct gl_dlist_state
*list
= &ctx
->ListState
;
1487 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1488 (list
->CurrentPos
< BLOCK_SIZE
)) {
1489 /* There's only one block and it's not full, so realloc */
1490 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1491 list
->CurrentList
->Head
=
1492 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1493 if (!list
->CurrentBlock
) {
1494 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1502 * Display List compilation functions
1504 static void GLAPIENTRY
1505 save_Accum(GLenum op
, GLfloat value
)
1507 GET_CURRENT_CONTEXT(ctx
);
1509 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1510 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1515 if (ctx
->ExecuteFlag
) {
1516 CALL_Accum(ctx
->Exec
, (op
, value
));
1521 static void GLAPIENTRY
1522 save_AlphaFunc(GLenum func
, GLclampf ref
)
1524 GET_CURRENT_CONTEXT(ctx
);
1526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1527 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1530 n
[2].f
= (GLfloat
) ref
;
1532 if (ctx
->ExecuteFlag
) {
1533 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1538 static void GLAPIENTRY
1539 save_BindTexture(GLenum target
, GLuint texture
)
1541 GET_CURRENT_CONTEXT(ctx
);
1543 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1544 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1549 if (ctx
->ExecuteFlag
) {
1550 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1555 static void GLAPIENTRY
1556 save_Bitmap(GLsizei width
, GLsizei height
,
1557 GLfloat xorig
, GLfloat yorig
,
1558 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1560 GET_CURRENT_CONTEXT(ctx
);
1562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1563 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1565 n
[1].i
= (GLint
) width
;
1566 n
[2].i
= (GLint
) height
;
1572 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1573 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1575 if (ctx
->ExecuteFlag
) {
1576 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1577 xorig
, yorig
, xmove
, ymove
, pixels
));
1582 static void GLAPIENTRY
1583 save_BlendEquation(GLenum mode
)
1585 GET_CURRENT_CONTEXT(ctx
);
1587 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1588 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1592 if (ctx
->ExecuteFlag
) {
1593 CALL_BlendEquation(ctx
->Exec
, (mode
));
1598 static void GLAPIENTRY
1599 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1601 GET_CURRENT_CONTEXT(ctx
);
1603 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1604 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1609 if (ctx
->ExecuteFlag
) {
1610 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1615 static void GLAPIENTRY
1616 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1617 GLenum sfactorA
, GLenum dfactorA
)
1619 GET_CURRENT_CONTEXT(ctx
);
1621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1622 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1624 n
[1].e
= sfactorRGB
;
1625 n
[2].e
= dfactorRGB
;
1629 if (ctx
->ExecuteFlag
) {
1630 CALL_BlendFuncSeparate(ctx
->Exec
,
1631 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1636 static void GLAPIENTRY
1637 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1639 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1643 static void GLAPIENTRY
1644 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1646 GET_CURRENT_CONTEXT(ctx
);
1648 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1649 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1656 if (ctx
->ExecuteFlag
) {
1657 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1661 /* GL_ARB_draw_buffers_blend */
1662 static void GLAPIENTRY
1663 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1664 GLenum sfactorA
, GLenum dfactorA
)
1666 GET_CURRENT_CONTEXT(ctx
);
1668 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1669 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1672 n
[2].e
= sfactorRGB
;
1673 n
[3].e
= dfactorRGB
;
1677 if (ctx
->ExecuteFlag
) {
1678 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1679 sfactorA
, dfactorA
));
1683 /* GL_ARB_draw_buffers_blend */
1684 static void GLAPIENTRY
1685 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1687 GET_CURRENT_CONTEXT(ctx
);
1689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1690 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_I
, 3);
1696 if (ctx
->ExecuteFlag
) {
1697 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1701 /* GL_ARB_draw_buffers_blend */
1702 static void GLAPIENTRY
1703 save_BlendEquationi(GLuint buf
, GLenum mode
)
1705 GET_CURRENT_CONTEXT(ctx
);
1707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1708 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1713 if (ctx
->ExecuteFlag
) {
1714 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1718 /* GL_ARB_draw_buffers_blend */
1719 static void GLAPIENTRY
1720 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1722 GET_CURRENT_CONTEXT(ctx
);
1724 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1725 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1731 if (ctx
->ExecuteFlag
) {
1732 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1737 /* GL_ARB_draw_instanced. */
1738 static void GLAPIENTRY
1739 save_DrawArraysInstancedARB(UNUSED GLenum mode
,
1741 UNUSED GLsizei count
,
1742 UNUSED GLsizei primcount
)
1744 GET_CURRENT_CONTEXT(ctx
);
1745 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1746 "glDrawArraysInstanced() during display list compile");
1749 static void GLAPIENTRY
1750 save_DrawElementsInstancedARB(UNUSED GLenum mode
,
1751 UNUSED GLsizei count
,
1753 UNUSED
const GLvoid
*indices
,
1754 UNUSED GLsizei primcount
)
1756 GET_CURRENT_CONTEXT(ctx
);
1757 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1758 "glDrawElementsInstanced() during display list compile");
1761 static void GLAPIENTRY
1762 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode
,
1763 UNUSED GLsizei count
,
1765 UNUSED
const GLvoid
*indices
,
1766 UNUSED GLsizei primcount
,
1767 UNUSED GLint basevertex
)
1769 GET_CURRENT_CONTEXT(ctx
);
1770 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1771 "glDrawElementsInstancedBaseVertex() during display list compile");
1774 /* GL_ARB_base_instance. */
1775 static void GLAPIENTRY
1776 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode
,
1778 UNUSED GLsizei count
,
1779 UNUSED GLsizei primcount
,
1780 UNUSED GLuint baseinstance
)
1782 GET_CURRENT_CONTEXT(ctx
);
1783 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1784 "glDrawArraysInstancedBaseInstance() during display list compile");
1787 static void APIENTRY
1788 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode
,
1789 UNUSED GLsizei count
,
1791 UNUSED
const void *indices
,
1792 UNUSED GLsizei primcount
,
1793 UNUSED GLuint baseinstance
)
1795 GET_CURRENT_CONTEXT(ctx
);
1796 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1797 "glDrawElementsInstancedBaseInstance() during display list compile");
1800 static void APIENTRY
1801 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode
,
1802 UNUSED GLsizei count
,
1804 UNUSED
const void *indices
,
1805 UNUSED GLsizei primcount
,
1806 UNUSED GLint basevertex
,
1807 UNUSED GLuint baseinstance
)
1809 GET_CURRENT_CONTEXT(ctx
);
1810 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1811 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1816 * While building a display list we cache some OpenGL state.
1817 * Under some circumstances we need to invalidate that state (immediately
1818 * when we start compiling a list, or after glCallList(s)).
1821 invalidate_saved_current_state(struct gl_context
*ctx
)
1825 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1826 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1828 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1829 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1831 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1833 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1837 static void GLAPIENTRY
1838 save_CallList(GLuint list
)
1840 GET_CURRENT_CONTEXT(ctx
);
1842 SAVE_FLUSH_VERTICES(ctx
);
1844 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1849 /* After this, we don't know what state we're in. Invalidate all
1850 * cached information previously gathered:
1852 invalidate_saved_current_state( ctx
);
1854 if (ctx
->ExecuteFlag
) {
1855 _mesa_CallList(list
);
1860 static void GLAPIENTRY
1861 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1863 GET_CURRENT_CONTEXT(ctx
);
1868 SAVE_FLUSH_VERTICES(ctx
);
1872 case GL_UNSIGNED_BYTE
:
1876 case GL_UNSIGNED_SHORT
:
1884 case GL_UNSIGNED_INT
:
1893 if (num
> 0 && type_size
> 0) {
1894 /* create a copy of the array of list IDs to save in the display list */
1895 lists_copy
= memdup(lists
, num
* type_size
);
1900 n
= alloc_instruction(ctx
, OPCODE_CALL_LISTS
, 2 + POINTER_DWORDS
);
1904 save_pointer(&n
[3], lists_copy
);
1907 /* After this, we don't know what state we're in. Invalidate all
1908 * cached information previously gathered:
1910 invalidate_saved_current_state( ctx
);
1912 if (ctx
->ExecuteFlag
) {
1913 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1918 static void GLAPIENTRY
1919 save_Clear(GLbitfield mask
)
1921 GET_CURRENT_CONTEXT(ctx
);
1923 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1924 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1928 if (ctx
->ExecuteFlag
) {
1929 CALL_Clear(ctx
->Exec
, (mask
));
1934 static void GLAPIENTRY
1935 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1937 GET_CURRENT_CONTEXT(ctx
);
1939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1940 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1943 n
[2].i
= drawbuffer
;
1945 if (buffer
== GL_COLOR
) {
1956 if (ctx
->ExecuteFlag
) {
1957 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1962 static void GLAPIENTRY
1963 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1965 GET_CURRENT_CONTEXT(ctx
);
1967 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1968 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1971 n
[2].i
= drawbuffer
;
1973 if (buffer
== GL_COLOR
) {
1984 if (ctx
->ExecuteFlag
) {
1985 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1990 static void GLAPIENTRY
1991 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1993 GET_CURRENT_CONTEXT(ctx
);
1995 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1996 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1999 n
[2].i
= drawbuffer
;
2001 if (buffer
== GL_COLOR
) {
2012 if (ctx
->ExecuteFlag
) {
2013 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
2018 static void GLAPIENTRY
2019 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
2020 GLfloat depth
, GLint stencil
)
2022 GET_CURRENT_CONTEXT(ctx
);
2024 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2025 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
2028 n
[2].i
= drawbuffer
;
2032 if (ctx
->ExecuteFlag
) {
2033 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
2038 static void GLAPIENTRY
2039 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
2041 GET_CURRENT_CONTEXT(ctx
);
2043 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2044 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
2051 if (ctx
->ExecuteFlag
) {
2052 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
2057 static void GLAPIENTRY
2058 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
2060 GET_CURRENT_CONTEXT(ctx
);
2062 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2063 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
2070 if (ctx
->ExecuteFlag
) {
2071 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
2076 static void GLAPIENTRY
2077 save_ClearDepth(GLclampd depth
)
2079 GET_CURRENT_CONTEXT(ctx
);
2081 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2082 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
2084 n
[1].f
= (GLfloat
) depth
;
2086 if (ctx
->ExecuteFlag
) {
2087 CALL_ClearDepth(ctx
->Exec
, (depth
));
2092 static void GLAPIENTRY
2093 save_ClearIndex(GLfloat c
)
2095 GET_CURRENT_CONTEXT(ctx
);
2097 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2098 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
2102 if (ctx
->ExecuteFlag
) {
2103 CALL_ClearIndex(ctx
->Exec
, (c
));
2108 static void GLAPIENTRY
2109 save_ClearStencil(GLint s
)
2111 GET_CURRENT_CONTEXT(ctx
);
2113 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2114 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
2118 if (ctx
->ExecuteFlag
) {
2119 CALL_ClearStencil(ctx
->Exec
, (s
));
2124 static void GLAPIENTRY
2125 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
2127 GET_CURRENT_CONTEXT(ctx
);
2129 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2130 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
2133 n
[2].f
= (GLfloat
) equ
[0];
2134 n
[3].f
= (GLfloat
) equ
[1];
2135 n
[4].f
= (GLfloat
) equ
[2];
2136 n
[5].f
= (GLfloat
) equ
[3];
2138 if (ctx
->ExecuteFlag
) {
2139 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
2145 static void GLAPIENTRY
2146 save_ColorMask(GLboolean red
, GLboolean green
,
2147 GLboolean blue
, GLboolean alpha
)
2149 GET_CURRENT_CONTEXT(ctx
);
2151 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2152 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
2159 if (ctx
->ExecuteFlag
) {
2160 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
2165 static void GLAPIENTRY
2166 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
2167 GLboolean blue
, GLboolean alpha
)
2169 GET_CURRENT_CONTEXT(ctx
);
2171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2172 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
2180 if (ctx
->ExecuteFlag
) {
2181 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2186 static void GLAPIENTRY
2187 save_ColorMaterial(GLenum face
, GLenum mode
)
2189 GET_CURRENT_CONTEXT(ctx
);
2191 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2193 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
2198 if (ctx
->ExecuteFlag
) {
2199 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
2204 static void GLAPIENTRY
2205 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
2207 GET_CURRENT_CONTEXT(ctx
);
2209 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2210 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
2214 n
[3].i
= (GLint
) width
;
2215 n
[4].i
= (GLint
) height
;
2218 if (ctx
->ExecuteFlag
) {
2219 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
2225 static void GLAPIENTRY
2226 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
2227 GLint x
, GLint y
, GLsizei width
, GLint border
)
2229 GET_CURRENT_CONTEXT(ctx
);
2231 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2232 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
2236 n
[3].e
= internalformat
;
2242 if (ctx
->ExecuteFlag
) {
2243 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
2244 x
, y
, width
, border
));
2249 static void GLAPIENTRY
2250 save_CopyTexImage2D(GLenum target
, GLint level
,
2251 GLenum internalformat
,
2252 GLint x
, GLint y
, GLsizei width
,
2253 GLsizei height
, GLint border
)
2255 GET_CURRENT_CONTEXT(ctx
);
2257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2258 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
2262 n
[3].e
= internalformat
;
2269 if (ctx
->ExecuteFlag
) {
2270 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
2271 x
, y
, width
, height
, border
));
2277 static void GLAPIENTRY
2278 save_CopyTexSubImage1D(GLenum target
, GLint level
,
2279 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
2281 GET_CURRENT_CONTEXT(ctx
);
2283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2284 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
2293 if (ctx
->ExecuteFlag
) {
2294 CALL_CopyTexSubImage1D(ctx
->Exec
,
2295 (target
, level
, xoffset
, x
, y
, width
));
2300 static void GLAPIENTRY
2301 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2302 GLint xoffset
, GLint yoffset
,
2303 GLint x
, GLint y
, GLsizei width
, GLint height
)
2305 GET_CURRENT_CONTEXT(ctx
);
2307 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2308 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2319 if (ctx
->ExecuteFlag
) {
2320 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2321 x
, y
, width
, height
));
2326 static void GLAPIENTRY
2327 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2328 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2329 GLint x
, GLint y
, GLsizei width
, GLint height
)
2331 GET_CURRENT_CONTEXT(ctx
);
2333 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2334 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2346 if (ctx
->ExecuteFlag
) {
2347 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2348 xoffset
, yoffset
, zoffset
,
2349 x
, y
, width
, height
));
2354 static void GLAPIENTRY
2355 save_CullFace(GLenum mode
)
2357 GET_CURRENT_CONTEXT(ctx
);
2359 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2360 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2364 if (ctx
->ExecuteFlag
) {
2365 CALL_CullFace(ctx
->Exec
, (mode
));
2370 static void GLAPIENTRY
2371 save_DepthFunc(GLenum func
)
2373 GET_CURRENT_CONTEXT(ctx
);
2375 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2376 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2380 if (ctx
->ExecuteFlag
) {
2381 CALL_DepthFunc(ctx
->Exec
, (func
));
2386 static void GLAPIENTRY
2387 save_DepthMask(GLboolean mask
)
2389 GET_CURRENT_CONTEXT(ctx
);
2391 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2392 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2396 if (ctx
->ExecuteFlag
) {
2397 CALL_DepthMask(ctx
->Exec
, (mask
));
2402 static void GLAPIENTRY
2403 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2405 GET_CURRENT_CONTEXT(ctx
);
2407 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2408 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2410 n
[1].f
= (GLfloat
) nearval
;
2411 n
[2].f
= (GLfloat
) farval
;
2413 if (ctx
->ExecuteFlag
) {
2414 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2419 static void GLAPIENTRY
2420 save_Disable(GLenum cap
)
2422 GET_CURRENT_CONTEXT(ctx
);
2424 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2425 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2429 if (ctx
->ExecuteFlag
) {
2430 CALL_Disable(ctx
->Exec
, (cap
));
2435 static void GLAPIENTRY
2436 save_DisableIndexed(GLuint index
, GLenum cap
)
2438 GET_CURRENT_CONTEXT(ctx
);
2440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2441 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2446 if (ctx
->ExecuteFlag
) {
2447 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2452 static void GLAPIENTRY
2453 save_DrawBuffer(GLenum mode
)
2455 GET_CURRENT_CONTEXT(ctx
);
2457 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2458 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2462 if (ctx
->ExecuteFlag
) {
2463 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2468 static void GLAPIENTRY
2469 save_DrawPixels(GLsizei width
, GLsizei height
,
2470 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2472 GET_CURRENT_CONTEXT(ctx
);
2475 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2477 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2484 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2485 pixels
, &ctx
->Unpack
));
2487 if (ctx
->ExecuteFlag
) {
2488 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2494 static void GLAPIENTRY
2495 save_Enable(GLenum cap
)
2497 GET_CURRENT_CONTEXT(ctx
);
2499 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2500 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2504 if (ctx
->ExecuteFlag
) {
2505 CALL_Enable(ctx
->Exec
, (cap
));
2511 static void GLAPIENTRY
2512 save_EnableIndexed(GLuint index
, GLenum cap
)
2514 GET_CURRENT_CONTEXT(ctx
);
2516 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2517 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2522 if (ctx
->ExecuteFlag
) {
2523 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2529 static void GLAPIENTRY
2530 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2532 GET_CURRENT_CONTEXT(ctx
);
2534 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2535 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2541 if (ctx
->ExecuteFlag
) {
2542 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2547 static void GLAPIENTRY
2548 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2550 GET_CURRENT_CONTEXT(ctx
);
2552 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2553 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2561 if (ctx
->ExecuteFlag
) {
2562 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2569 static void GLAPIENTRY
2570 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2572 GET_CURRENT_CONTEXT(ctx
);
2574 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2575 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2583 if (ctx
->ExecuteFlag
) {
2584 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2589 static void GLAPIENTRY
2590 save_Fogf(GLenum pname
, GLfloat param
)
2594 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2595 save_Fogfv(pname
, parray
);
2599 static void GLAPIENTRY
2600 save_Fogiv(GLenum pname
, const GLint
*params
)
2605 case GL_FOG_DENSITY
:
2609 p
[0] = (GLfloat
) *params
;
2615 p
[0] = INT_TO_FLOAT(params
[0]);
2616 p
[1] = INT_TO_FLOAT(params
[1]);
2617 p
[2] = INT_TO_FLOAT(params
[2]);
2618 p
[3] = INT_TO_FLOAT(params
[3]);
2621 /* Error will be caught later in gl_Fogfv */
2622 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2624 save_Fogfv(pname
, p
);
2628 static void GLAPIENTRY
2629 save_Fogi(GLenum pname
, GLint param
)
2633 parray
[1] = parray
[2] = parray
[3] = 0;
2634 save_Fogiv(pname
, parray
);
2638 static void GLAPIENTRY
2639 save_FrontFace(GLenum mode
)
2641 GET_CURRENT_CONTEXT(ctx
);
2643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2644 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2648 if (ctx
->ExecuteFlag
) {
2649 CALL_FrontFace(ctx
->Exec
, (mode
));
2654 static void GLAPIENTRY
2655 save_Frustum(GLdouble left
, GLdouble right
,
2656 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2658 GET_CURRENT_CONTEXT(ctx
);
2660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2661 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2663 n
[1].f
= (GLfloat
) left
;
2664 n
[2].f
= (GLfloat
) right
;
2665 n
[3].f
= (GLfloat
) bottom
;
2666 n
[4].f
= (GLfloat
) top
;
2667 n
[5].f
= (GLfloat
) nearval
;
2668 n
[6].f
= (GLfloat
) farval
;
2670 if (ctx
->ExecuteFlag
) {
2671 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2676 static void GLAPIENTRY
2677 save_Hint(GLenum target
, GLenum mode
)
2679 GET_CURRENT_CONTEXT(ctx
);
2681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2682 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2687 if (ctx
->ExecuteFlag
) {
2688 CALL_Hint(ctx
->Exec
, (target
, mode
));
2693 static void GLAPIENTRY
2694 save_IndexMask(GLuint mask
)
2696 GET_CURRENT_CONTEXT(ctx
);
2698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2699 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2703 if (ctx
->ExecuteFlag
) {
2704 CALL_IndexMask(ctx
->Exec
, (mask
));
2709 static void GLAPIENTRY
2710 save_InitNames(void)
2712 GET_CURRENT_CONTEXT(ctx
);
2713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2714 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2715 if (ctx
->ExecuteFlag
) {
2716 CALL_InitNames(ctx
->Exec
, ());
2721 static void GLAPIENTRY
2722 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2724 GET_CURRENT_CONTEXT(ctx
);
2726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2727 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2745 case GL_SPOT_DIRECTION
:
2748 case GL_SPOT_EXPONENT
:
2751 case GL_SPOT_CUTOFF
:
2754 case GL_CONSTANT_ATTENUATION
:
2757 case GL_LINEAR_ATTENUATION
:
2760 case GL_QUADRATIC_ATTENUATION
:
2766 for (i
= 0; i
< nParams
; i
++) {
2767 n
[3 + i
].f
= params
[i
];
2770 if (ctx
->ExecuteFlag
) {
2771 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2776 static void GLAPIENTRY
2777 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2781 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2782 save_Lightfv(light
, pname
, parray
);
2786 static void GLAPIENTRY
2787 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2794 fparam
[0] = INT_TO_FLOAT(params
[0]);
2795 fparam
[1] = INT_TO_FLOAT(params
[1]);
2796 fparam
[2] = INT_TO_FLOAT(params
[2]);
2797 fparam
[3] = INT_TO_FLOAT(params
[3]);
2800 fparam
[0] = (GLfloat
) params
[0];
2801 fparam
[1] = (GLfloat
) params
[1];
2802 fparam
[2] = (GLfloat
) params
[2];
2803 fparam
[3] = (GLfloat
) params
[3];
2805 case GL_SPOT_DIRECTION
:
2806 fparam
[0] = (GLfloat
) params
[0];
2807 fparam
[1] = (GLfloat
) params
[1];
2808 fparam
[2] = (GLfloat
) params
[2];
2810 case GL_SPOT_EXPONENT
:
2811 case GL_SPOT_CUTOFF
:
2812 case GL_CONSTANT_ATTENUATION
:
2813 case GL_LINEAR_ATTENUATION
:
2814 case GL_QUADRATIC_ATTENUATION
:
2815 fparam
[0] = (GLfloat
) params
[0];
2818 /* error will be caught later in gl_Lightfv */
2821 save_Lightfv(light
, pname
, fparam
);
2825 static void GLAPIENTRY
2826 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2830 parray
[1] = parray
[2] = parray
[3] = 0;
2831 save_Lightiv(light
, pname
, parray
);
2835 static void GLAPIENTRY
2836 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2838 GET_CURRENT_CONTEXT(ctx
);
2840 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2841 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2849 if (ctx
->ExecuteFlag
) {
2850 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2855 static void GLAPIENTRY
2856 save_LightModelf(GLenum pname
, GLfloat param
)
2860 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2861 save_LightModelfv(pname
, parray
);
2865 static void GLAPIENTRY
2866 save_LightModeliv(GLenum pname
, const GLint
*params
)
2870 case GL_LIGHT_MODEL_AMBIENT
:
2871 fparam
[0] = INT_TO_FLOAT(params
[0]);
2872 fparam
[1] = INT_TO_FLOAT(params
[1]);
2873 fparam
[2] = INT_TO_FLOAT(params
[2]);
2874 fparam
[3] = INT_TO_FLOAT(params
[3]);
2876 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2877 case GL_LIGHT_MODEL_TWO_SIDE
:
2878 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2879 fparam
[0] = (GLfloat
) params
[0];
2885 /* Error will be caught later in gl_LightModelfv */
2886 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2888 save_LightModelfv(pname
, fparam
);
2892 static void GLAPIENTRY
2893 save_LightModeli(GLenum pname
, GLint param
)
2897 parray
[1] = parray
[2] = parray
[3] = 0;
2898 save_LightModeliv(pname
, parray
);
2902 static void GLAPIENTRY
2903 save_LineStipple(GLint factor
, GLushort pattern
)
2905 GET_CURRENT_CONTEXT(ctx
);
2907 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2908 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2913 if (ctx
->ExecuteFlag
) {
2914 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2919 static void GLAPIENTRY
2920 save_LineWidth(GLfloat width
)
2922 GET_CURRENT_CONTEXT(ctx
);
2924 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2925 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2929 if (ctx
->ExecuteFlag
) {
2930 CALL_LineWidth(ctx
->Exec
, (width
));
2935 static void GLAPIENTRY
2936 save_ListBase(GLuint base
)
2938 GET_CURRENT_CONTEXT(ctx
);
2940 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2941 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2945 if (ctx
->ExecuteFlag
) {
2946 CALL_ListBase(ctx
->Exec
, (base
));
2951 static void GLAPIENTRY
2952 save_LoadIdentity(void)
2954 GET_CURRENT_CONTEXT(ctx
);
2955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2956 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2957 if (ctx
->ExecuteFlag
) {
2958 CALL_LoadIdentity(ctx
->Exec
, ());
2963 static void GLAPIENTRY
2964 save_LoadMatrixf(const GLfloat
* m
)
2966 GET_CURRENT_CONTEXT(ctx
);
2968 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2969 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2972 for (i
= 0; i
< 16; i
++) {
2976 if (ctx
->ExecuteFlag
) {
2977 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2982 static void GLAPIENTRY
2983 save_LoadMatrixd(const GLdouble
* m
)
2987 for (i
= 0; i
< 16; i
++) {
2988 f
[i
] = (GLfloat
) m
[i
];
2990 save_LoadMatrixf(f
);
2994 static void GLAPIENTRY
2995 save_LoadName(GLuint name
)
2997 GET_CURRENT_CONTEXT(ctx
);
2999 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3000 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
3004 if (ctx
->ExecuteFlag
) {
3005 CALL_LoadName(ctx
->Exec
, (name
));
3010 static void GLAPIENTRY
3011 save_LogicOp(GLenum opcode
)
3013 GET_CURRENT_CONTEXT(ctx
);
3015 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3016 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
3020 if (ctx
->ExecuteFlag
) {
3021 CALL_LogicOp(ctx
->Exec
, (opcode
));
3026 static void GLAPIENTRY
3027 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
3028 GLint order
, const GLdouble
* points
)
3030 GET_CURRENT_CONTEXT(ctx
);
3032 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3033 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
3035 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
3037 n
[2].f
= (GLfloat
) u1
;
3038 n
[3].f
= (GLfloat
) u2
;
3039 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
3041 save_pointer(&n
[6], pnts
);
3043 if (ctx
->ExecuteFlag
) {
3044 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
3048 static void GLAPIENTRY
3049 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
3050 GLint order
, const GLfloat
* points
)
3052 GET_CURRENT_CONTEXT(ctx
);
3054 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3055 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
3057 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
3061 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
3063 save_pointer(&n
[6], pnts
);
3065 if (ctx
->ExecuteFlag
) {
3066 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
3071 static void GLAPIENTRY
3072 save_Map2d(GLenum target
,
3073 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
3074 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
3075 const GLdouble
* points
)
3077 GET_CURRENT_CONTEXT(ctx
);
3079 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3080 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
3082 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
3083 vstride
, vorder
, points
);
3085 n
[2].f
= (GLfloat
) u1
;
3086 n
[3].f
= (GLfloat
) u2
;
3087 n
[4].f
= (GLfloat
) v1
;
3088 n
[5].f
= (GLfloat
) v2
;
3089 /* XXX verify these strides are correct */
3090 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
3091 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
3094 save_pointer(&n
[10], pnts
);
3096 if (ctx
->ExecuteFlag
) {
3097 CALL_Map2d(ctx
->Exec
, (target
,
3098 u1
, u2
, ustride
, uorder
,
3099 v1
, v2
, vstride
, vorder
, points
));
3104 static void GLAPIENTRY
3105 save_Map2f(GLenum target
,
3106 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
3107 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
3108 const GLfloat
* points
)
3110 GET_CURRENT_CONTEXT(ctx
);
3112 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3113 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
3115 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
3116 vstride
, vorder
, points
);
3122 /* XXX verify these strides are correct */
3123 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
3124 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
3127 save_pointer(&n
[10], pnts
);
3129 if (ctx
->ExecuteFlag
) {
3130 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
3131 v1
, v2
, vstride
, vorder
, points
));
3136 static void GLAPIENTRY
3137 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
3139 GET_CURRENT_CONTEXT(ctx
);
3141 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3142 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
3148 if (ctx
->ExecuteFlag
) {
3149 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
3154 static void GLAPIENTRY
3155 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
3157 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
3161 static void GLAPIENTRY
3162 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
3163 GLint vn
, GLfloat v1
, GLfloat v2
)
3165 GET_CURRENT_CONTEXT(ctx
);
3167 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3168 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
3177 if (ctx
->ExecuteFlag
) {
3178 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
3184 static void GLAPIENTRY
3185 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
3186 GLint vn
, GLdouble v1
, GLdouble v2
)
3188 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
3189 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
3193 static void GLAPIENTRY
3194 save_MatrixMode(GLenum mode
)
3196 GET_CURRENT_CONTEXT(ctx
);
3198 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3199 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
3203 if (ctx
->ExecuteFlag
) {
3204 CALL_MatrixMode(ctx
->Exec
, (mode
));
3209 static void GLAPIENTRY
3210 save_MultMatrixf(const GLfloat
* m
)
3212 GET_CURRENT_CONTEXT(ctx
);
3214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3215 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
3218 for (i
= 0; i
< 16; i
++) {
3222 if (ctx
->ExecuteFlag
) {
3223 CALL_MultMatrixf(ctx
->Exec
, (m
));
3228 static void GLAPIENTRY
3229 save_MultMatrixd(const GLdouble
* m
)
3233 for (i
= 0; i
< 16; i
++) {
3234 f
[i
] = (GLfloat
) m
[i
];
3236 save_MultMatrixf(f
);
3240 static void GLAPIENTRY
3241 save_NewList(GLuint name
, GLenum mode
)
3243 GET_CURRENT_CONTEXT(ctx
);
3244 /* It's an error to call this function while building a display list */
3245 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
3252 static void GLAPIENTRY
3253 save_Ortho(GLdouble left
, GLdouble right
,
3254 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
3256 GET_CURRENT_CONTEXT(ctx
);
3258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3259 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
3261 n
[1].f
= (GLfloat
) left
;
3262 n
[2].f
= (GLfloat
) right
;
3263 n
[3].f
= (GLfloat
) bottom
;
3264 n
[4].f
= (GLfloat
) top
;
3265 n
[5].f
= (GLfloat
) nearval
;
3266 n
[6].f
= (GLfloat
) farval
;
3268 if (ctx
->ExecuteFlag
) {
3269 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
3274 static void GLAPIENTRY
3275 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
3277 GET_CURRENT_CONTEXT(ctx
);
3279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3280 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
3284 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
3286 if (ctx
->ExecuteFlag
) {
3287 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
3292 static void GLAPIENTRY
3293 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
3295 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3297 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3298 for (i
= 0; i
< mapsize
; i
++) {
3299 fvalues
[i
] = (GLfloat
) values
[i
];
3303 for (i
= 0; i
< mapsize
; i
++) {
3304 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3307 save_PixelMapfv(map
, mapsize
, fvalues
);
3311 static void GLAPIENTRY
3312 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3314 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3316 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3317 for (i
= 0; i
< mapsize
; i
++) {
3318 fvalues
[i
] = (GLfloat
) values
[i
];
3322 for (i
= 0; i
< mapsize
; i
++) {
3323 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3326 save_PixelMapfv(map
, mapsize
, fvalues
);
3330 static void GLAPIENTRY
3331 save_PixelTransferf(GLenum pname
, GLfloat param
)
3333 GET_CURRENT_CONTEXT(ctx
);
3335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3336 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3341 if (ctx
->ExecuteFlag
) {
3342 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3347 static void GLAPIENTRY
3348 save_PixelTransferi(GLenum pname
, GLint param
)
3350 save_PixelTransferf(pname
, (GLfloat
) param
);
3354 static void GLAPIENTRY
3355 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3357 GET_CURRENT_CONTEXT(ctx
);
3359 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3360 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3365 if (ctx
->ExecuteFlag
) {
3366 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3371 static void GLAPIENTRY
3372 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3374 GET_CURRENT_CONTEXT(ctx
);
3376 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3377 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3384 if (ctx
->ExecuteFlag
) {
3385 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3390 static void GLAPIENTRY
3391 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3395 parray
[1] = parray
[2] = 0.0F
;
3396 save_PointParameterfvEXT(pname
, parray
);
3399 static void GLAPIENTRY
3400 save_PointParameteriNV(GLenum pname
, GLint param
)
3403 parray
[0] = (GLfloat
) param
;
3404 parray
[1] = parray
[2] = 0.0F
;
3405 save_PointParameterfvEXT(pname
, parray
);
3408 static void GLAPIENTRY
3409 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3412 parray
[0] = (GLfloat
) param
[0];
3413 parray
[1] = parray
[2] = 0.0F
;
3414 save_PointParameterfvEXT(pname
, parray
);
3418 static void GLAPIENTRY
3419 save_PointSize(GLfloat size
)
3421 GET_CURRENT_CONTEXT(ctx
);
3423 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3424 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3428 if (ctx
->ExecuteFlag
) {
3429 CALL_PointSize(ctx
->Exec
, (size
));
3434 static void GLAPIENTRY
3435 save_PolygonMode(GLenum face
, GLenum mode
)
3437 GET_CURRENT_CONTEXT(ctx
);
3439 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3440 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3445 if (ctx
->ExecuteFlag
) {
3446 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3451 static void GLAPIENTRY
3452 save_PolygonStipple(const GLubyte
* pattern
)
3454 GET_CURRENT_CONTEXT(ctx
);
3457 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3459 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3462 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3463 pattern
, &ctx
->Unpack
));
3465 if (ctx
->ExecuteFlag
) {
3466 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3471 static void GLAPIENTRY
3472 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3474 GET_CURRENT_CONTEXT(ctx
);
3476 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3477 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3482 if (ctx
->ExecuteFlag
) {
3483 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3488 static void GLAPIENTRY
3489 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3491 GET_CURRENT_CONTEXT(ctx
);
3492 /* XXX mult by DepthMaxF here??? */
3493 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3496 static void GLAPIENTRY
3497 save_PolygonOffsetClampEXT(GLfloat factor
, GLfloat units
, GLfloat clamp
)
3499 GET_CURRENT_CONTEXT(ctx
);
3501 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3502 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET_CLAMP
, 3);
3508 if (ctx
->ExecuteFlag
) {
3509 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (factor
, units
, clamp
));
3513 static void GLAPIENTRY
3514 save_PopAttrib(void)
3516 GET_CURRENT_CONTEXT(ctx
);
3517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3518 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3519 if (ctx
->ExecuteFlag
) {
3520 CALL_PopAttrib(ctx
->Exec
, ());
3525 static void GLAPIENTRY
3526 save_PopMatrix(void)
3528 GET_CURRENT_CONTEXT(ctx
);
3529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3530 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3531 if (ctx
->ExecuteFlag
) {
3532 CALL_PopMatrix(ctx
->Exec
, ());
3537 static void GLAPIENTRY
3540 GET_CURRENT_CONTEXT(ctx
);
3541 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3542 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3543 if (ctx
->ExecuteFlag
) {
3544 CALL_PopName(ctx
->Exec
, ());
3549 static void GLAPIENTRY
3550 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3551 const GLclampf
* priorities
)
3553 GET_CURRENT_CONTEXT(ctx
);
3555 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3557 for (i
= 0; i
< num
; i
++) {
3559 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3561 n
[1].ui
= textures
[i
];
3562 n
[2].f
= priorities
[i
];
3565 if (ctx
->ExecuteFlag
) {
3566 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3571 static void GLAPIENTRY
3572 save_PushAttrib(GLbitfield mask
)
3574 GET_CURRENT_CONTEXT(ctx
);
3576 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3577 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3581 if (ctx
->ExecuteFlag
) {
3582 CALL_PushAttrib(ctx
->Exec
, (mask
));
3587 static void GLAPIENTRY
3588 save_PushMatrix(void)
3590 GET_CURRENT_CONTEXT(ctx
);
3591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3592 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3593 if (ctx
->ExecuteFlag
) {
3594 CALL_PushMatrix(ctx
->Exec
, ());
3599 static void GLAPIENTRY
3600 save_PushName(GLuint name
)
3602 GET_CURRENT_CONTEXT(ctx
);
3604 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3605 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3609 if (ctx
->ExecuteFlag
) {
3610 CALL_PushName(ctx
->Exec
, (name
));
3615 static void GLAPIENTRY
3616 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3618 GET_CURRENT_CONTEXT(ctx
);
3620 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3621 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3628 if (ctx
->ExecuteFlag
) {
3629 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3633 static void GLAPIENTRY
3634 save_RasterPos2d(GLdouble x
, GLdouble y
)
3636 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3639 static void GLAPIENTRY
3640 save_RasterPos2f(GLfloat x
, GLfloat y
)
3642 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3645 static void GLAPIENTRY
3646 save_RasterPos2i(GLint x
, GLint y
)
3648 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3651 static void GLAPIENTRY
3652 save_RasterPos2s(GLshort x
, GLshort y
)
3654 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3657 static void GLAPIENTRY
3658 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3660 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3663 static void GLAPIENTRY
3664 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3666 save_RasterPos4f(x
, y
, z
, 1.0F
);
3669 static void GLAPIENTRY
3670 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3672 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3675 static void GLAPIENTRY
3676 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3678 save_RasterPos4f(x
, y
, z
, 1.0F
);
3681 static void GLAPIENTRY
3682 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3684 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3687 static void GLAPIENTRY
3688 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3690 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3693 static void GLAPIENTRY
3694 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3696 save_RasterPos4f(x
, y
, z
, w
);
3699 static void GLAPIENTRY
3700 save_RasterPos2dv(const GLdouble
* v
)
3702 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3705 static void GLAPIENTRY
3706 save_RasterPos2fv(const GLfloat
* v
)
3708 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3711 static void GLAPIENTRY
3712 save_RasterPos2iv(const GLint
* v
)
3714 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3717 static void GLAPIENTRY
3718 save_RasterPos2sv(const GLshort
* v
)
3720 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3723 static void GLAPIENTRY
3724 save_RasterPos3dv(const GLdouble
* v
)
3726 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3729 static void GLAPIENTRY
3730 save_RasterPos3fv(const GLfloat
* v
)
3732 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3735 static void GLAPIENTRY
3736 save_RasterPos3iv(const GLint
* v
)
3738 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3741 static void GLAPIENTRY
3742 save_RasterPos3sv(const GLshort
* v
)
3744 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3747 static void GLAPIENTRY
3748 save_RasterPos4dv(const GLdouble
* v
)
3750 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3751 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3754 static void GLAPIENTRY
3755 save_RasterPos4fv(const GLfloat
* v
)
3757 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3760 static void GLAPIENTRY
3761 save_RasterPos4iv(const GLint
* v
)
3763 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3764 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3767 static void GLAPIENTRY
3768 save_RasterPos4sv(const GLshort
* v
)
3770 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3774 static void GLAPIENTRY
3775 save_PassThrough(GLfloat token
)
3777 GET_CURRENT_CONTEXT(ctx
);
3779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3780 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3784 if (ctx
->ExecuteFlag
) {
3785 CALL_PassThrough(ctx
->Exec
, (token
));
3790 static void GLAPIENTRY
3791 save_ReadBuffer(GLenum mode
)
3793 GET_CURRENT_CONTEXT(ctx
);
3795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3796 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3800 if (ctx
->ExecuteFlag
) {
3801 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3806 static void GLAPIENTRY
3807 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3809 GET_CURRENT_CONTEXT(ctx
);
3811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3812 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3819 if (ctx
->ExecuteFlag
) {
3820 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3825 static void GLAPIENTRY
3826 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3828 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3832 static void GLAPIENTRY
3833 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3835 GET_CURRENT_CONTEXT(ctx
);
3837 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3838 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3844 if (ctx
->ExecuteFlag
) {
3845 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3850 static void GLAPIENTRY
3851 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3853 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3857 static void GLAPIENTRY
3858 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3860 GET_CURRENT_CONTEXT(ctx
);
3862 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3863 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3870 if (ctx
->ExecuteFlag
) {
3871 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3876 static void GLAPIENTRY
3877 save_ShadeModel(GLenum mode
)
3879 GET_CURRENT_CONTEXT(ctx
);
3881 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3883 if (ctx
->ExecuteFlag
) {
3884 CALL_ShadeModel(ctx
->Exec
, (mode
));
3887 /* Don't compile this call if it's a no-op.
3888 * By avoiding this state change we have a better chance of
3889 * coalescing subsequent drawing commands into one batch.
3891 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3894 SAVE_FLUSH_VERTICES(ctx
);
3896 ctx
->ListState
.Current
.ShadeModel
= mode
;
3898 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3905 static void GLAPIENTRY
3906 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3908 GET_CURRENT_CONTEXT(ctx
);
3910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3911 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3917 if (ctx
->ExecuteFlag
) {
3918 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3923 static void GLAPIENTRY
3924 save_StencilMask(GLuint mask
)
3926 GET_CURRENT_CONTEXT(ctx
);
3928 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3929 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3933 if (ctx
->ExecuteFlag
) {
3934 CALL_StencilMask(ctx
->Exec
, (mask
));
3939 static void GLAPIENTRY
3940 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3942 GET_CURRENT_CONTEXT(ctx
);
3944 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3945 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3951 if (ctx
->ExecuteFlag
) {
3952 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3957 static void GLAPIENTRY
3958 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3960 GET_CURRENT_CONTEXT(ctx
);
3962 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3963 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3970 if (ctx
->ExecuteFlag
) {
3971 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3976 static void GLAPIENTRY
3977 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3980 GET_CURRENT_CONTEXT(ctx
);
3982 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3984 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3992 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3999 if (ctx
->ExecuteFlag
) {
4000 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
4001 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
4006 static void GLAPIENTRY
4007 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
4009 GET_CURRENT_CONTEXT(ctx
);
4011 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4012 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
4017 if (ctx
->ExecuteFlag
) {
4018 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
4023 static void GLAPIENTRY
4024 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
4026 GET_CURRENT_CONTEXT(ctx
);
4028 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4029 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
4036 if (ctx
->ExecuteFlag
) {
4037 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
4042 static void GLAPIENTRY
4043 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4045 GET_CURRENT_CONTEXT(ctx
);
4047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4048 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
4052 if (pname
== GL_TEXTURE_ENV_COLOR
) {
4060 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
4063 if (ctx
->ExecuteFlag
) {
4064 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
4069 static void GLAPIENTRY
4070 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
4073 parray
[0] = (GLfloat
) param
;
4074 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4075 save_TexEnvfv(target
, pname
, parray
);
4079 static void GLAPIENTRY
4080 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
4083 p
[0] = (GLfloat
) param
;
4084 p
[1] = p
[2] = p
[3] = 0.0F
;
4085 save_TexEnvfv(target
, pname
, p
);
4089 static void GLAPIENTRY
4090 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
4093 if (pname
== GL_TEXTURE_ENV_COLOR
) {
4094 p
[0] = INT_TO_FLOAT(param
[0]);
4095 p
[1] = INT_TO_FLOAT(param
[1]);
4096 p
[2] = INT_TO_FLOAT(param
[2]);
4097 p
[3] = INT_TO_FLOAT(param
[3]);
4100 p
[0] = (GLfloat
) param
[0];
4101 p
[1] = p
[2] = p
[3] = 0.0F
;
4103 save_TexEnvfv(target
, pname
, p
);
4107 static void GLAPIENTRY
4108 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
4110 GET_CURRENT_CONTEXT(ctx
);
4112 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4113 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
4122 if (ctx
->ExecuteFlag
) {
4123 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
4128 static void GLAPIENTRY
4129 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
4132 p
[0] = (GLfloat
) params
[0];
4133 p
[1] = (GLfloat
) params
[1];
4134 p
[2] = (GLfloat
) params
[2];
4135 p
[3] = (GLfloat
) params
[3];
4136 save_TexGenfv(coord
, pname
, p
);
4140 static void GLAPIENTRY
4141 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
4144 parray
[0] = (GLfloat
) param
;
4145 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4146 save_TexGenfv(coord
, pname
, parray
);
4150 static void GLAPIENTRY
4151 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
4154 p
[0] = (GLfloat
) params
[0];
4155 p
[1] = (GLfloat
) params
[1];
4156 p
[2] = (GLfloat
) params
[2];
4157 p
[3] = (GLfloat
) params
[3];
4158 save_TexGenfv(coord
, pname
, p
);
4162 static void GLAPIENTRY
4163 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
4167 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4168 save_TexGenfv(coord
, pname
, parray
);
4172 static void GLAPIENTRY
4173 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
4177 parray
[1] = parray
[2] = parray
[3] = 0;
4178 save_TexGeniv(coord
, pname
, parray
);
4182 static void GLAPIENTRY
4183 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4185 GET_CURRENT_CONTEXT(ctx
);
4187 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4188 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
4197 if (ctx
->ExecuteFlag
) {
4198 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
4203 static void GLAPIENTRY
4204 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
4208 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4209 save_TexParameterfv(target
, pname
, parray
);
4213 static void GLAPIENTRY
4214 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
4217 fparam
[0] = (GLfloat
) param
;
4218 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4219 save_TexParameterfv(target
, pname
, fparam
);
4223 static void GLAPIENTRY
4224 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
4227 fparam
[0] = (GLfloat
) params
[0];
4228 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4229 save_TexParameterfv(target
, pname
, fparam
);
4233 static void GLAPIENTRY
4234 save_TexImage1D(GLenum target
,
4235 GLint level
, GLint components
,
4236 GLsizei width
, GLint border
,
4237 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4239 GET_CURRENT_CONTEXT(ctx
);
4240 if (target
== GL_PROXY_TEXTURE_1D
) {
4241 /* don't compile, execute immediately */
4242 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4243 border
, format
, type
, pixels
));
4247 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4248 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
4252 n
[3].i
= components
;
4253 n
[4].i
= (GLint
) width
;
4258 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4259 pixels
, &ctx
->Unpack
));
4261 if (ctx
->ExecuteFlag
) {
4262 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4263 border
, format
, type
, pixels
));
4269 static void GLAPIENTRY
4270 save_TexImage2D(GLenum target
,
4271 GLint level
, GLint components
,
4272 GLsizei width
, GLsizei height
, GLint border
,
4273 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4275 GET_CURRENT_CONTEXT(ctx
);
4276 if (target
== GL_PROXY_TEXTURE_2D
) {
4277 /* don't compile, execute immediately */
4278 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4279 height
, border
, format
, type
, pixels
));
4283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4284 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
4288 n
[3].i
= components
;
4289 n
[4].i
= (GLint
) width
;
4290 n
[5].i
= (GLint
) height
;
4295 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4296 pixels
, &ctx
->Unpack
));
4298 if (ctx
->ExecuteFlag
) {
4299 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4300 height
, border
, format
, type
, pixels
));
4306 static void GLAPIENTRY
4307 save_TexImage3D(GLenum target
,
4308 GLint level
, GLint internalFormat
,
4309 GLsizei width
, GLsizei height
, GLsizei depth
,
4311 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4313 GET_CURRENT_CONTEXT(ctx
);
4314 if (target
== GL_PROXY_TEXTURE_3D
) {
4315 /* don't compile, execute immediately */
4316 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4317 height
, depth
, border
, format
, type
,
4322 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4323 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
4327 n
[3].i
= (GLint
) internalFormat
;
4328 n
[4].i
= (GLint
) width
;
4329 n
[5].i
= (GLint
) height
;
4330 n
[6].i
= (GLint
) depth
;
4334 save_pointer(&n
[10],
4335 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4336 pixels
, &ctx
->Unpack
));
4338 if (ctx
->ExecuteFlag
) {
4339 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4340 height
, depth
, border
, format
, type
,
4347 static void GLAPIENTRY
4348 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4349 GLsizei width
, GLenum format
, GLenum type
,
4350 const GLvoid
* pixels
)
4352 GET_CURRENT_CONTEXT(ctx
);
4355 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4357 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
4362 n
[4].i
= (GLint
) width
;
4366 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4367 pixels
, &ctx
->Unpack
));
4369 if (ctx
->ExecuteFlag
) {
4370 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4371 format
, type
, pixels
));
4376 static void GLAPIENTRY
4377 save_TexSubImage2D(GLenum target
, GLint level
,
4378 GLint xoffset
, GLint yoffset
,
4379 GLsizei width
, GLsizei height
,
4380 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4382 GET_CURRENT_CONTEXT(ctx
);
4385 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4387 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
4393 n
[5].i
= (GLint
) width
;
4394 n
[6].i
= (GLint
) height
;
4398 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4399 pixels
, &ctx
->Unpack
));
4401 if (ctx
->ExecuteFlag
) {
4402 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4403 width
, height
, format
, type
, pixels
));
4408 static void GLAPIENTRY
4409 save_TexSubImage3D(GLenum target
, GLint level
,
4410 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4411 GLsizei width
, GLsizei height
, GLsizei depth
,
4412 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4414 GET_CURRENT_CONTEXT(ctx
);
4417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4419 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4426 n
[6].i
= (GLint
) width
;
4427 n
[7].i
= (GLint
) height
;
4428 n
[8].i
= (GLint
) depth
;
4431 save_pointer(&n
[11],
4432 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4433 pixels
, &ctx
->Unpack
));
4435 if (ctx
->ExecuteFlag
) {
4436 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4437 xoffset
, yoffset
, zoffset
,
4438 width
, height
, depth
, format
, type
,
4444 static void GLAPIENTRY
4445 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4447 GET_CURRENT_CONTEXT(ctx
);
4449 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4450 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4456 if (ctx
->ExecuteFlag
) {
4457 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4462 static void GLAPIENTRY
4463 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4465 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4470 static void GLAPIENTRY
4471 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4473 GET_CURRENT_CONTEXT(ctx
);
4475 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4476 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4480 n
[3].i
= (GLint
) width
;
4481 n
[4].i
= (GLint
) height
;
4483 if (ctx
->ExecuteFlag
) {
4484 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4489 static void GLAPIENTRY
4490 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4492 GET_CURRENT_CONTEXT(ctx
);
4494 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4495 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4502 if (ctx
->ExecuteFlag
) {
4503 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4507 static void GLAPIENTRY
4508 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4510 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4513 static void GLAPIENTRY
4514 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4516 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4519 static void GLAPIENTRY
4520 save_WindowPos2iMESA(GLint x
, GLint y
)
4522 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4525 static void GLAPIENTRY
4526 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4528 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4531 static void GLAPIENTRY
4532 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4534 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4537 static void GLAPIENTRY
4538 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4540 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4543 static void GLAPIENTRY
4544 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4546 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4549 static void GLAPIENTRY
4550 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4552 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4555 static void GLAPIENTRY
4556 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4558 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4561 static void GLAPIENTRY
4562 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4564 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4567 static void GLAPIENTRY
4568 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4570 save_WindowPos4fMESA(x
, y
, z
, w
);
4573 static void GLAPIENTRY
4574 save_WindowPos2dvMESA(const GLdouble
* v
)
4576 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4579 static void GLAPIENTRY
4580 save_WindowPos2fvMESA(const GLfloat
* v
)
4582 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4585 static void GLAPIENTRY
4586 save_WindowPos2ivMESA(const GLint
* v
)
4588 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4591 static void GLAPIENTRY
4592 save_WindowPos2svMESA(const GLshort
* v
)
4594 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4597 static void GLAPIENTRY
4598 save_WindowPos3dvMESA(const GLdouble
* v
)
4600 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4603 static void GLAPIENTRY
4604 save_WindowPos3fvMESA(const GLfloat
* v
)
4606 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4609 static void GLAPIENTRY
4610 save_WindowPos3ivMESA(const GLint
* v
)
4612 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4615 static void GLAPIENTRY
4616 save_WindowPos3svMESA(const GLshort
* v
)
4618 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4621 static void GLAPIENTRY
4622 save_WindowPos4dvMESA(const GLdouble
* v
)
4624 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4625 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4628 static void GLAPIENTRY
4629 save_WindowPos4fvMESA(const GLfloat
* v
)
4631 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4634 static void GLAPIENTRY
4635 save_WindowPos4ivMESA(const GLint
* v
)
4637 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4638 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4641 static void GLAPIENTRY
4642 save_WindowPos4svMESA(const GLshort
* v
)
4644 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4649 /* GL_ARB_multitexture */
4650 static void GLAPIENTRY
4651 save_ActiveTextureARB(GLenum target
)
4653 GET_CURRENT_CONTEXT(ctx
);
4655 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4656 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4660 if (ctx
->ExecuteFlag
) {
4661 CALL_ActiveTexture(ctx
->Exec
, (target
));
4666 /* GL_ARB_transpose_matrix */
4668 static void GLAPIENTRY
4669 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4672 _math_transposefd(tm
, m
);
4673 save_LoadMatrixf(tm
);
4677 static void GLAPIENTRY
4678 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4681 _math_transposef(tm
, m
);
4682 save_LoadMatrixf(tm
);
4686 static void GLAPIENTRY
4687 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4690 _math_transposefd(tm
, m
);
4691 save_MultMatrixf(tm
);
4695 static void GLAPIENTRY
4696 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4699 _math_transposef(tm
, m
);
4700 save_MultMatrixf(tm
);
4703 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4705 GET_CURRENT_CONTEXT(ctx
);
4711 image
= malloc(size
);
4713 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4716 memcpy(image
, data
, size
);
4722 /* GL_ARB_texture_compression */
4723 static void GLAPIENTRY
4724 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4725 GLenum internalFormat
, GLsizei width
,
4726 GLint border
, GLsizei imageSize
,
4727 const GLvoid
* data
)
4729 GET_CURRENT_CONTEXT(ctx
);
4730 if (target
== GL_PROXY_TEXTURE_1D
) {
4731 /* don't compile, execute immediately */
4732 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4733 width
, border
, imageSize
,
4738 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4740 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4741 6 + POINTER_DWORDS
);
4745 n
[3].e
= internalFormat
;
4746 n
[4].i
= (GLint
) width
;
4750 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4752 if (ctx
->ExecuteFlag
) {
4753 CALL_CompressedTexImage1D(ctx
->Exec
,
4754 (target
, level
, internalFormat
, width
,
4755 border
, imageSize
, data
));
4761 static void GLAPIENTRY
4762 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4763 GLenum internalFormat
, GLsizei width
,
4764 GLsizei height
, GLint border
, GLsizei imageSize
,
4765 const GLvoid
* data
)
4767 GET_CURRENT_CONTEXT(ctx
);
4768 if (target
== GL_PROXY_TEXTURE_2D
) {
4769 /* don't compile, execute immediately */
4770 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4771 width
, height
, border
,
4776 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4778 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4779 7 + POINTER_DWORDS
);
4783 n
[3].e
= internalFormat
;
4784 n
[4].i
= (GLint
) width
;
4785 n
[5].i
= (GLint
) height
;
4789 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4791 if (ctx
->ExecuteFlag
) {
4792 CALL_CompressedTexImage2D(ctx
->Exec
,
4793 (target
, level
, internalFormat
, width
,
4794 height
, border
, imageSize
, data
));
4800 static void GLAPIENTRY
4801 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4802 GLenum internalFormat
, GLsizei width
,
4803 GLsizei height
, GLsizei depth
, GLint border
,
4804 GLsizei imageSize
, const GLvoid
* data
)
4806 GET_CURRENT_CONTEXT(ctx
);
4807 if (target
== GL_PROXY_TEXTURE_3D
) {
4808 /* don't compile, execute immediately */
4809 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4810 width
, height
, depth
, border
,
4815 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4817 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4818 8 + POINTER_DWORDS
);
4822 n
[3].e
= internalFormat
;
4823 n
[4].i
= (GLint
) width
;
4824 n
[5].i
= (GLint
) height
;
4825 n
[6].i
= (GLint
) depth
;
4829 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4831 if (ctx
->ExecuteFlag
) {
4832 CALL_CompressedTexImage3D(ctx
->Exec
,
4833 (target
, level
, internalFormat
, width
,
4834 height
, depth
, border
, imageSize
,
4841 static void GLAPIENTRY
4842 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4843 GLsizei width
, GLenum format
,
4844 GLsizei imageSize
, const GLvoid
* data
)
4847 GET_CURRENT_CONTEXT(ctx
);
4848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4850 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4851 6 + POINTER_DWORDS
);
4856 n
[4].i
= (GLint
) width
;
4860 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4862 if (ctx
->ExecuteFlag
) {
4863 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4864 width
, format
, imageSize
,
4870 static void GLAPIENTRY
4871 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4872 GLint yoffset
, GLsizei width
, GLsizei height
,
4873 GLenum format
, GLsizei imageSize
,
4874 const GLvoid
* data
)
4877 GET_CURRENT_CONTEXT(ctx
);
4878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4880 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4881 8 + POINTER_DWORDS
);
4887 n
[5].i
= (GLint
) width
;
4888 n
[6].i
= (GLint
) height
;
4892 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4894 if (ctx
->ExecuteFlag
) {
4895 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4896 (target
, level
, xoffset
, yoffset
, width
,
4897 height
, format
, imageSize
, data
));
4902 static void GLAPIENTRY
4903 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4904 GLint yoffset
, GLint zoffset
, GLsizei width
,
4905 GLsizei height
, GLsizei depth
, GLenum format
,
4906 GLsizei imageSize
, const GLvoid
* data
)
4909 GET_CURRENT_CONTEXT(ctx
);
4910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4912 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4913 10 + POINTER_DWORDS
);
4920 n
[6].i
= (GLint
) width
;
4921 n
[7].i
= (GLint
) height
;
4922 n
[8].i
= (GLint
) depth
;
4924 n
[10].i
= imageSize
;
4925 save_pointer(&n
[11],
4926 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4928 if (ctx
->ExecuteFlag
) {
4929 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4930 (target
, level
, xoffset
, yoffset
,
4931 zoffset
, width
, height
, depth
, format
,
4937 /* GL_ARB_multisample */
4938 static void GLAPIENTRY
4939 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4941 GET_CURRENT_CONTEXT(ctx
);
4943 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4944 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4949 if (ctx
->ExecuteFlag
) {
4950 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4956 * GL_ARB_vertex_program
4958 static void GLAPIENTRY
4959 save_BindProgramARB(GLenum target
, GLuint id
)
4961 GET_CURRENT_CONTEXT(ctx
);
4963 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4964 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_ARB
, 2);
4969 if (ctx
->ExecuteFlag
) {
4970 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4974 static void GLAPIENTRY
4975 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4976 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4978 GET_CURRENT_CONTEXT(ctx
);
4980 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4981 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4990 if (ctx
->ExecuteFlag
) {
4991 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4996 static void GLAPIENTRY
4997 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4998 const GLfloat
*params
)
5000 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
5001 params
[2], params
[3]);
5005 static void GLAPIENTRY
5006 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
5007 const GLfloat
* params
)
5009 GET_CURRENT_CONTEXT(ctx
);
5011 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5015 const GLfloat
* p
= params
;
5017 for (i
= 0 ; i
< count
; i
++) {
5018 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
5031 if (ctx
->ExecuteFlag
) {
5032 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5037 static void GLAPIENTRY
5038 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
5039 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
5041 save_ProgramEnvParameter4fARB(target
, index
,
5043 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
5047 static void GLAPIENTRY
5048 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
5049 const GLdouble
*params
)
5051 save_ProgramEnvParameter4fARB(target
, index
,
5052 (GLfloat
) params
[0],
5053 (GLfloat
) params
[1],
5054 (GLfloat
) params
[2], (GLfloat
) params
[3]);
5058 static void GLAPIENTRY
5059 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
5060 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5062 GET_CURRENT_CONTEXT(ctx
);
5064 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5065 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5074 if (ctx
->ExecuteFlag
) {
5075 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5080 static void GLAPIENTRY
5081 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
5082 const GLfloat
*params
)
5084 GET_CURRENT_CONTEXT(ctx
);
5086 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5087 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5096 if (ctx
->ExecuteFlag
) {
5097 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
5102 static void GLAPIENTRY
5103 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
5104 const GLfloat
*params
)
5106 GET_CURRENT_CONTEXT(ctx
);
5108 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5112 const GLfloat
* p
= params
;
5114 for (i
= 0 ; i
< count
; i
++) {
5115 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5128 if (ctx
->ExecuteFlag
) {
5129 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5134 static void GLAPIENTRY
5135 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
5136 GLdouble x
, GLdouble y
,
5137 GLdouble z
, GLdouble w
)
5139 GET_CURRENT_CONTEXT(ctx
);
5141 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5142 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5146 n
[3].f
= (GLfloat
) x
;
5147 n
[4].f
= (GLfloat
) y
;
5148 n
[5].f
= (GLfloat
) z
;
5149 n
[6].f
= (GLfloat
) w
;
5151 if (ctx
->ExecuteFlag
) {
5152 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5157 static void GLAPIENTRY
5158 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
5159 const GLdouble
*params
)
5161 GET_CURRENT_CONTEXT(ctx
);
5163 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5164 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5168 n
[3].f
= (GLfloat
) params
[0];
5169 n
[4].f
= (GLfloat
) params
[1];
5170 n
[5].f
= (GLfloat
) params
[2];
5171 n
[6].f
= (GLfloat
) params
[3];
5173 if (ctx
->ExecuteFlag
) {
5174 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
5179 /* GL_EXT_stencil_two_side */
5180 static void GLAPIENTRY
5181 save_ActiveStencilFaceEXT(GLenum face
)
5183 GET_CURRENT_CONTEXT(ctx
);
5185 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5186 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
5190 if (ctx
->ExecuteFlag
) {
5191 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
5196 /* GL_EXT_depth_bounds_test */
5197 static void GLAPIENTRY
5198 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
5200 GET_CURRENT_CONTEXT(ctx
);
5202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5203 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
5205 n
[1].f
= (GLfloat
) zmin
;
5206 n
[2].f
= (GLfloat
) zmax
;
5208 if (ctx
->ExecuteFlag
) {
5209 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
5215 static void GLAPIENTRY
5216 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
5217 const GLvoid
* string
)
5219 GET_CURRENT_CONTEXT(ctx
);
5222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5224 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
5226 GLubyte
*programCopy
= malloc(len
);
5228 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
5231 memcpy(programCopy
, string
, len
);
5235 save_pointer(&n
[4], programCopy
);
5237 if (ctx
->ExecuteFlag
) {
5238 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
5243 static void GLAPIENTRY
5244 save_BeginQueryARB(GLenum target
, GLuint id
)
5246 GET_CURRENT_CONTEXT(ctx
);
5248 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5249 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
5254 if (ctx
->ExecuteFlag
) {
5255 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
5259 static void GLAPIENTRY
5260 save_EndQueryARB(GLenum target
)
5262 GET_CURRENT_CONTEXT(ctx
);
5264 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5265 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
5269 if (ctx
->ExecuteFlag
) {
5270 CALL_EndQuery(ctx
->Exec
, (target
));
5274 static void GLAPIENTRY
5275 save_QueryCounter(GLuint id
, GLenum target
)
5277 GET_CURRENT_CONTEXT(ctx
);
5279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5280 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
5285 if (ctx
->ExecuteFlag
) {
5286 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
5290 static void GLAPIENTRY
5291 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
5293 GET_CURRENT_CONTEXT(ctx
);
5295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5296 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
5302 if (ctx
->ExecuteFlag
) {
5303 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5307 static void GLAPIENTRY
5308 save_EndQueryIndexed(GLenum target
, GLuint index
)
5310 GET_CURRENT_CONTEXT(ctx
);
5312 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5313 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5318 if (ctx
->ExecuteFlag
) {
5319 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5324 static void GLAPIENTRY
5325 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5327 GET_CURRENT_CONTEXT(ctx
);
5329 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5330 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5334 if (count
> MAX_DRAW_BUFFERS
)
5335 count
= MAX_DRAW_BUFFERS
;
5336 for (i
= 0; i
< count
; i
++) {
5337 n
[2 + i
].e
= buffers
[i
];
5340 if (ctx
->ExecuteFlag
) {
5341 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5345 static void GLAPIENTRY
5346 save_BindFragmentShaderATI(GLuint id
)
5348 GET_CURRENT_CONTEXT(ctx
);
5351 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5355 if (ctx
->ExecuteFlag
) {
5356 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5360 static void GLAPIENTRY
5361 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5363 GET_CURRENT_CONTEXT(ctx
);
5366 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5374 if (ctx
->ExecuteFlag
) {
5375 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5379 static void GLAPIENTRY
5380 save_Attr1fNV(GLenum attr
, GLfloat x
)
5382 GET_CURRENT_CONTEXT(ctx
);
5384 SAVE_FLUSH_VERTICES(ctx
);
5385 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5391 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5392 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5393 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5395 if (ctx
->ExecuteFlag
) {
5396 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5400 static void GLAPIENTRY
5401 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5403 GET_CURRENT_CONTEXT(ctx
);
5405 SAVE_FLUSH_VERTICES(ctx
);
5406 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5413 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5414 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5415 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5417 if (ctx
->ExecuteFlag
) {
5418 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5422 static void GLAPIENTRY
5423 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5425 GET_CURRENT_CONTEXT(ctx
);
5427 SAVE_FLUSH_VERTICES(ctx
);
5428 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5436 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5437 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5438 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5440 if (ctx
->ExecuteFlag
) {
5441 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5445 static void GLAPIENTRY
5446 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5448 GET_CURRENT_CONTEXT(ctx
);
5450 SAVE_FLUSH_VERTICES(ctx
);
5451 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5460 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5461 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5462 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5464 if (ctx
->ExecuteFlag
) {
5465 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5470 static void GLAPIENTRY
5471 save_Attr1fARB(GLenum attr
, GLfloat x
)
5473 GET_CURRENT_CONTEXT(ctx
);
5475 SAVE_FLUSH_VERTICES(ctx
);
5476 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5482 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5483 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5484 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5486 if (ctx
->ExecuteFlag
) {
5487 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5491 static void GLAPIENTRY
5492 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5494 GET_CURRENT_CONTEXT(ctx
);
5496 SAVE_FLUSH_VERTICES(ctx
);
5497 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5504 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5505 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5506 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5508 if (ctx
->ExecuteFlag
) {
5509 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5513 static void GLAPIENTRY
5514 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5516 GET_CURRENT_CONTEXT(ctx
);
5518 SAVE_FLUSH_VERTICES(ctx
);
5519 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5527 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5528 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5529 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5531 if (ctx
->ExecuteFlag
) {
5532 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5536 static void GLAPIENTRY
5537 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5539 GET_CURRENT_CONTEXT(ctx
);
5541 SAVE_FLUSH_VERTICES(ctx
);
5542 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5551 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5552 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5553 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5555 if (ctx
->ExecuteFlag
) {
5556 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5561 static void GLAPIENTRY
5562 save_EvalCoord1f(GLfloat x
)
5564 GET_CURRENT_CONTEXT(ctx
);
5566 SAVE_FLUSH_VERTICES(ctx
);
5567 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5571 if (ctx
->ExecuteFlag
) {
5572 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5576 static void GLAPIENTRY
5577 save_EvalCoord1fv(const GLfloat
* v
)
5579 save_EvalCoord1f(v
[0]);
5582 static void GLAPIENTRY
5583 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5585 GET_CURRENT_CONTEXT(ctx
);
5587 SAVE_FLUSH_VERTICES(ctx
);
5588 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5593 if (ctx
->ExecuteFlag
) {
5594 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5598 static void GLAPIENTRY
5599 save_EvalCoord2fv(const GLfloat
* v
)
5601 save_EvalCoord2f(v
[0], v
[1]);
5605 static void GLAPIENTRY
5606 save_EvalPoint1(GLint x
)
5608 GET_CURRENT_CONTEXT(ctx
);
5610 SAVE_FLUSH_VERTICES(ctx
);
5611 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5615 if (ctx
->ExecuteFlag
) {
5616 CALL_EvalPoint1(ctx
->Exec
, (x
));
5620 static void GLAPIENTRY
5621 save_EvalPoint2(GLint x
, GLint y
)
5623 GET_CURRENT_CONTEXT(ctx
);
5625 SAVE_FLUSH_VERTICES(ctx
);
5626 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5631 if (ctx
->ExecuteFlag
) {
5632 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5636 static void GLAPIENTRY
5637 save_Indexf(GLfloat x
)
5639 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5642 static void GLAPIENTRY
5643 save_Indexfv(const GLfloat
* v
)
5645 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5648 static void GLAPIENTRY
5649 save_EdgeFlag(GLboolean x
)
5651 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5656 * Compare 'count' elements of vectors 'a' and 'b'.
5657 * \return GL_TRUE if equal, GL_FALSE if different.
5659 static inline GLboolean
5660 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5662 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5667 * This glMaterial function is used for glMaterial calls that are outside
5668 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5670 static void GLAPIENTRY
5671 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5673 GET_CURRENT_CONTEXT(ctx
);
5681 case GL_FRONT_AND_BACK
:
5684 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5693 case GL_AMBIENT_AND_DIFFUSE
:
5699 case GL_COLOR_INDEXES
:
5703 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5707 if (ctx
->ExecuteFlag
) {
5708 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5711 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5713 /* Try to eliminate redundant statechanges. Because it is legal to
5714 * call glMaterial even inside begin/end calls, don't need to worry
5715 * about ctx->Driver.CurrentSavePrimitive here.
5717 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5718 if (bitmask
& (1 << i
)) {
5719 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5720 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5721 /* no change in material value */
5722 bitmask
&= ~(1 << i
);
5725 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5726 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5731 /* If this call has no effect, return early */
5735 SAVE_FLUSH_VERTICES(ctx
);
5737 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5741 for (i
= 0; i
< args
; i
++)
5742 n
[3 + i
].f
= param
[i
];
5746 static void GLAPIENTRY
5747 save_Begin(GLenum mode
)
5749 GET_CURRENT_CONTEXT(ctx
);
5751 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5752 /* compile this error into the display list */
5753 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5755 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5756 /* compile this error into the display list */
5757 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5760 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5762 vbo_save_NotifyBegin(ctx
, mode
);
5766 static void GLAPIENTRY
5769 GET_CURRENT_CONTEXT(ctx
);
5770 SAVE_FLUSH_VERTICES(ctx
);
5771 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5772 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5773 if (ctx
->ExecuteFlag
) {
5774 CALL_End(ctx
->Exec
, ());
5778 static void GLAPIENTRY
5779 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5781 GET_CURRENT_CONTEXT(ctx
);
5783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5784 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5791 if (ctx
->ExecuteFlag
) {
5792 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5797 static void GLAPIENTRY
5798 save_Vertex2f(GLfloat x
, GLfloat y
)
5800 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5803 static void GLAPIENTRY
5804 save_Vertex2fv(const GLfloat
* v
)
5806 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5809 static void GLAPIENTRY
5810 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5812 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5815 static void GLAPIENTRY
5816 save_Vertex3fv(const GLfloat
* v
)
5818 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5821 static void GLAPIENTRY
5822 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5824 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5827 static void GLAPIENTRY
5828 save_Vertex4fv(const GLfloat
* v
)
5830 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5833 static void GLAPIENTRY
5834 save_TexCoord1f(GLfloat x
)
5836 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5839 static void GLAPIENTRY
5840 save_TexCoord1fv(const GLfloat
* v
)
5842 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5845 static void GLAPIENTRY
5846 save_TexCoord2f(GLfloat x
, GLfloat y
)
5848 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5851 static void GLAPIENTRY
5852 save_TexCoord2fv(const GLfloat
* v
)
5854 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5857 static void GLAPIENTRY
5858 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5860 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5863 static void GLAPIENTRY
5864 save_TexCoord3fv(const GLfloat
* v
)
5866 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5869 static void GLAPIENTRY
5870 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5872 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5875 static void GLAPIENTRY
5876 save_TexCoord4fv(const GLfloat
* v
)
5878 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5881 static void GLAPIENTRY
5882 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5884 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5887 static void GLAPIENTRY
5888 save_Normal3fv(const GLfloat
* v
)
5890 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5893 static void GLAPIENTRY
5894 save_FogCoordfEXT(GLfloat x
)
5896 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5899 static void GLAPIENTRY
5900 save_FogCoordfvEXT(const GLfloat
* v
)
5902 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5905 static void GLAPIENTRY
5906 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5908 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5911 static void GLAPIENTRY
5912 save_Color3fv(const GLfloat
* v
)
5914 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5917 static void GLAPIENTRY
5918 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5920 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5923 static void GLAPIENTRY
5924 save_Color4fv(const GLfloat
* v
)
5926 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5929 static void GLAPIENTRY
5930 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5932 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5935 static void GLAPIENTRY
5936 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5938 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5942 /* Just call the respective ATTR for texcoord
5944 static void GLAPIENTRY
5945 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5947 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5948 save_Attr1fNV(attr
, x
);
5951 static void GLAPIENTRY
5952 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5954 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5955 save_Attr1fNV(attr
, v
[0]);
5958 static void GLAPIENTRY
5959 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5961 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5962 save_Attr2fNV(attr
, x
, y
);
5965 static void GLAPIENTRY
5966 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5968 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5969 save_Attr2fNV(attr
, v
[0], v
[1]);
5972 static void GLAPIENTRY
5973 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5975 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5976 save_Attr3fNV(attr
, x
, y
, z
);
5979 static void GLAPIENTRY
5980 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5982 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5983 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5986 static void GLAPIENTRY
5987 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5988 GLfloat z
, GLfloat w
)
5990 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5991 save_Attr4fNV(attr
, x
, y
, z
, w
);
5994 static void GLAPIENTRY
5995 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5997 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5998 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
6003 * Record a GL_INVALID_VALUE error when an invalid vertex attribute
6009 GET_CURRENT_CONTEXT(ctx
);
6010 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
6015 static void GLAPIENTRY
6016 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
6018 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6019 save_Attr1fARB(index
, x
);
6024 static void GLAPIENTRY
6025 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
6027 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6028 save_Attr1fARB(index
, v
[0]);
6033 static void GLAPIENTRY
6034 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
6036 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6037 save_Attr2fARB(index
, x
, y
);
6042 static void GLAPIENTRY
6043 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
6045 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6046 save_Attr2fARB(index
, v
[0], v
[1]);
6051 static void GLAPIENTRY
6052 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
6054 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6055 save_Attr3fARB(index
, x
, y
, z
);
6060 static void GLAPIENTRY
6061 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
6063 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6064 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
6069 static void GLAPIENTRY
6070 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
6073 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6074 save_Attr4fARB(index
, x
, y
, z
, w
);
6079 static void GLAPIENTRY
6080 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
6082 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6083 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
6088 static void GLAPIENTRY
6089 save_PrimitiveRestartNV(void)
6091 /* Note: this is used when outside a glBegin/End pair in a display list */
6092 GET_CURRENT_CONTEXT(ctx
);
6093 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6094 (void) alloc_instruction(ctx
, OPCODE_PRIMITIVE_RESTART_NV
, 0);
6095 if (ctx
->ExecuteFlag
) {
6096 CALL_PrimitiveRestartNV(ctx
->Exec
, ());
6101 static void GLAPIENTRY
6102 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
6103 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
6104 GLbitfield mask
, GLenum filter
)
6106 GET_CURRENT_CONTEXT(ctx
);
6108 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6109 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
6122 if (ctx
->ExecuteFlag
) {
6123 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
6124 dstX0
, dstY0
, dstX1
, dstY1
,
6130 /** GL_EXT_provoking_vertex */
6131 static void GLAPIENTRY
6132 save_ProvokingVertexEXT(GLenum mode
)
6134 GET_CURRENT_CONTEXT(ctx
);
6136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6137 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
6141 if (ctx
->ExecuteFlag
) {
6142 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6143 _mesa_ProvokingVertex(mode
);
6148 /** GL_EXT_transform_feedback */
6149 static void GLAPIENTRY
6150 save_BeginTransformFeedback(GLenum mode
)
6152 GET_CURRENT_CONTEXT(ctx
);
6154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6155 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
6159 if (ctx
->ExecuteFlag
) {
6160 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
6165 /** GL_EXT_transform_feedback */
6166 static void GLAPIENTRY
6167 save_EndTransformFeedback(void)
6169 GET_CURRENT_CONTEXT(ctx
);
6170 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6171 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
6172 if (ctx
->ExecuteFlag
) {
6173 CALL_EndTransformFeedback(ctx
->Exec
, ());
6177 static void GLAPIENTRY
6178 save_BindTransformFeedback(GLenum target
, GLuint name
)
6180 GET_CURRENT_CONTEXT(ctx
);
6182 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6183 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
6188 if (ctx
->ExecuteFlag
) {
6189 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
6193 static void GLAPIENTRY
6194 save_PauseTransformFeedback(void)
6196 GET_CURRENT_CONTEXT(ctx
);
6197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6198 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
6199 if (ctx
->ExecuteFlag
) {
6200 CALL_PauseTransformFeedback(ctx
->Exec
, ());
6204 static void GLAPIENTRY
6205 save_ResumeTransformFeedback(void)
6207 GET_CURRENT_CONTEXT(ctx
);
6208 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6209 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
6210 if (ctx
->ExecuteFlag
) {
6211 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
6215 static void GLAPIENTRY
6216 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
6218 GET_CURRENT_CONTEXT(ctx
);
6220 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6221 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
6226 if (ctx
->ExecuteFlag
) {
6227 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
6231 static void GLAPIENTRY
6232 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
6234 GET_CURRENT_CONTEXT(ctx
);
6236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6237 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
6243 if (ctx
->ExecuteFlag
) {
6244 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
6248 static void GLAPIENTRY
6249 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
6252 GET_CURRENT_CONTEXT(ctx
);
6254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6255 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
6259 n
[3].si
= primcount
;
6261 if (ctx
->ExecuteFlag
) {
6262 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
6266 static void GLAPIENTRY
6267 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
6268 GLuint stream
, GLsizei primcount
)
6270 GET_CURRENT_CONTEXT(ctx
);
6272 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6273 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
6278 n
[4].si
= primcount
;
6280 if (ctx
->ExecuteFlag
) {
6281 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
6286 static void GLAPIENTRY
6287 save_UseProgram(GLuint program
)
6289 GET_CURRENT_CONTEXT(ctx
);
6291 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6292 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
6296 if (ctx
->ExecuteFlag
) {
6297 CALL_UseProgram(ctx
->Exec
, (program
));
6302 static void GLAPIENTRY
6303 save_Uniform1fARB(GLint location
, GLfloat x
)
6305 GET_CURRENT_CONTEXT(ctx
);
6307 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6308 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6313 if (ctx
->ExecuteFlag
) {
6314 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6319 static void GLAPIENTRY
6320 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6322 GET_CURRENT_CONTEXT(ctx
);
6324 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6325 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6331 if (ctx
->ExecuteFlag
) {
6332 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6337 static void GLAPIENTRY
6338 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6340 GET_CURRENT_CONTEXT(ctx
);
6342 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6343 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6350 if (ctx
->ExecuteFlag
) {
6351 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6356 static void GLAPIENTRY
6357 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6359 GET_CURRENT_CONTEXT(ctx
);
6361 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6362 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6370 if (ctx
->ExecuteFlag
) {
6371 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6376 static void GLAPIENTRY
6377 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6379 GET_CURRENT_CONTEXT(ctx
);
6381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6382 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
6386 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6388 if (ctx
->ExecuteFlag
) {
6389 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6393 static void GLAPIENTRY
6394 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6396 GET_CURRENT_CONTEXT(ctx
);
6398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6399 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6403 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6405 if (ctx
->ExecuteFlag
) {
6406 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6410 static void GLAPIENTRY
6411 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6413 GET_CURRENT_CONTEXT(ctx
);
6415 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6416 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6420 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6422 if (ctx
->ExecuteFlag
) {
6423 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6427 static void GLAPIENTRY
6428 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6430 GET_CURRENT_CONTEXT(ctx
);
6432 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6433 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6437 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6439 if (ctx
->ExecuteFlag
) {
6440 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6445 static void GLAPIENTRY
6446 save_Uniform1iARB(GLint location
, GLint x
)
6448 GET_CURRENT_CONTEXT(ctx
);
6450 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6451 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6456 if (ctx
->ExecuteFlag
) {
6457 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6461 static void GLAPIENTRY
6462 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6464 GET_CURRENT_CONTEXT(ctx
);
6466 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6467 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6473 if (ctx
->ExecuteFlag
) {
6474 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6478 static void GLAPIENTRY
6479 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6481 GET_CURRENT_CONTEXT(ctx
);
6483 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6484 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6491 if (ctx
->ExecuteFlag
) {
6492 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6496 static void GLAPIENTRY
6497 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6499 GET_CURRENT_CONTEXT(ctx
);
6501 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6502 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6510 if (ctx
->ExecuteFlag
) {
6511 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6517 static void GLAPIENTRY
6518 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6520 GET_CURRENT_CONTEXT(ctx
);
6522 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6523 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6527 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6529 if (ctx
->ExecuteFlag
) {
6530 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6534 static void GLAPIENTRY
6535 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6537 GET_CURRENT_CONTEXT(ctx
);
6539 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6540 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6544 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6546 if (ctx
->ExecuteFlag
) {
6547 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6551 static void GLAPIENTRY
6552 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6554 GET_CURRENT_CONTEXT(ctx
);
6556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6557 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6561 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6563 if (ctx
->ExecuteFlag
) {
6564 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6568 static void GLAPIENTRY
6569 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6571 GET_CURRENT_CONTEXT(ctx
);
6573 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6574 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6578 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6580 if (ctx
->ExecuteFlag
) {
6581 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6587 static void GLAPIENTRY
6588 save_Uniform1ui(GLint location
, GLuint x
)
6590 GET_CURRENT_CONTEXT(ctx
);
6592 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6593 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6598 if (ctx
->ExecuteFlag
) {
6599 CALL_Uniform1ui(ctx
->Exec
, (location
, x
));
6603 static void GLAPIENTRY
6604 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6606 GET_CURRENT_CONTEXT(ctx
);
6608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6609 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6615 if (ctx
->ExecuteFlag
) {
6616 CALL_Uniform2ui(ctx
->Exec
, (location
, x
, y
));
6620 static void GLAPIENTRY
6621 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6623 GET_CURRENT_CONTEXT(ctx
);
6625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6626 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6633 if (ctx
->ExecuteFlag
) {
6634 CALL_Uniform3ui(ctx
->Exec
, (location
, x
, y
, z
));
6638 static void GLAPIENTRY
6639 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6641 GET_CURRENT_CONTEXT(ctx
);
6643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6644 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6652 if (ctx
->ExecuteFlag
) {
6653 CALL_Uniform4ui(ctx
->Exec
, (location
, x
, y
, z
, w
));
6659 static void GLAPIENTRY
6660 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6662 GET_CURRENT_CONTEXT(ctx
);
6664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6665 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6669 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6671 if (ctx
->ExecuteFlag
) {
6672 CALL_Uniform1uiv(ctx
->Exec
, (location
, count
, v
));
6676 static void GLAPIENTRY
6677 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6679 GET_CURRENT_CONTEXT(ctx
);
6681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6682 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6686 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6688 if (ctx
->ExecuteFlag
) {
6689 CALL_Uniform2uiv(ctx
->Exec
, (location
, count
, v
));
6693 static void GLAPIENTRY
6694 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6696 GET_CURRENT_CONTEXT(ctx
);
6698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6699 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6703 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6705 if (ctx
->ExecuteFlag
) {
6706 CALL_Uniform3uiv(ctx
->Exec
, (location
, count
, v
));
6710 static void GLAPIENTRY
6711 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6713 GET_CURRENT_CONTEXT(ctx
);
6715 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6716 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6720 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6722 if (ctx
->ExecuteFlag
) {
6723 CALL_Uniform4uiv(ctx
->Exec
, (location
, count
, v
));
6729 static void GLAPIENTRY
6730 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6733 GET_CURRENT_CONTEXT(ctx
);
6735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6736 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6741 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6743 if (ctx
->ExecuteFlag
) {
6744 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6748 static void GLAPIENTRY
6749 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6752 GET_CURRENT_CONTEXT(ctx
);
6754 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6755 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6760 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6762 if (ctx
->ExecuteFlag
) {
6763 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6767 static void GLAPIENTRY
6768 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6771 GET_CURRENT_CONTEXT(ctx
);
6773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6774 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6779 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6781 if (ctx
->ExecuteFlag
) {
6782 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6787 static void GLAPIENTRY
6788 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6791 GET_CURRENT_CONTEXT(ctx
);
6793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6794 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6799 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6801 if (ctx
->ExecuteFlag
) {
6802 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6806 static void GLAPIENTRY
6807 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6810 GET_CURRENT_CONTEXT(ctx
);
6812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6813 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6818 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6820 if (ctx
->ExecuteFlag
) {
6821 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6826 static void GLAPIENTRY
6827 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6830 GET_CURRENT_CONTEXT(ctx
);
6832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6833 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6838 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6840 if (ctx
->ExecuteFlag
) {
6841 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6845 static void GLAPIENTRY
6846 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6849 GET_CURRENT_CONTEXT(ctx
);
6851 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6852 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6857 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6859 if (ctx
->ExecuteFlag
) {
6860 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6865 static void GLAPIENTRY
6866 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6869 GET_CURRENT_CONTEXT(ctx
);
6871 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6872 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6877 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6879 if (ctx
->ExecuteFlag
) {
6880 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6884 static void GLAPIENTRY
6885 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6888 GET_CURRENT_CONTEXT(ctx
);
6890 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6891 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6896 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6898 if (ctx
->ExecuteFlag
) {
6899 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6903 static void GLAPIENTRY
6904 save_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
6906 GET_CURRENT_CONTEXT(ctx
);
6908 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6909 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM_STAGES
, 3);
6915 if (ctx
->ExecuteFlag
) {
6916 CALL_UseProgramStages(ctx
->Exec
, (pipeline
, stages
, program
));
6920 static void GLAPIENTRY
6921 save_ProgramUniform1f(GLuint program
, GLint location
, GLfloat x
)
6923 GET_CURRENT_CONTEXT(ctx
);
6925 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6926 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1F
, 3);
6932 if (ctx
->ExecuteFlag
) {
6933 CALL_ProgramUniform1f(ctx
->Exec
, (program
, location
, x
));
6937 static void GLAPIENTRY
6938 save_ProgramUniform2f(GLuint program
, GLint location
, GLfloat x
, GLfloat y
)
6940 GET_CURRENT_CONTEXT(ctx
);
6942 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6943 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2F
, 4);
6950 if (ctx
->ExecuteFlag
) {
6951 CALL_ProgramUniform2f(ctx
->Exec
, (program
, location
, x
, y
));
6955 static void GLAPIENTRY
6956 save_ProgramUniform3f(GLuint program
, GLint location
,
6957 GLfloat x
, GLfloat y
, GLfloat z
)
6959 GET_CURRENT_CONTEXT(ctx
);
6961 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6962 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3F
, 5);
6970 if (ctx
->ExecuteFlag
) {
6971 CALL_ProgramUniform3f(ctx
->Exec
, (program
, location
, x
, y
, z
));
6975 static void GLAPIENTRY
6976 save_ProgramUniform4f(GLuint program
, GLint location
,
6977 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6979 GET_CURRENT_CONTEXT(ctx
);
6981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6982 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4F
, 6);
6991 if (ctx
->ExecuteFlag
) {
6992 CALL_ProgramUniform4f(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6996 static void GLAPIENTRY
6997 save_ProgramUniform1fv(GLuint program
, GLint location
, GLsizei count
,
7000 GET_CURRENT_CONTEXT(ctx
);
7002 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7003 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1FV
, 3 + POINTER_DWORDS
);
7008 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLfloat
)));
7010 if (ctx
->ExecuteFlag
) {
7011 CALL_ProgramUniform1fv(ctx
->Exec
, (program
, location
, count
, v
));
7015 static void GLAPIENTRY
7016 save_ProgramUniform2fv(GLuint program
, GLint location
, GLsizei count
,
7019 GET_CURRENT_CONTEXT(ctx
);
7021 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7022 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2FV
, 3 + POINTER_DWORDS
);
7027 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLfloat
)));
7029 if (ctx
->ExecuteFlag
) {
7030 CALL_ProgramUniform2fv(ctx
->Exec
, (program
, location
, count
, v
));
7034 static void GLAPIENTRY
7035 save_ProgramUniform3fv(GLuint program
, GLint location
, GLsizei count
,
7038 GET_CURRENT_CONTEXT(ctx
);
7040 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7041 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3FV
, 3 + POINTER_DWORDS
);
7046 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLfloat
)));
7048 if (ctx
->ExecuteFlag
) {
7049 CALL_ProgramUniform3fv(ctx
->Exec
, (program
, location
, count
, v
));
7053 static void GLAPIENTRY
7054 save_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
7057 GET_CURRENT_CONTEXT(ctx
);
7059 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7060 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4FV
, 3 + POINTER_DWORDS
);
7065 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLfloat
)));
7067 if (ctx
->ExecuteFlag
) {
7068 CALL_ProgramUniform4fv(ctx
->Exec
, (program
, location
, count
, v
));
7072 static void GLAPIENTRY
7073 save_ProgramUniform1i(GLuint program
, GLint location
, GLint x
)
7075 GET_CURRENT_CONTEXT(ctx
);
7077 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7078 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1I
, 3);
7084 if (ctx
->ExecuteFlag
) {
7085 CALL_ProgramUniform1i(ctx
->Exec
, (program
, location
, x
));
7089 static void GLAPIENTRY
7090 save_ProgramUniform2i(GLuint program
, GLint location
, GLint x
, GLint y
)
7092 GET_CURRENT_CONTEXT(ctx
);
7094 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7095 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2I
, 4);
7102 if (ctx
->ExecuteFlag
) {
7103 CALL_ProgramUniform2i(ctx
->Exec
, (program
, location
, x
, y
));
7107 static void GLAPIENTRY
7108 save_ProgramUniform3i(GLuint program
, GLint location
,
7109 GLint x
, GLint y
, GLint z
)
7111 GET_CURRENT_CONTEXT(ctx
);
7113 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7114 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3I
, 5);
7122 if (ctx
->ExecuteFlag
) {
7123 CALL_ProgramUniform3i(ctx
->Exec
, (program
, location
, x
, y
, z
));
7127 static void GLAPIENTRY
7128 save_ProgramUniform4i(GLuint program
, GLint location
,
7129 GLint x
, GLint y
, GLint z
, GLint w
)
7131 GET_CURRENT_CONTEXT(ctx
);
7133 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7134 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4I
, 6);
7143 if (ctx
->ExecuteFlag
) {
7144 CALL_ProgramUniform4i(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7148 static void GLAPIENTRY
7149 save_ProgramUniform1iv(GLuint program
, GLint location
, GLsizei count
,
7152 GET_CURRENT_CONTEXT(ctx
);
7154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7155 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1IV
, 3 + POINTER_DWORDS
);
7160 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLint
)));
7162 if (ctx
->ExecuteFlag
) {
7163 CALL_ProgramUniform1iv(ctx
->Exec
, (program
, location
, count
, v
));
7167 static void GLAPIENTRY
7168 save_ProgramUniform2iv(GLuint program
, GLint location
, GLsizei count
,
7171 GET_CURRENT_CONTEXT(ctx
);
7173 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7174 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2IV
, 3 + POINTER_DWORDS
);
7179 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLint
)));
7181 if (ctx
->ExecuteFlag
) {
7182 CALL_ProgramUniform2iv(ctx
->Exec
, (program
, location
, count
, v
));
7186 static void GLAPIENTRY
7187 save_ProgramUniform3iv(GLuint program
, GLint location
, GLsizei count
,
7190 GET_CURRENT_CONTEXT(ctx
);
7192 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7193 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3IV
, 3 + POINTER_DWORDS
);
7198 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLint
)));
7200 if (ctx
->ExecuteFlag
) {
7201 CALL_ProgramUniform3iv(ctx
->Exec
, (program
, location
, count
, v
));
7205 static void GLAPIENTRY
7206 save_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
7209 GET_CURRENT_CONTEXT(ctx
);
7211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7212 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4IV
, 3 + POINTER_DWORDS
);
7217 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLint
)));
7219 if (ctx
->ExecuteFlag
) {
7220 CALL_ProgramUniform4iv(ctx
->Exec
, (program
, location
, count
, v
));
7224 static void GLAPIENTRY
7225 save_ProgramUniform1ui(GLuint program
, GLint location
, GLuint x
)
7227 GET_CURRENT_CONTEXT(ctx
);
7229 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7230 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UI
, 3);
7236 if (ctx
->ExecuteFlag
) {
7237 CALL_ProgramUniform1ui(ctx
->Exec
, (program
, location
, x
));
7241 static void GLAPIENTRY
7242 save_ProgramUniform2ui(GLuint program
, GLint location
, GLuint x
, GLuint y
)
7244 GET_CURRENT_CONTEXT(ctx
);
7246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7247 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UI
, 4);
7254 if (ctx
->ExecuteFlag
) {
7255 CALL_ProgramUniform2ui(ctx
->Exec
, (program
, location
, x
, y
));
7259 static void GLAPIENTRY
7260 save_ProgramUniform3ui(GLuint program
, GLint location
,
7261 GLuint x
, GLuint y
, GLuint z
)
7263 GET_CURRENT_CONTEXT(ctx
);
7265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7266 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UI
, 5);
7274 if (ctx
->ExecuteFlag
) {
7275 CALL_ProgramUniform3ui(ctx
->Exec
, (program
, location
, x
, y
, z
));
7279 static void GLAPIENTRY
7280 save_ProgramUniform4ui(GLuint program
, GLint location
,
7281 GLuint x
, GLuint y
, GLuint z
, GLuint w
)
7283 GET_CURRENT_CONTEXT(ctx
);
7285 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7286 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UI
, 6);
7295 if (ctx
->ExecuteFlag
) {
7296 CALL_ProgramUniform4ui(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7300 static void GLAPIENTRY
7301 save_ProgramUniform1uiv(GLuint program
, GLint location
, GLsizei count
,
7304 GET_CURRENT_CONTEXT(ctx
);
7306 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7307 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UIV
, 3 + POINTER_DWORDS
);
7312 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLuint
)));
7314 if (ctx
->ExecuteFlag
) {
7315 CALL_ProgramUniform1uiv(ctx
->Exec
, (program
, location
, count
, v
));
7319 static void GLAPIENTRY
7320 save_ProgramUniform2uiv(GLuint program
, GLint location
, GLsizei count
,
7323 GET_CURRENT_CONTEXT(ctx
);
7325 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7326 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UIV
, 3 + POINTER_DWORDS
);
7331 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLuint
)));
7333 if (ctx
->ExecuteFlag
) {
7334 CALL_ProgramUniform2uiv(ctx
->Exec
, (program
, location
, count
, v
));
7338 static void GLAPIENTRY
7339 save_ProgramUniform3uiv(GLuint program
, GLint location
, GLsizei count
,
7342 GET_CURRENT_CONTEXT(ctx
);
7344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7345 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UIV
, 3 + POINTER_DWORDS
);
7350 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLuint
)));
7352 if (ctx
->ExecuteFlag
) {
7353 CALL_ProgramUniform3uiv(ctx
->Exec
, (program
, location
, count
, v
));
7357 static void GLAPIENTRY
7358 save_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
7361 GET_CURRENT_CONTEXT(ctx
);
7363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7364 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UIV
, 3 + POINTER_DWORDS
);
7369 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLuint
)));
7371 if (ctx
->ExecuteFlag
) {
7372 CALL_ProgramUniform4uiv(ctx
->Exec
, (program
, location
, count
, v
));
7376 static void GLAPIENTRY
7377 save_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
7378 GLboolean transpose
, const GLfloat
*v
)
7380 GET_CURRENT_CONTEXT(ctx
);
7382 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7383 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
7384 4 + POINTER_DWORDS
);
7390 save_pointer(&n
[5], memdup(v
, count
* 2 * 2 * sizeof(GLfloat
)));
7392 if (ctx
->ExecuteFlag
) {
7393 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
7394 (program
, location
, count
, transpose
, v
));
7398 static void GLAPIENTRY
7399 save_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
7400 GLboolean transpose
, const GLfloat
*v
)
7402 GET_CURRENT_CONTEXT(ctx
);
7404 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7405 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
7406 4 + POINTER_DWORDS
);
7412 save_pointer(&n
[5], memdup(v
, count
* 2 * 3 * sizeof(GLfloat
)));
7414 if (ctx
->ExecuteFlag
) {
7415 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
7416 (program
, location
, count
, transpose
, v
));
7420 static void GLAPIENTRY
7421 save_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
7422 GLboolean transpose
, const GLfloat
*v
)
7424 GET_CURRENT_CONTEXT(ctx
);
7426 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7427 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
7428 4 + POINTER_DWORDS
);
7434 save_pointer(&n
[5], memdup(v
, count
* 2 * 4 * sizeof(GLfloat
)));
7436 if (ctx
->ExecuteFlag
) {
7437 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
7438 (program
, location
, count
, transpose
, v
));
7442 static void GLAPIENTRY
7443 save_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
7444 GLboolean transpose
, const GLfloat
*v
)
7446 GET_CURRENT_CONTEXT(ctx
);
7448 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7449 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
7450 4 + POINTER_DWORDS
);
7456 save_pointer(&n
[5], memdup(v
, count
* 3 * 2 * sizeof(GLfloat
)));
7458 if (ctx
->ExecuteFlag
) {
7459 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
7460 (program
, location
, count
, transpose
, v
));
7464 static void GLAPIENTRY
7465 save_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
7466 GLboolean transpose
, const GLfloat
*v
)
7468 GET_CURRENT_CONTEXT(ctx
);
7470 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7471 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
7472 4 + POINTER_DWORDS
);
7478 save_pointer(&n
[5], memdup(v
, count
* 3 * 3 * sizeof(GLfloat
)));
7480 if (ctx
->ExecuteFlag
) {
7481 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
7482 (program
, location
, count
, transpose
, v
));
7486 static void GLAPIENTRY
7487 save_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
7488 GLboolean transpose
, const GLfloat
*v
)
7490 GET_CURRENT_CONTEXT(ctx
);
7492 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7493 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
7494 4 + POINTER_DWORDS
);
7500 save_pointer(&n
[5], memdup(v
, count
* 3 * 4 * sizeof(GLfloat
)));
7502 if (ctx
->ExecuteFlag
) {
7503 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
7504 (program
, location
, count
, transpose
, v
));
7508 static void GLAPIENTRY
7509 save_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
7510 GLboolean transpose
, const GLfloat
*v
)
7512 GET_CURRENT_CONTEXT(ctx
);
7514 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7515 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
7516 4 + POINTER_DWORDS
);
7522 save_pointer(&n
[5], memdup(v
, count
* 4 * 2 * sizeof(GLfloat
)));
7524 if (ctx
->ExecuteFlag
) {
7525 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
7526 (program
, location
, count
, transpose
, v
));
7530 static void GLAPIENTRY
7531 save_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
7532 GLboolean transpose
, const GLfloat
*v
)
7534 GET_CURRENT_CONTEXT(ctx
);
7536 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7537 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
7538 4 + POINTER_DWORDS
);
7544 save_pointer(&n
[5], memdup(v
, count
* 4 * 3 * sizeof(GLfloat
)));
7546 if (ctx
->ExecuteFlag
) {
7547 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
7548 (program
, location
, count
, transpose
, v
));
7552 static void GLAPIENTRY
7553 save_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
7554 GLboolean transpose
, const GLfloat
*v
)
7556 GET_CURRENT_CONTEXT(ctx
);
7558 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7559 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
7560 4 + POINTER_DWORDS
);
7566 save_pointer(&n
[5], memdup(v
, count
* 4 * 4 * sizeof(GLfloat
)));
7568 if (ctx
->ExecuteFlag
) {
7569 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
7570 (program
, location
, count
, transpose
, v
));
7574 static void GLAPIENTRY
7575 save_ClipControl(GLenum origin
, GLenum depth
)
7577 GET_CURRENT_CONTEXT(ctx
);
7579 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7580 n
= alloc_instruction(ctx
, OPCODE_CLIP_CONTROL
, 2);
7585 if (ctx
->ExecuteFlag
) {
7586 CALL_ClipControl(ctx
->Exec
, (origin
, depth
));
7590 static void GLAPIENTRY
7591 save_ClampColorARB(GLenum target
, GLenum clamp
)
7593 GET_CURRENT_CONTEXT(ctx
);
7595 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7596 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
7601 if (ctx
->ExecuteFlag
) {
7602 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
7606 /** GL_EXT_texture_integer */
7607 static void GLAPIENTRY
7608 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
7610 GET_CURRENT_CONTEXT(ctx
);
7612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7613 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
7620 if (ctx
->ExecuteFlag
) {
7621 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7625 /** GL_EXT_texture_integer */
7626 static void GLAPIENTRY
7627 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
7629 GET_CURRENT_CONTEXT(ctx
);
7631 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7632 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
7639 if (ctx
->ExecuteFlag
) {
7640 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7644 /** GL_EXT_texture_integer */
7645 static void GLAPIENTRY
7646 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
7648 GET_CURRENT_CONTEXT(ctx
);
7650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7651 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
7660 if (ctx
->ExecuteFlag
) {
7661 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
7665 /** GL_EXT_texture_integer */
7666 static void GLAPIENTRY
7667 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
7669 GET_CURRENT_CONTEXT(ctx
);
7671 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7672 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
7676 n
[3].ui
= params
[0];
7677 n
[4].ui
= params
[1];
7678 n
[5].ui
= params
[2];
7679 n
[6].ui
= params
[3];
7681 if (ctx
->ExecuteFlag
) {
7682 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
7686 /* GL_ARB_instanced_arrays */
7687 static void GLAPIENTRY
7688 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
7690 GET_CURRENT_CONTEXT(ctx
);
7692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7693 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
7698 if (ctx
->ExecuteFlag
) {
7699 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
7704 /* GL_NV_texture_barrier */
7705 static void GLAPIENTRY
7706 save_TextureBarrierNV(void)
7708 GET_CURRENT_CONTEXT(ctx
);
7709 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7710 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
7711 if (ctx
->ExecuteFlag
) {
7712 CALL_TextureBarrierNV(ctx
->Exec
, ());
7717 /* GL_ARB_sampler_objects */
7718 static void GLAPIENTRY
7719 save_BindSampler(GLuint unit
, GLuint sampler
)
7722 GET_CURRENT_CONTEXT(ctx
);
7723 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7724 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
7729 if (ctx
->ExecuteFlag
) {
7730 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
7734 static void GLAPIENTRY
7735 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7738 GET_CURRENT_CONTEXT(ctx
);
7739 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7740 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7745 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7751 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7754 if (ctx
->ExecuteFlag
) {
7755 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7759 static void GLAPIENTRY
7760 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7764 parray
[1] = parray
[2] = parray
[3] = 0;
7765 save_SamplerParameteriv(sampler
, pname
, parray
);
7768 static void GLAPIENTRY
7769 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7772 GET_CURRENT_CONTEXT(ctx
);
7773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7774 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7779 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7785 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7788 if (ctx
->ExecuteFlag
) {
7789 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7793 static void GLAPIENTRY
7794 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7798 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7799 save_SamplerParameterfv(sampler
, pname
, parray
);
7802 static void GLAPIENTRY
7803 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7806 GET_CURRENT_CONTEXT(ctx
);
7807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7808 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7813 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7819 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7822 if (ctx
->ExecuteFlag
) {
7823 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7827 static void GLAPIENTRY
7828 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7831 GET_CURRENT_CONTEXT(ctx
);
7832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7833 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7837 n
[3].ui
= params
[0];
7838 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7839 n
[4].ui
= params
[1];
7840 n
[5].ui
= params
[2];
7841 n
[6].ui
= params
[3];
7844 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7847 if (ctx
->ExecuteFlag
) {
7848 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7852 static void GLAPIENTRY
7853 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7856 GET_CURRENT_CONTEXT(ctx
);
7857 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7858 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7860 union uint64_pair p
;
7863 n
[2].ui
= p
.uint32
[0];
7864 n
[3].ui
= p
.uint32
[1];
7865 save_pointer(&n
[4], sync
);
7867 if (ctx
->ExecuteFlag
) {
7868 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7873 /** GL_NV_conditional_render */
7874 static void GLAPIENTRY
7875 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7877 GET_CURRENT_CONTEXT(ctx
);
7879 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7880 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7885 if (ctx
->ExecuteFlag
) {
7886 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7890 static void GLAPIENTRY
7891 save_EndConditionalRender(void)
7893 GET_CURRENT_CONTEXT(ctx
);
7894 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7895 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7896 if (ctx
->ExecuteFlag
) {
7897 CALL_EndConditionalRender(ctx
->Exec
, ());
7901 static void GLAPIENTRY
7902 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7904 GET_CURRENT_CONTEXT(ctx
);
7906 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7907 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7913 if (ctx
->ExecuteFlag
) {
7914 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7918 /** GL_EXT_window_rectangles */
7919 static void GLAPIENTRY
7920 save_WindowRectanglesEXT(GLenum mode
, GLsizei count
, const GLint
*box
)
7922 GET_CURRENT_CONTEXT(ctx
);
7924 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7925 n
= alloc_instruction(ctx
, OPCODE_WINDOW_RECTANGLES
, 2 + POINTER_DWORDS
);
7927 GLint
*box_copy
= NULL
;
7930 box_copy
= memdup(box
, sizeof(GLint
) * 4 * count
);
7933 save_pointer(&n
[3], box_copy
);
7935 if (ctx
->ExecuteFlag
) {
7936 CALL_WindowRectanglesEXT(ctx
->Exec
, (mode
, count
, box
));
7941 /** GL_NV_conservative_raster */
7942 static void GLAPIENTRY
7943 save_SubpixelPrecisionBiasNV(GLuint xbits
, GLuint ybits
)
7945 GET_CURRENT_CONTEXT(ctx
);
7947 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7948 n
= alloc_instruction(ctx
, OPCODE_SUBPIXEL_PRECISION_BIAS
, 2);
7953 if (ctx
->ExecuteFlag
) {
7954 CALL_SubpixelPrecisionBiasNV(ctx
->Exec
, (xbits
, ybits
));
7958 /** GL_NV_conservative_raster_dilate */
7959 static void GLAPIENTRY
7960 save_ConservativeRasterParameterfNV(GLenum pname
, GLfloat param
)
7962 GET_CURRENT_CONTEXT(ctx
);
7964 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7965 n
= alloc_instruction(ctx
, OPCODE_CONSERVATIVE_RASTER_PARAMETER_F
, 2);
7970 if (ctx
->ExecuteFlag
) {
7971 CALL_ConservativeRasterParameterfNV(ctx
->Exec
, (pname
, param
));
7975 /** GL_NV_conservative_raster_pre_snap_triangles */
7976 static void GLAPIENTRY
7977 save_ConservativeRasterParameteriNV(GLenum pname
, GLint param
)
7979 GET_CURRENT_CONTEXT(ctx
);
7981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7982 n
= alloc_instruction(ctx
, OPCODE_CONSERVATIVE_RASTER_PARAMETER_I
, 2);
7987 if (ctx
->ExecuteFlag
) {
7988 CALL_ConservativeRasterParameteriNV(ctx
->Exec
, (pname
, param
));
7994 * Save an error-generating command into display list.
7996 * KW: Will appear in the list before the vertex buffer containing the
7997 * command that provoked the error. I don't see this as a problem.
8000 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
8003 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
8006 save_pointer(&n
[2], (void *) s
);
8007 /* note: the data/string here doesn't have to be freed in
8008 * _mesa_delete_list() since the string is never dynamically
8016 * Compile an error into current display list.
8019 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
8021 if (ctx
->CompileFlag
)
8022 save_error(ctx
, error
, s
);
8023 if (ctx
->ExecuteFlag
)
8024 _mesa_error(ctx
, error
, "%s", s
);
8029 * Test if ID names a display list.
8032 islist(struct gl_context
*ctx
, GLuint list
)
8034 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
8044 /**********************************************************************/
8045 /* Display list execution */
8046 /**********************************************************************/
8050 * Execute a display list. Note that the ListBase offset must have already
8051 * been added before calling this function. I.e. the list argument is
8052 * the absolute list number, not relative to ListBase.
8053 * \param list - display list number
8056 execute_list(struct gl_context
*ctx
, GLuint list
)
8058 struct gl_display_list
*dlist
;
8062 if (list
== 0 || !islist(ctx
, list
))
8065 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
8066 /* raise an error? */
8070 dlist
= _mesa_lookup_list(ctx
, list
);
8074 ctx
->ListState
.CallDepth
++;
8076 vbo_save_BeginCallList(ctx
, dlist
);
8082 const OpCode opcode
= n
[0].opcode
;
8084 if (is_ext_opcode(opcode
)) {
8085 n
+= ext_opcode_execute(ctx
, n
);
8090 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
8093 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8095 case OPCODE_ALPHA_FUNC
:
8096 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8098 case OPCODE_BIND_TEXTURE
:
8099 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8103 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8104 ctx
->Unpack
= ctx
->DefaultPacking
;
8105 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
8106 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
8107 get_pointer(&n
[7])));
8108 ctx
->Unpack
= save
; /* restore */
8111 case OPCODE_BLEND_COLOR
:
8112 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8114 case OPCODE_BLEND_EQUATION
:
8115 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
8117 case OPCODE_BLEND_EQUATION_SEPARATE
:
8118 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8120 case OPCODE_BLEND_FUNC_SEPARATE
:
8121 CALL_BlendFuncSeparate(ctx
->Exec
,
8122 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8125 case OPCODE_BLEND_FUNC_I
:
8126 /* GL_ARB_draw_buffers_blend */
8127 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
8129 case OPCODE_BLEND_FUNC_SEPARATE_I
:
8130 /* GL_ARB_draw_buffers_blend */
8131 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
8134 case OPCODE_BLEND_EQUATION_I
:
8135 /* GL_ARB_draw_buffers_blend */
8136 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8138 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
8139 /* GL_ARB_draw_buffers_blend */
8140 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
8141 (n
[1].ui
, n
[2].e
, n
[3].e
));
8144 case OPCODE_CALL_LIST
:
8145 /* Generated by glCallList(), don't add ListBase */
8146 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
8147 execute_list(ctx
, n
[1].ui
);
8150 case OPCODE_CALL_LISTS
:
8151 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
8152 CALL_CallLists(ctx
->Exec
, (n
[1].i
, n
[2].e
, get_pointer(&n
[3])));
8156 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
8158 case OPCODE_CLEAR_BUFFER_IV
:
8165 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8168 case OPCODE_CLEAR_BUFFER_UIV
:
8175 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8178 case OPCODE_CLEAR_BUFFER_FV
:
8185 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
8188 case OPCODE_CLEAR_BUFFER_FI
:
8189 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
8191 case OPCODE_CLEAR_COLOR
:
8192 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8194 case OPCODE_CLEAR_ACCUM
:
8195 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8197 case OPCODE_CLEAR_DEPTH
:
8198 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
8200 case OPCODE_CLEAR_INDEX
:
8201 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
8203 case OPCODE_CLEAR_STENCIL
:
8204 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
8206 case OPCODE_CLIP_PLANE
:
8213 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
8216 case OPCODE_COLOR_MASK
:
8217 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
8219 case OPCODE_COLOR_MASK_INDEXED
:
8220 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
8223 case OPCODE_COLOR_MATERIAL
:
8224 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8226 case OPCODE_COPY_PIXELS
:
8227 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8228 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
8231 case OPCODE_COPY_TEX_IMAGE1D
:
8232 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
8233 n
[5].i
, n
[6].i
, n
[7].i
));
8235 case OPCODE_COPY_TEX_IMAGE2D
:
8236 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
8237 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
8239 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
8240 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8241 n
[4].i
, n
[5].i
, n
[6].i
));
8243 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
8244 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8245 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8248 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
8249 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8250 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8253 case OPCODE_CULL_FACE
:
8254 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
8256 case OPCODE_DEPTH_FUNC
:
8257 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
8259 case OPCODE_DEPTH_MASK
:
8260 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
8262 case OPCODE_DEPTH_RANGE
:
8263 CALL_DepthRange(ctx
->Exec
,
8264 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
8266 case OPCODE_DISABLE
:
8267 CALL_Disable(ctx
->Exec
, (n
[1].e
));
8269 case OPCODE_DISABLE_INDEXED
:
8270 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8272 case OPCODE_DRAW_BUFFER
:
8273 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
8275 case OPCODE_DRAW_PIXELS
:
8277 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8278 ctx
->Unpack
= ctx
->DefaultPacking
;
8279 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
8280 get_pointer(&n
[5])));
8281 ctx
->Unpack
= save
; /* restore */
8285 CALL_Enable(ctx
->Exec
, (n
[1].e
));
8287 case OPCODE_ENABLE_INDEXED
:
8288 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8290 case OPCODE_EVALMESH1
:
8291 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
8293 case OPCODE_EVALMESH2
:
8294 CALL_EvalMesh2(ctx
->Exec
,
8295 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8304 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
8307 case OPCODE_FRONT_FACE
:
8308 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
8310 case OPCODE_FRUSTUM
:
8311 CALL_Frustum(ctx
->Exec
,
8312 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8315 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8317 case OPCODE_INDEX_MASK
:
8318 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
8320 case OPCODE_INIT_NAMES
:
8321 CALL_InitNames(ctx
->Exec
, ());
8330 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
8333 case OPCODE_LIGHT_MODEL
:
8340 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
8343 case OPCODE_LINE_STIPPLE
:
8344 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
8346 case OPCODE_LINE_WIDTH
:
8347 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
8349 case OPCODE_LIST_BASE
:
8350 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
8352 case OPCODE_LOAD_IDENTITY
:
8353 CALL_LoadIdentity(ctx
->Exec
, ());
8355 case OPCODE_LOAD_MATRIX
:
8356 STATIC_ASSERT(sizeof(Node
) == sizeof(GLfloat
));
8357 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
8359 case OPCODE_LOAD_NAME
:
8360 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
8362 case OPCODE_LOGIC_OP
:
8363 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
8367 GLenum target
= n
[1].e
;
8368 GLint ustride
= _mesa_evaluator_components(target
);
8369 GLint uorder
= n
[5].i
;
8370 GLfloat u1
= n
[2].f
;
8371 GLfloat u2
= n
[3].f
;
8372 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8373 (GLfloat
*) get_pointer(&n
[6])));
8378 GLenum target
= n
[1].e
;
8379 GLfloat u1
= n
[2].f
;
8380 GLfloat u2
= n
[3].f
;
8381 GLfloat v1
= n
[4].f
;
8382 GLfloat v2
= n
[5].f
;
8383 GLint ustride
= n
[6].i
;
8384 GLint vstride
= n
[7].i
;
8385 GLint uorder
= n
[8].i
;
8386 GLint vorder
= n
[9].i
;
8387 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8388 v1
, v2
, vstride
, vorder
,
8389 (GLfloat
*) get_pointer(&n
[10])));
8392 case OPCODE_MAPGRID1
:
8393 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8395 case OPCODE_MAPGRID2
:
8396 CALL_MapGrid2f(ctx
->Exec
,
8397 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
8399 case OPCODE_MATRIX_MODE
:
8400 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
8402 case OPCODE_MULT_MATRIX
:
8403 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
8406 CALL_Ortho(ctx
->Exec
,
8407 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8409 case OPCODE_PASSTHROUGH
:
8410 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
8412 case OPCODE_PIXEL_MAP
:
8413 CALL_PixelMapfv(ctx
->Exec
,
8414 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
8416 case OPCODE_PIXEL_TRANSFER
:
8417 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8419 case OPCODE_PIXEL_ZOOM
:
8420 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8422 case OPCODE_POINT_SIZE
:
8423 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
8425 case OPCODE_POINT_PARAMETERS
:
8431 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8434 case OPCODE_POLYGON_MODE
:
8435 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8437 case OPCODE_POLYGON_STIPPLE
:
8439 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8440 ctx
->Unpack
= ctx
->DefaultPacking
;
8441 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
8442 ctx
->Unpack
= save
; /* restore */
8445 case OPCODE_POLYGON_OFFSET
:
8446 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8448 case OPCODE_POLYGON_OFFSET_CLAMP
:
8449 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8451 case OPCODE_POP_ATTRIB
:
8452 CALL_PopAttrib(ctx
->Exec
, ());
8454 case OPCODE_POP_MATRIX
:
8455 CALL_PopMatrix(ctx
->Exec
, ());
8457 case OPCODE_POP_NAME
:
8458 CALL_PopName(ctx
->Exec
, ());
8460 case OPCODE_PRIORITIZE_TEXTURE
:
8461 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
8463 case OPCODE_PUSH_ATTRIB
:
8464 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
8466 case OPCODE_PUSH_MATRIX
:
8467 CALL_PushMatrix(ctx
->Exec
, ());
8469 case OPCODE_PUSH_NAME
:
8470 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
8472 case OPCODE_RASTER_POS
:
8473 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8475 case OPCODE_READ_BUFFER
:
8476 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
8479 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8482 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8484 case OPCODE_SCISSOR
:
8485 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8487 case OPCODE_SHADE_MODEL
:
8488 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
8490 case OPCODE_PROVOKING_VERTEX
:
8491 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
8493 case OPCODE_STENCIL_FUNC
:
8494 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
8496 case OPCODE_STENCIL_MASK
:
8497 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
8499 case OPCODE_STENCIL_OP
:
8500 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
8502 case OPCODE_STENCIL_FUNC_SEPARATE
:
8503 CALL_StencilFuncSeparate(ctx
->Exec
,
8504 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
8506 case OPCODE_STENCIL_MASK_SEPARATE
:
8507 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8509 case OPCODE_STENCIL_OP_SEPARATE
:
8510 CALL_StencilOpSeparate(ctx
->Exec
,
8511 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8520 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8530 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8533 case OPCODE_TEXPARAMETER
:
8540 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8543 case OPCODE_TEX_IMAGE1D
:
8545 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8546 ctx
->Unpack
= ctx
->DefaultPacking
;
8547 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
8549 n
[3].i
, /* components */
8551 n
[5].e
, /* border */
8552 n
[6].e
, /* format */
8554 get_pointer(&n
[8])));
8555 ctx
->Unpack
= save
; /* restore */
8558 case OPCODE_TEX_IMAGE2D
:
8560 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8561 ctx
->Unpack
= ctx
->DefaultPacking
;
8562 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
8564 n
[3].i
, /* components */
8566 n
[5].i
, /* height */
8567 n
[6].e
, /* border */
8568 n
[7].e
, /* format */
8570 get_pointer(&n
[9])));
8571 ctx
->Unpack
= save
; /* restore */
8574 case OPCODE_TEX_IMAGE3D
:
8576 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8577 ctx
->Unpack
= ctx
->DefaultPacking
;
8578 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
8580 n
[3].i
, /* components */
8582 n
[5].i
, /* height */
8584 n
[7].e
, /* border */
8585 n
[8].e
, /* format */
8587 get_pointer(&n
[10])));
8588 ctx
->Unpack
= save
; /* restore */
8591 case OPCODE_TEX_SUB_IMAGE1D
:
8593 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8594 ctx
->Unpack
= ctx
->DefaultPacking
;
8595 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8597 n
[6].e
, get_pointer(&n
[7])));
8598 ctx
->Unpack
= save
; /* restore */
8601 case OPCODE_TEX_SUB_IMAGE2D
:
8603 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8604 ctx
->Unpack
= ctx
->DefaultPacking
;
8605 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8607 n
[6].i
, n
[7].e
, n
[8].e
,
8608 get_pointer(&n
[9])));
8609 ctx
->Unpack
= save
; /* restore */
8612 case OPCODE_TEX_SUB_IMAGE3D
:
8614 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8615 ctx
->Unpack
= ctx
->DefaultPacking
;
8616 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8617 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8618 n
[8].i
, n
[9].e
, n
[10].e
,
8619 get_pointer(&n
[11])));
8620 ctx
->Unpack
= save
; /* restore */
8623 case OPCODE_TRANSLATE
:
8624 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8626 case OPCODE_VIEWPORT
:
8627 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8628 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8630 case OPCODE_WINDOW_POS
:
8631 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8633 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8634 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8636 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8637 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8638 n
[4].i
, n
[5].i
, n
[6].i
,
8639 get_pointer(&n
[7])));
8641 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8642 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8643 n
[4].i
, n
[5].i
, n
[6].i
,
8644 n
[7].i
, get_pointer(&n
[8])));
8646 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8647 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8648 n
[4].i
, n
[5].i
, n
[6].i
,
8650 get_pointer(&n
[9])));
8652 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8653 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8654 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8656 get_pointer(&n
[7])));
8658 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8659 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8660 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8661 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8662 get_pointer(&n
[9])));
8664 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8665 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8666 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8667 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8669 get_pointer(&n
[11])));
8671 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8672 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8674 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8675 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8677 case OPCODE_BIND_PROGRAM_ARB
: /* GL_ARB_vertex_program */
8678 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8680 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8681 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8682 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8685 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8686 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8688 case OPCODE_DEPTH_BOUNDS_EXT
:
8689 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8691 case OPCODE_PROGRAM_STRING_ARB
:
8692 CALL_ProgramStringARB(ctx
->Exec
,
8693 (n
[1].e
, n
[2].e
, n
[3].i
,
8694 get_pointer(&n
[4])));
8696 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8697 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8701 case OPCODE_BEGIN_QUERY_ARB
:
8702 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8704 case OPCODE_END_QUERY_ARB
:
8705 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8707 case OPCODE_QUERY_COUNTER
:
8708 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8710 case OPCODE_BEGIN_QUERY_INDEXED
:
8711 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8713 case OPCODE_END_QUERY_INDEXED
:
8714 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8716 case OPCODE_DRAW_BUFFERS_ARB
:
8718 GLenum buffers
[MAX_DRAW_BUFFERS
];
8719 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8720 for (i
= 0; i
< count
; i
++)
8721 buffers
[i
] = n
[2 + i
].e
;
8722 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8725 case OPCODE_BLIT_FRAMEBUFFER
:
8726 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8727 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8730 case OPCODE_PRIMITIVE_RESTART_NV
:
8731 CALL_PrimitiveRestartNV(ctx
->Exec
, ());
8734 case OPCODE_USE_PROGRAM
:
8735 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8737 case OPCODE_UNIFORM_1F
:
8738 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8740 case OPCODE_UNIFORM_2F
:
8741 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8743 case OPCODE_UNIFORM_3F
:
8744 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8746 case OPCODE_UNIFORM_4F
:
8747 CALL_Uniform4f(ctx
->Exec
,
8748 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8750 case OPCODE_UNIFORM_1FV
:
8751 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8753 case OPCODE_UNIFORM_2FV
:
8754 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8756 case OPCODE_UNIFORM_3FV
:
8757 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8759 case OPCODE_UNIFORM_4FV
:
8760 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8762 case OPCODE_UNIFORM_1I
:
8763 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8765 case OPCODE_UNIFORM_2I
:
8766 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8768 case OPCODE_UNIFORM_3I
:
8769 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8771 case OPCODE_UNIFORM_4I
:
8772 CALL_Uniform4i(ctx
->Exec
,
8773 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8775 case OPCODE_UNIFORM_1IV
:
8776 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8778 case OPCODE_UNIFORM_2IV
:
8779 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8781 case OPCODE_UNIFORM_3IV
:
8782 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8784 case OPCODE_UNIFORM_4IV
:
8785 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8787 case OPCODE_UNIFORM_1UI
:
8788 CALL_Uniform1ui(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8790 case OPCODE_UNIFORM_2UI
:
8791 CALL_Uniform2ui(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8793 case OPCODE_UNIFORM_3UI
:
8794 CALL_Uniform3ui(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8796 case OPCODE_UNIFORM_4UI
:
8797 CALL_Uniform4ui(ctx
->Exec
,
8798 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8800 case OPCODE_UNIFORM_1UIV
:
8801 CALL_Uniform1uiv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8803 case OPCODE_UNIFORM_2UIV
:
8804 CALL_Uniform2uiv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8806 case OPCODE_UNIFORM_3UIV
:
8807 CALL_Uniform3uiv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8809 case OPCODE_UNIFORM_4UIV
:
8810 CALL_Uniform4uiv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8812 case OPCODE_UNIFORM_MATRIX22
:
8813 CALL_UniformMatrix2fv(ctx
->Exec
,
8814 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8816 case OPCODE_UNIFORM_MATRIX33
:
8817 CALL_UniformMatrix3fv(ctx
->Exec
,
8818 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8820 case OPCODE_UNIFORM_MATRIX44
:
8821 CALL_UniformMatrix4fv(ctx
->Exec
,
8822 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8824 case OPCODE_UNIFORM_MATRIX23
:
8825 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8826 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8828 case OPCODE_UNIFORM_MATRIX32
:
8829 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8830 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8832 case OPCODE_UNIFORM_MATRIX24
:
8833 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8834 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8836 case OPCODE_UNIFORM_MATRIX42
:
8837 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8838 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8840 case OPCODE_UNIFORM_MATRIX34
:
8841 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8842 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8844 case OPCODE_UNIFORM_MATRIX43
:
8845 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8846 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8849 case OPCODE_USE_PROGRAM_STAGES
:
8850 CALL_UseProgramStages(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8852 case OPCODE_PROGRAM_UNIFORM_1F
:
8853 CALL_ProgramUniform1f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
));
8855 case OPCODE_PROGRAM_UNIFORM_2F
:
8856 CALL_ProgramUniform2f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
, n
[4].f
));
8858 case OPCODE_PROGRAM_UNIFORM_3F
:
8859 CALL_ProgramUniform3f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8860 n
[3].f
, n
[4].f
, n
[5].f
));
8862 case OPCODE_PROGRAM_UNIFORM_4F
:
8863 CALL_ProgramUniform4f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8864 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8866 case OPCODE_PROGRAM_UNIFORM_1FV
:
8867 CALL_ProgramUniform1fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8868 get_pointer(&n
[4])));
8870 case OPCODE_PROGRAM_UNIFORM_2FV
:
8871 CALL_ProgramUniform2fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8872 get_pointer(&n
[4])));
8874 case OPCODE_PROGRAM_UNIFORM_3FV
:
8875 CALL_ProgramUniform3fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8876 get_pointer(&n
[4])));
8878 case OPCODE_PROGRAM_UNIFORM_4FV
:
8879 CALL_ProgramUniform4fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8880 get_pointer(&n
[4])));
8882 case OPCODE_PROGRAM_UNIFORM_1I
:
8883 CALL_ProgramUniform1i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
));
8885 case OPCODE_PROGRAM_UNIFORM_2I
:
8886 CALL_ProgramUniform2i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].i
));
8888 case OPCODE_PROGRAM_UNIFORM_3I
:
8889 CALL_ProgramUniform3i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8890 n
[3].i
, n
[4].i
, n
[5].i
));
8892 case OPCODE_PROGRAM_UNIFORM_4I
:
8893 CALL_ProgramUniform4i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8894 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
));
8896 case OPCODE_PROGRAM_UNIFORM_1IV
:
8897 CALL_ProgramUniform1iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8898 get_pointer(&n
[4])));
8900 case OPCODE_PROGRAM_UNIFORM_2IV
:
8901 CALL_ProgramUniform2iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8902 get_pointer(&n
[4])));
8904 case OPCODE_PROGRAM_UNIFORM_3IV
:
8905 CALL_ProgramUniform3iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8906 get_pointer(&n
[4])));
8908 case OPCODE_PROGRAM_UNIFORM_4IV
:
8909 CALL_ProgramUniform4iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8910 get_pointer(&n
[4])));
8912 case OPCODE_PROGRAM_UNIFORM_1UI
:
8913 CALL_ProgramUniform1ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].ui
));
8915 case OPCODE_PROGRAM_UNIFORM_2UI
:
8916 CALL_ProgramUniform2ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8919 case OPCODE_PROGRAM_UNIFORM_3UI
:
8920 CALL_ProgramUniform3ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8921 n
[3].ui
, n
[4].ui
, n
[5].ui
));
8923 case OPCODE_PROGRAM_UNIFORM_4UI
:
8924 CALL_ProgramUniform4ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8926 n
[4].ui
, n
[5].ui
, n
[6].ui
));
8928 case OPCODE_PROGRAM_UNIFORM_1UIV
:
8929 CALL_ProgramUniform1uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8930 get_pointer(&n
[4])));
8932 case OPCODE_PROGRAM_UNIFORM_2UIV
:
8933 CALL_ProgramUniform2uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8934 get_pointer(&n
[4])));
8936 case OPCODE_PROGRAM_UNIFORM_3UIV
:
8937 CALL_ProgramUniform3uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8938 get_pointer(&n
[4])));
8940 case OPCODE_PROGRAM_UNIFORM_4UIV
:
8941 CALL_ProgramUniform4uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8942 get_pointer(&n
[4])));
8944 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
8945 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
8946 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8947 get_pointer(&n
[5])));
8949 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
8950 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
8951 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8952 get_pointer(&n
[5])));
8954 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
8955 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
8956 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8957 get_pointer(&n
[5])));
8959 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
8960 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
8961 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8962 get_pointer(&n
[5])));
8964 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
8965 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
8966 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8967 get_pointer(&n
[5])));
8969 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
8970 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
8971 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8972 get_pointer(&n
[5])));
8974 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
8975 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
8976 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8977 get_pointer(&n
[5])));
8979 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
8980 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
8981 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8982 get_pointer(&n
[5])));
8984 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
8985 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
8986 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8987 get_pointer(&n
[5])));
8990 case OPCODE_CLIP_CONTROL
:
8991 CALL_ClipControl(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8994 case OPCODE_CLAMP_COLOR
:
8995 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8998 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8999 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
9001 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
9002 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (n
[1].ui
, &n
[2].f
));
9004 case OPCODE_ATTR_1F_NV
:
9005 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
9007 case OPCODE_ATTR_2F_NV
:
9008 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
9010 case OPCODE_ATTR_3F_NV
:
9011 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
9013 case OPCODE_ATTR_4F_NV
:
9014 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
9016 case OPCODE_ATTR_1F_ARB
:
9017 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
9019 case OPCODE_ATTR_2F_ARB
:
9020 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
9022 case OPCODE_ATTR_3F_ARB
:
9023 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
9025 case OPCODE_ATTR_4F_ARB
:
9026 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
9028 case OPCODE_MATERIAL
:
9029 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
9032 CALL_Begin(ctx
->Exec
, (n
[1].e
));
9035 CALL_End(ctx
->Exec
, ());
9038 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
9040 case OPCODE_EVAL_C1
:
9041 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
9043 case OPCODE_EVAL_C2
:
9044 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
9046 case OPCODE_EVAL_P1
:
9047 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
9049 case OPCODE_EVAL_P2
:
9050 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
9053 /* GL_EXT_texture_integer */
9054 case OPCODE_CLEARCOLOR_I
:
9055 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
9057 case OPCODE_CLEARCOLOR_UI
:
9058 CALL_ClearColorIuiEXT(ctx
->Exec
,
9059 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
9061 case OPCODE_TEXPARAMETER_I
:
9068 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
9071 case OPCODE_TEXPARAMETER_UI
:
9074 params
[0] = n
[3].ui
;
9075 params
[1] = n
[4].ui
;
9076 params
[2] = n
[5].ui
;
9077 params
[3] = n
[6].ui
;
9078 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
9082 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
9083 /* GL_ARB_instanced_arrays */
9084 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
9087 case OPCODE_TEXTURE_BARRIER_NV
:
9088 CALL_TextureBarrierNV(ctx
->Exec
, ());
9091 /* GL_EXT/ARB_transform_feedback */
9092 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
9093 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
9095 case OPCODE_END_TRANSFORM_FEEDBACK
:
9096 CALL_EndTransformFeedback(ctx
->Exec
, ());
9098 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
9099 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
9101 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
9102 CALL_PauseTransformFeedback(ctx
->Exec
, ());
9104 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
9105 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
9107 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
9108 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
9110 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
9111 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
9112 (n
[1].e
, n
[2].ui
, n
[3].ui
));
9114 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
9115 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
9116 (n
[1].e
, n
[2].ui
, n
[3].si
));
9118 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
9119 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
9120 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
9124 case OPCODE_BIND_SAMPLER
:
9125 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
9127 case OPCODE_SAMPLER_PARAMETERIV
:
9134 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9137 case OPCODE_SAMPLER_PARAMETERFV
:
9144 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9147 case OPCODE_SAMPLER_PARAMETERIIV
:
9154 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9157 case OPCODE_SAMPLER_PARAMETERUIV
:
9160 params
[0] = n
[3].ui
;
9161 params
[1] = n
[4].ui
;
9162 params
[2] = n
[5].ui
;
9163 params
[3] = n
[6].ui
;
9164 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
9169 case OPCODE_WAIT_SYNC
:
9171 union uint64_pair p
;
9172 p
.uint32
[0] = n
[2].ui
;
9173 p
.uint32
[1] = n
[3].ui
;
9174 CALL_WaitSync(ctx
->Exec
,
9175 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
9179 /* GL_NV_conditional_render */
9180 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
9181 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
9183 case OPCODE_END_CONDITIONAL_RENDER
:
9184 CALL_EndConditionalRender(ctx
->Exec
, ());
9187 case OPCODE_UNIFORM_BLOCK_BINDING
:
9188 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
9191 /* GL_EXT_window_rectangles */
9192 case OPCODE_WINDOW_RECTANGLES
:
9193 CALL_WindowRectanglesEXT(
9194 ctx
->Exec
, (n
[1].e
, n
[2].si
, get_pointer(&n
[3])));
9197 /* GL_NV_conservative_raster */
9198 case OPCODE_SUBPIXEL_PRECISION_BIAS
:
9199 CALL_SubpixelPrecisionBiasNV(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
9202 /* GL_NV_conservative_raster_dilate */
9203 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_F
:
9204 CALL_ConservativeRasterParameterfNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
9207 /* GL_NV_conservative_raster_pre_snap_triangles */
9208 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_I
:
9209 CALL_ConservativeRasterParameteriNV(ctx
->Exec
, (n
[1].e
, n
[2].i
));
9212 case OPCODE_CONTINUE
:
9213 n
= (Node
*) get_pointer(&n
[1]);
9218 case OPCODE_END_OF_LIST
:
9224 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
9226 _mesa_problem(ctx
, "%s", msg
);
9231 /* increment n to point to next compiled command */
9232 if (opcode
!= OPCODE_CONTINUE
) {
9233 assert(InstSize
[opcode
] > 0);
9234 n
+= InstSize
[opcode
];
9239 vbo_save_EndCallList(ctx
);
9241 ctx
->ListState
.CallDepth
--;
9246 /**********************************************************************/
9248 /**********************************************************************/
9251 * Test if a display list number is valid.
9253 GLboolean GLAPIENTRY
9254 _mesa_IsList(GLuint list
)
9256 GET_CURRENT_CONTEXT(ctx
);
9257 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9258 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
9259 return islist(ctx
, list
);
9264 * Delete a sequence of consecutive display lists.
9267 _mesa_DeleteLists(GLuint list
, GLsizei range
)
9269 GET_CURRENT_CONTEXT(ctx
);
9271 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9272 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9275 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
9280 /* We may be deleting a set of bitmap lists. See if there's a
9281 * bitmap atlas to free.
9283 struct gl_bitmap_atlas
*atlas
= lookup_bitmap_atlas(ctx
, list
);
9285 _mesa_delete_bitmap_atlas(ctx
, atlas
);
9286 _mesa_HashRemove(ctx
->Shared
->BitmapAtlas
, list
);
9290 for (i
= list
; i
< list
+ range
; i
++) {
9291 destroy_list(ctx
, i
);
9297 * Return a display list number, n, such that lists n through n+range-1
9301 _mesa_GenLists(GLsizei range
)
9303 GET_CURRENT_CONTEXT(ctx
);
9305 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9306 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
9309 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
9317 * Make this an atomic operation
9319 _mesa_HashLockMutex(ctx
->Shared
->DisplayList
);
9321 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
9323 /* reserve the list IDs by with empty/dummy lists */
9325 for (i
= 0; i
< range
; i
++) {
9326 _mesa_HashInsertLocked(ctx
->Shared
->DisplayList
, base
+ i
,
9327 make_list(base
+ i
, 1));
9331 if (USE_BITMAP_ATLAS
&&
9333 ctx
->Driver
.DrawAtlasBitmaps
) {
9334 /* "range > 16" is a rough heuristic to guess when glGenLists might be
9335 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
9336 * Create the empty atlas now.
9338 struct gl_bitmap_atlas
*atlas
= lookup_bitmap_atlas(ctx
, base
);
9340 atlas
= alloc_bitmap_atlas(ctx
, base
);
9343 /* Atlas _should_ be new/empty now, but clobbering is OK */
9344 assert(atlas
->numBitmaps
== 0);
9345 atlas
->numBitmaps
= range
;
9349 _mesa_HashUnlockMutex(ctx
->Shared
->DisplayList
);
9356 * Begin a new display list.
9359 _mesa_NewList(GLuint name
, GLenum mode
)
9361 GET_CURRENT_CONTEXT(ctx
);
9363 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
9364 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9366 if (MESA_VERBOSE
& VERBOSE_API
)
9367 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
9368 _mesa_enum_to_string(mode
));
9371 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
9375 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
9376 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
9380 if (ctx
->ListState
.CurrentList
) {
9381 /* already compiling a display list */
9382 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
9386 ctx
->CompileFlag
= GL_TRUE
;
9387 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
9389 /* Reset accumulated list state */
9390 invalidate_saved_current_state( ctx
);
9392 /* Allocate new display list */
9393 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
9394 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
9395 ctx
->ListState
.CurrentPos
= 0;
9397 vbo_save_NewList(ctx
, name
, mode
);
9399 ctx
->CurrentServerDispatch
= ctx
->Save
;
9400 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9401 if (ctx
->MarshalExec
== NULL
) {
9402 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9408 * End definition of current display list.
9413 GET_CURRENT_CONTEXT(ctx
);
9414 SAVE_FLUSH_VERTICES(ctx
);
9415 FLUSH_VERTICES(ctx
, 0);
9417 if (MESA_VERBOSE
& VERBOSE_API
)
9418 _mesa_debug(ctx
, "glEndList\n");
9420 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
9421 _mesa_error(ctx
, GL_INVALID_OPERATION
,
9422 "glEndList() called inside glBegin/End");
9425 /* Check that a list is under construction */
9426 if (!ctx
->ListState
.CurrentList
) {
9427 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
9431 /* Call before emitting END_OF_LIST, in case the driver wants to
9432 * emit opcodes itself.
9434 vbo_save_EndList(ctx
);
9436 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
9440 /* Destroy old list, if any */
9441 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
9443 /* Install the new list */
9444 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
9445 ctx
->ListState
.CurrentList
->Name
,
9446 ctx
->ListState
.CurrentList
);
9449 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
9450 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
9452 ctx
->ListState
.CurrentList
= NULL
;
9453 ctx
->ListState
.CurrentBlock
= NULL
;
9454 ctx
->ListState
.CurrentPos
= 0;
9455 ctx
->ExecuteFlag
= GL_TRUE
;
9456 ctx
->CompileFlag
= GL_FALSE
;
9458 ctx
->CurrentServerDispatch
= ctx
->Exec
;
9459 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9460 if (ctx
->MarshalExec
== NULL
) {
9461 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9467 _mesa_CallList(GLuint list
)
9469 GLboolean save_compile_flag
;
9470 GET_CURRENT_CONTEXT(ctx
);
9471 FLUSH_CURRENT(ctx
, 0);
9473 if (MESA_VERBOSE
& VERBOSE_API
)
9474 _mesa_debug(ctx
, "glCallList %d\n", list
);
9477 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
9482 mesa_print_display_list( list
);
9484 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9485 * execute the display list, and restore the CompileFlag.
9487 save_compile_flag
= ctx
->CompileFlag
;
9488 if (save_compile_flag
) {
9489 ctx
->CompileFlag
= GL_FALSE
;
9492 execute_list(ctx
, list
);
9493 ctx
->CompileFlag
= save_compile_flag
;
9495 /* also restore API function pointers to point to "save" versions */
9496 if (save_compile_flag
) {
9497 ctx
->CurrentServerDispatch
= ctx
->Save
;
9498 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9499 if (ctx
->MarshalExec
== NULL
) {
9500 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9507 * Try to execute a glCallLists() command where the display lists contain
9508 * glBitmap commands with a texture atlas.
9509 * \return true for success, false otherwise
9512 render_bitmap_atlas(struct gl_context
*ctx
, GLsizei n
, GLenum type
,
9515 struct gl_bitmap_atlas
*atlas
;
9518 if (!USE_BITMAP_ATLAS
||
9519 !ctx
->Current
.RasterPosValid
||
9520 ctx
->List
.ListBase
== 0 ||
9521 type
!= GL_UNSIGNED_BYTE
||
9522 !ctx
->Driver
.DrawAtlasBitmaps
) {
9527 atlas
= lookup_bitmap_atlas(ctx
, ctx
->List
.ListBase
);
9530 /* Even if glGenLists wasn't called, we can still try to create
9533 atlas
= alloc_bitmap_atlas(ctx
, ctx
->List
.ListBase
);
9536 if (atlas
&& !atlas
->complete
&& !atlas
->incomplete
) {
9537 /* Try to build the bitmap atlas now.
9538 * If the atlas was created in glGenLists, we'll have recorded the
9539 * number of lists (bitmaps). Otherwise, take a guess at 256.
9541 if (atlas
->numBitmaps
== 0)
9542 atlas
->numBitmaps
= 256;
9543 build_bitmap_atlas(ctx
, atlas
, ctx
->List
.ListBase
);
9546 if (!atlas
|| !atlas
->complete
) {
9550 /* check that all display list IDs are in the atlas */
9551 for (i
= 0; i
< n
; i
++) {
9552 const GLubyte
*ids
= (const GLubyte
*) lists
;
9554 if (ids
[i
] >= atlas
->numBitmaps
) {
9559 ctx
->Driver
.DrawAtlasBitmaps(ctx
, atlas
, n
, (const GLubyte
*) lists
);
9566 * Execute glCallLists: call multiple display lists.
9569 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
9571 GET_CURRENT_CONTEXT(ctx
);
9573 GLboolean save_compile_flag
;
9575 if (MESA_VERBOSE
& VERBOSE_API
)
9576 _mesa_debug(ctx
, "glCallLists %d\n", n
);
9580 case GL_UNSIGNED_BYTE
:
9582 case GL_UNSIGNED_SHORT
:
9584 case GL_UNSIGNED_INT
:
9592 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
9597 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallLists(n < 0)");
9599 } else if (n
== 0 || lists
== NULL
) {
9604 if (render_bitmap_atlas(ctx
, n
, type
, lists
)) {
9608 /* Save the CompileFlag status, turn it off, execute display list,
9609 * and restore the CompileFlag.
9611 save_compile_flag
= ctx
->CompileFlag
;
9612 ctx
->CompileFlag
= GL_FALSE
;
9614 for (i
= 0; i
< n
; i
++) {
9615 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
9616 execute_list(ctx
, list
);
9619 ctx
->CompileFlag
= save_compile_flag
;
9621 /* also restore API function pointers to point to "save" versions */
9622 if (save_compile_flag
) {
9623 ctx
->CurrentServerDispatch
= ctx
->Save
;
9624 _glapi_set_dispatch(ctx
->CurrentServerDispatch
);
9625 if (ctx
->MarshalExec
== NULL
) {
9626 ctx
->CurrentClientDispatch
= ctx
->CurrentServerDispatch
;
9633 * Set the offset added to list numbers in glCallLists.
9636 _mesa_ListBase(GLuint base
)
9638 GET_CURRENT_CONTEXT(ctx
);
9639 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9640 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9641 ctx
->List
.ListBase
= base
;
9645 * Setup the given dispatch table to point to Mesa's display list
9646 * building functions.
9648 * This does not include any of the tnl functions - they are
9649 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9653 _mesa_initialize_save_table(const struct gl_context
*ctx
)
9655 struct _glapi_table
*table
= ctx
->Save
;
9656 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
9658 /* Initially populate the dispatch table with the contents of the
9659 * normal-execution dispatch table. This lets us skip populating functions
9660 * that should be called directly instead of compiled into display lists.
9662 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
9664 _mesa_loopback_init_api_table(ctx
, table
);
9667 vbo_initialize_save_dispatch(ctx
, table
);
9670 SET_Accum(table
, save_Accum
);
9671 SET_AlphaFunc(table
, save_AlphaFunc
);
9672 SET_Bitmap(table
, save_Bitmap
);
9673 SET_BlendFunc(table
, save_BlendFunc
);
9674 SET_CallList(table
, save_CallList
);
9675 SET_CallLists(table
, save_CallLists
);
9676 SET_Clear(table
, save_Clear
);
9677 SET_ClearAccum(table
, save_ClearAccum
);
9678 SET_ClearColor(table
, save_ClearColor
);
9679 SET_ClearDepth(table
, save_ClearDepth
);
9680 SET_ClearIndex(table
, save_ClearIndex
);
9681 SET_ClearStencil(table
, save_ClearStencil
);
9682 SET_ClipPlane(table
, save_ClipPlane
);
9683 SET_ColorMask(table
, save_ColorMask
);
9684 SET_ColorMaski(table
, save_ColorMaskIndexed
);
9685 SET_ColorMaterial(table
, save_ColorMaterial
);
9686 SET_CopyPixels(table
, save_CopyPixels
);
9687 SET_CullFace(table
, save_CullFace
);
9688 SET_DepthFunc(table
, save_DepthFunc
);
9689 SET_DepthMask(table
, save_DepthMask
);
9690 SET_DepthRange(table
, save_DepthRange
);
9691 SET_Disable(table
, save_Disable
);
9692 SET_Disablei(table
, save_DisableIndexed
);
9693 SET_DrawBuffer(table
, save_DrawBuffer
);
9694 SET_DrawPixels(table
, save_DrawPixels
);
9695 SET_Enable(table
, save_Enable
);
9696 SET_Enablei(table
, save_EnableIndexed
);
9697 SET_EvalMesh1(table
, save_EvalMesh1
);
9698 SET_EvalMesh2(table
, save_EvalMesh2
);
9699 SET_Fogf(table
, save_Fogf
);
9700 SET_Fogfv(table
, save_Fogfv
);
9701 SET_Fogi(table
, save_Fogi
);
9702 SET_Fogiv(table
, save_Fogiv
);
9703 SET_FrontFace(table
, save_FrontFace
);
9704 SET_Frustum(table
, save_Frustum
);
9705 SET_Hint(table
, save_Hint
);
9706 SET_IndexMask(table
, save_IndexMask
);
9707 SET_InitNames(table
, save_InitNames
);
9708 SET_LightModelf(table
, save_LightModelf
);
9709 SET_LightModelfv(table
, save_LightModelfv
);
9710 SET_LightModeli(table
, save_LightModeli
);
9711 SET_LightModeliv(table
, save_LightModeliv
);
9712 SET_Lightf(table
, save_Lightf
);
9713 SET_Lightfv(table
, save_Lightfv
);
9714 SET_Lighti(table
, save_Lighti
);
9715 SET_Lightiv(table
, save_Lightiv
);
9716 SET_LineStipple(table
, save_LineStipple
);
9717 SET_LineWidth(table
, save_LineWidth
);
9718 SET_ListBase(table
, save_ListBase
);
9719 SET_LoadIdentity(table
, save_LoadIdentity
);
9720 SET_LoadMatrixd(table
, save_LoadMatrixd
);
9721 SET_LoadMatrixf(table
, save_LoadMatrixf
);
9722 SET_LoadName(table
, save_LoadName
);
9723 SET_LogicOp(table
, save_LogicOp
);
9724 SET_Map1d(table
, save_Map1d
);
9725 SET_Map1f(table
, save_Map1f
);
9726 SET_Map2d(table
, save_Map2d
);
9727 SET_Map2f(table
, save_Map2f
);
9728 SET_MapGrid1d(table
, save_MapGrid1d
);
9729 SET_MapGrid1f(table
, save_MapGrid1f
);
9730 SET_MapGrid2d(table
, save_MapGrid2d
);
9731 SET_MapGrid2f(table
, save_MapGrid2f
);
9732 SET_MatrixMode(table
, save_MatrixMode
);
9733 SET_MultMatrixd(table
, save_MultMatrixd
);
9734 SET_MultMatrixf(table
, save_MultMatrixf
);
9735 SET_NewList(table
, save_NewList
);
9736 SET_Ortho(table
, save_Ortho
);
9737 SET_PassThrough(table
, save_PassThrough
);
9738 SET_PixelMapfv(table
, save_PixelMapfv
);
9739 SET_PixelMapuiv(table
, save_PixelMapuiv
);
9740 SET_PixelMapusv(table
, save_PixelMapusv
);
9741 SET_PixelTransferf(table
, save_PixelTransferf
);
9742 SET_PixelTransferi(table
, save_PixelTransferi
);
9743 SET_PixelZoom(table
, save_PixelZoom
);
9744 SET_PointSize(table
, save_PointSize
);
9745 SET_PolygonMode(table
, save_PolygonMode
);
9746 SET_PolygonOffset(table
, save_PolygonOffset
);
9747 SET_PolygonStipple(table
, save_PolygonStipple
);
9748 SET_PopAttrib(table
, save_PopAttrib
);
9749 SET_PopMatrix(table
, save_PopMatrix
);
9750 SET_PopName(table
, save_PopName
);
9751 SET_PushAttrib(table
, save_PushAttrib
);
9752 SET_PushMatrix(table
, save_PushMatrix
);
9753 SET_PushName(table
, save_PushName
);
9754 SET_RasterPos2d(table
, save_RasterPos2d
);
9755 SET_RasterPos2dv(table
, save_RasterPos2dv
);
9756 SET_RasterPos2f(table
, save_RasterPos2f
);
9757 SET_RasterPos2fv(table
, save_RasterPos2fv
);
9758 SET_RasterPos2i(table
, save_RasterPos2i
);
9759 SET_RasterPos2iv(table
, save_RasterPos2iv
);
9760 SET_RasterPos2s(table
, save_RasterPos2s
);
9761 SET_RasterPos2sv(table
, save_RasterPos2sv
);
9762 SET_RasterPos3d(table
, save_RasterPos3d
);
9763 SET_RasterPos3dv(table
, save_RasterPos3dv
);
9764 SET_RasterPos3f(table
, save_RasterPos3f
);
9765 SET_RasterPos3fv(table
, save_RasterPos3fv
);
9766 SET_RasterPos3i(table
, save_RasterPos3i
);
9767 SET_RasterPos3iv(table
, save_RasterPos3iv
);
9768 SET_RasterPos3s(table
, save_RasterPos3s
);
9769 SET_RasterPos3sv(table
, save_RasterPos3sv
);
9770 SET_RasterPos4d(table
, save_RasterPos4d
);
9771 SET_RasterPos4dv(table
, save_RasterPos4dv
);
9772 SET_RasterPos4f(table
, save_RasterPos4f
);
9773 SET_RasterPos4fv(table
, save_RasterPos4fv
);
9774 SET_RasterPos4i(table
, save_RasterPos4i
);
9775 SET_RasterPos4iv(table
, save_RasterPos4iv
);
9776 SET_RasterPos4s(table
, save_RasterPos4s
);
9777 SET_RasterPos4sv(table
, save_RasterPos4sv
);
9778 SET_ReadBuffer(table
, save_ReadBuffer
);
9779 SET_Rectf(table
, save_Rectf
);
9780 SET_Rotated(table
, save_Rotated
);
9781 SET_Rotatef(table
, save_Rotatef
);
9782 SET_Scaled(table
, save_Scaled
);
9783 SET_Scalef(table
, save_Scalef
);
9784 SET_Scissor(table
, save_Scissor
);
9785 SET_ShadeModel(table
, save_ShadeModel
);
9786 SET_StencilFunc(table
, save_StencilFunc
);
9787 SET_StencilMask(table
, save_StencilMask
);
9788 SET_StencilOp(table
, save_StencilOp
);
9789 SET_TexEnvf(table
, save_TexEnvf
);
9790 SET_TexEnvfv(table
, save_TexEnvfv
);
9791 SET_TexEnvi(table
, save_TexEnvi
);
9792 SET_TexEnviv(table
, save_TexEnviv
);
9793 SET_TexGend(table
, save_TexGend
);
9794 SET_TexGendv(table
, save_TexGendv
);
9795 SET_TexGenf(table
, save_TexGenf
);
9796 SET_TexGenfv(table
, save_TexGenfv
);
9797 SET_TexGeni(table
, save_TexGeni
);
9798 SET_TexGeniv(table
, save_TexGeniv
);
9799 SET_TexImage1D(table
, save_TexImage1D
);
9800 SET_TexImage2D(table
, save_TexImage2D
);
9801 SET_TexParameterf(table
, save_TexParameterf
);
9802 SET_TexParameterfv(table
, save_TexParameterfv
);
9803 SET_TexParameteri(table
, save_TexParameteri
);
9804 SET_TexParameteriv(table
, save_TexParameteriv
);
9805 SET_Translated(table
, save_Translated
);
9806 SET_Translatef(table
, save_Translatef
);
9807 SET_Viewport(table
, save_Viewport
);
9810 SET_BindTexture(table
, save_BindTexture
);
9811 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
9812 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
9813 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
9814 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
9815 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
9816 SET_TexSubImage1D(table
, save_TexSubImage1D
);
9817 SET_TexSubImage2D(table
, save_TexSubImage2D
);
9820 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
9821 SET_TexImage3D(table
, save_TexImage3D
);
9822 SET_TexSubImage3D(table
, save_TexSubImage3D
);
9825 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
9826 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
9827 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
9829 /* ATI_separate_stencil */
9830 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
9832 /* GL_ARB_imaging */
9833 /* Not all are supported */
9834 SET_BlendColor(table
, save_BlendColor
);
9835 SET_BlendEquation(table
, save_BlendEquation
);
9837 /* 2. GL_EXT_blend_color */
9839 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9842 /* 3. GL_EXT_polygon_offset */
9843 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9845 /* 6. GL_EXT_texture3d */
9847 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9848 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9849 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9852 /* 37. GL_EXT_blend_minmax */
9854 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9857 /* 54. GL_EXT_point_parameters */
9858 SET_PointParameterf(table
, save_PointParameterfEXT
);
9859 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9861 /* 173. GL_EXT_blend_func_separate */
9862 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9864 /* 197. GL_MESA_window_pos */
9865 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9866 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9867 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9868 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9869 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9870 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9871 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9872 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9873 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9874 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9875 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9876 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9877 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9878 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9879 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9880 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9881 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9882 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9883 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9884 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9885 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9886 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9887 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9888 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9890 /* 245. GL_ATI_fragment_shader */
9891 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9892 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9894 /* 262. GL_NV_point_sprite */
9895 SET_PointParameteri(table
, save_PointParameteriNV
);
9896 SET_PointParameteriv(table
, save_PointParameterivNV
);
9898 /* 268. GL_EXT_stencil_two_side */
9899 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9901 /* ???. GL_EXT_depth_bounds_test */
9902 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9904 /* ARB 1. GL_ARB_multitexture */
9905 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9907 /* ARB 3. GL_ARB_transpose_matrix */
9908 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9909 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9910 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9911 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9913 /* ARB 5. GL_ARB_multisample */
9914 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9916 /* ARB 12. GL_ARB_texture_compression */
9917 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9918 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9919 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9920 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9921 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9922 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9924 /* ARB 14. GL_ARB_point_parameters */
9925 /* aliased with EXT_point_parameters functions */
9927 /* ARB 25. GL_ARB_window_pos */
9928 /* aliased with MESA_window_pos functions */
9930 /* ARB 26. GL_ARB_vertex_program */
9931 /* ARB 27. GL_ARB_fragment_program */
9932 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9933 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9934 SET_BindProgramARB(table
, save_BindProgramARB
);
9935 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9936 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9937 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9938 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9939 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9940 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9941 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9942 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9944 SET_BeginQuery(table
, save_BeginQueryARB
);
9945 SET_EndQuery(table
, save_EndQueryARB
);
9946 SET_QueryCounter(table
, save_QueryCounter
);
9948 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9950 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9952 SET_UseProgram(table
, save_UseProgram
);
9953 SET_Uniform1f(table
, save_Uniform1fARB
);
9954 SET_Uniform2f(table
, save_Uniform2fARB
);
9955 SET_Uniform3f(table
, save_Uniform3fARB
);
9956 SET_Uniform4f(table
, save_Uniform4fARB
);
9957 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9958 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9959 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9960 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9961 SET_Uniform1i(table
, save_Uniform1iARB
);
9962 SET_Uniform2i(table
, save_Uniform2iARB
);
9963 SET_Uniform3i(table
, save_Uniform3iARB
);
9964 SET_Uniform4i(table
, save_Uniform4iARB
);
9965 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9966 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9967 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9968 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9969 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9970 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9971 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9972 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9973 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9974 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9975 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9976 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9977 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9979 /* 299. GL_EXT_blend_equation_separate */
9980 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9982 /* GL_EXT_gpu_program_parameters */
9983 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9984 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9986 /* 364. GL_EXT_provoking_vertex */
9987 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9989 /* GL_EXT_texture_integer */
9990 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9991 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9992 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9993 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9995 /* GL_ARB_clip_control */
9996 SET_ClipControl(table
, save_ClipControl
);
9998 /* GL_ARB_color_buffer_float */
9999 SET_ClampColor(table
, save_ClampColorARB
);
10002 SET_ClearBufferiv(table
, save_ClearBufferiv
);
10003 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
10004 SET_ClearBufferfv(table
, save_ClearBufferfv
);
10005 SET_ClearBufferfi(table
, save_ClearBufferfi
);
10006 SET_Uniform1ui(table
, save_Uniform1ui
);
10007 SET_Uniform2ui(table
, save_Uniform2ui
);
10008 SET_Uniform3ui(table
, save_Uniform3ui
);
10009 SET_Uniform4ui(table
, save_Uniform4ui
);
10010 SET_Uniform1uiv(table
, save_Uniform1uiv
);
10011 SET_Uniform2uiv(table
, save_Uniform2uiv
);
10012 SET_Uniform3uiv(table
, save_Uniform3uiv
);
10013 SET_Uniform4uiv(table
, save_Uniform4uiv
);
10016 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
10017 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
10018 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
10019 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
10020 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
10021 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
10022 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
10023 SET_DrawTransformFeedbackInstanced(table
,
10024 save_DrawTransformFeedbackInstanced
);
10025 SET_DrawTransformFeedbackStreamInstanced(table
,
10026 save_DrawTransformFeedbackStreamInstanced
);
10027 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
10028 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
10030 /* GL_ARB_instanced_arrays */
10031 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
10033 /* GL_NV_texture_barrier */
10034 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
10036 SET_BindSampler(table
, save_BindSampler
);
10037 SET_SamplerParameteri(table
, save_SamplerParameteri
);
10038 SET_SamplerParameterf(table
, save_SamplerParameterf
);
10039 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
10040 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
10041 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
10042 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
10044 /* GL_ARB_draw_buffer_blend */
10045 SET_BlendFunciARB(table
, save_BlendFunci
);
10046 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
10047 SET_BlendEquationiARB(table
, save_BlendEquationi
);
10048 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
10050 /* GL_NV_conditional_render */
10051 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
10052 SET_EndConditionalRender(table
, save_EndConditionalRender
);
10055 SET_WaitSync(table
, save_WaitSync
);
10057 /* GL_ARB_uniform_buffer_object */
10058 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
10060 /* GL_ARB_draw_instanced */
10061 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
10062 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
10064 /* GL_ARB_draw_elements_base_vertex */
10065 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
10067 /* GL_ARB_base_instance */
10068 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
10069 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
10070 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
10072 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
10073 SET_UseProgramStages(table
, save_UseProgramStages
);
10074 SET_ProgramUniform1f(table
, save_ProgramUniform1f
);
10075 SET_ProgramUniform2f(table
, save_ProgramUniform2f
);
10076 SET_ProgramUniform3f(table
, save_ProgramUniform3f
);
10077 SET_ProgramUniform4f(table
, save_ProgramUniform4f
);
10078 SET_ProgramUniform1fv(table
, save_ProgramUniform1fv
);
10079 SET_ProgramUniform2fv(table
, save_ProgramUniform2fv
);
10080 SET_ProgramUniform3fv(table
, save_ProgramUniform3fv
);
10081 SET_ProgramUniform4fv(table
, save_ProgramUniform4fv
);
10082 SET_ProgramUniform1i(table
, save_ProgramUniform1i
);
10083 SET_ProgramUniform2i(table
, save_ProgramUniform2i
);
10084 SET_ProgramUniform3i(table
, save_ProgramUniform3i
);
10085 SET_ProgramUniform4i(table
, save_ProgramUniform4i
);
10086 SET_ProgramUniform1iv(table
, save_ProgramUniform1iv
);
10087 SET_ProgramUniform2iv(table
, save_ProgramUniform2iv
);
10088 SET_ProgramUniform3iv(table
, save_ProgramUniform3iv
);
10089 SET_ProgramUniform4iv(table
, save_ProgramUniform4iv
);
10090 SET_ProgramUniform1ui(table
, save_ProgramUniform1ui
);
10091 SET_ProgramUniform2ui(table
, save_ProgramUniform2ui
);
10092 SET_ProgramUniform3ui(table
, save_ProgramUniform3ui
);
10093 SET_ProgramUniform4ui(table
, save_ProgramUniform4ui
);
10094 SET_ProgramUniform1uiv(table
, save_ProgramUniform1uiv
);
10095 SET_ProgramUniform2uiv(table
, save_ProgramUniform2uiv
);
10096 SET_ProgramUniform3uiv(table
, save_ProgramUniform3uiv
);
10097 SET_ProgramUniform4uiv(table
, save_ProgramUniform4uiv
);
10098 SET_ProgramUniformMatrix2fv(table
, save_ProgramUniformMatrix2fv
);
10099 SET_ProgramUniformMatrix3fv(table
, save_ProgramUniformMatrix3fv
);
10100 SET_ProgramUniformMatrix4fv(table
, save_ProgramUniformMatrix4fv
);
10101 SET_ProgramUniformMatrix2x3fv(table
, save_ProgramUniformMatrix2x3fv
);
10102 SET_ProgramUniformMatrix3x2fv(table
, save_ProgramUniformMatrix3x2fv
);
10103 SET_ProgramUniformMatrix2x4fv(table
, save_ProgramUniformMatrix2x4fv
);
10104 SET_ProgramUniformMatrix4x2fv(table
, save_ProgramUniformMatrix4x2fv
);
10105 SET_ProgramUniformMatrix3x4fv(table
, save_ProgramUniformMatrix3x4fv
);
10106 SET_ProgramUniformMatrix4x3fv(table
, save_ProgramUniformMatrix4x3fv
);
10108 /* GL_{ARB,EXT}_polygon_offset_clamp */
10109 SET_PolygonOffsetClampEXT(table
, save_PolygonOffsetClampEXT
);
10111 /* GL_EXT_window_rectangles */
10112 SET_WindowRectanglesEXT(table
, save_WindowRectanglesEXT
);
10114 /* GL_NV_conservative_raster */
10115 SET_SubpixelPrecisionBiasNV(table
, save_SubpixelPrecisionBiasNV
);
10117 /* GL_NV_conservative_raster_dilate */
10118 SET_ConservativeRasterParameterfNV(table
, save_ConservativeRasterParameterfNV
);
10120 /* GL_NV_conservative_raster_pre_snap_triangles */
10121 SET_ConservativeRasterParameteriNV(table
, save_ConservativeRasterParameteriNV
);
10126 static const char *
10127 enum_string(GLenum k
)
10129 return _mesa_enum_to_string(k
);
10134 * Print the commands in a display list. For debugging only.
10135 * TODO: many commands aren't handled yet.
10136 * \param fname filename to write display list to. If null, use stdout.
10138 static void GLAPIENTRY
10139 print_list(struct gl_context
*ctx
, GLuint list
, const char *fname
)
10141 struct gl_display_list
*dlist
;
10147 f
= fopen(fname
, "w");
10152 if (!islist(ctx
, list
)) {
10153 fprintf(f
, "%u is not a display list ID\n", list
);
10157 dlist
= _mesa_lookup_list(ctx
, list
);
10164 fprintf(f
, "START-LIST %u, address %p\n", list
, (void *) n
);
10166 done
= n
? GL_FALSE
: GL_TRUE
;
10168 const OpCode opcode
= n
[0].opcode
;
10170 if (is_ext_opcode(opcode
)) {
10171 n
+= ext_opcode_print(ctx
, n
, f
);
10176 fprintf(f
, "Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
10178 case OPCODE_ACTIVE_TEXTURE
:
10179 fprintf(f
, "ActiveTexture(%s)\n", enum_string(n
[1].e
));
10181 case OPCODE_BITMAP
:
10182 fprintf(f
, "Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
10183 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
10184 get_pointer(&n
[7]));
10186 case OPCODE_BLEND_COLOR
:
10187 fprintf(f
, "BlendColor %f, %f, %f, %f\n",
10188 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10190 case OPCODE_BLEND_EQUATION
:
10191 fprintf(f
, "BlendEquation %s\n",
10192 enum_string(n
[1].e
));
10194 case OPCODE_BLEND_EQUATION_SEPARATE
:
10195 fprintf(f
, "BlendEquationSeparate %s, %s\n",
10196 enum_string(n
[1].e
),
10197 enum_string(n
[2].e
));
10199 case OPCODE_BLEND_FUNC_SEPARATE
:
10200 fprintf(f
, "BlendFuncSeparate %s, %s, %s, %s\n",
10201 enum_string(n
[1].e
),
10202 enum_string(n
[2].e
),
10203 enum_string(n
[3].e
),
10204 enum_string(n
[4].e
));
10206 case OPCODE_BLEND_EQUATION_I
:
10207 fprintf(f
, "BlendEquationi %u, %s\n",
10208 n
[1].ui
, enum_string(n
[2].e
));
10210 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
10211 fprintf(f
, "BlendEquationSeparatei %u, %s, %s\n",
10212 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
10214 case OPCODE_BLEND_FUNC_I
:
10215 fprintf(f
, "BlendFunci %u, %s, %s\n",
10216 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
10218 case OPCODE_BLEND_FUNC_SEPARATE_I
:
10219 fprintf(f
, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
10221 enum_string(n
[2].e
),
10222 enum_string(n
[3].e
),
10223 enum_string(n
[4].e
),
10224 enum_string(n
[5].e
));
10226 case OPCODE_CALL_LIST
:
10227 fprintf(f
, "CallList %d\n", (int) n
[1].ui
);
10229 case OPCODE_CALL_LISTS
:
10230 fprintf(f
, "CallLists %d, %s\n", n
[1].i
, enum_string(n
[1].e
));
10232 case OPCODE_DISABLE
:
10233 fprintf(f
, "Disable %s\n", enum_string(n
[1].e
));
10235 case OPCODE_ENABLE
:
10236 fprintf(f
, "Enable %s\n", enum_string(n
[1].e
));
10238 case OPCODE_FRUSTUM
:
10239 fprintf(f
, "Frustum %g %g %g %g %g %g\n",
10240 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10242 case OPCODE_LINE_STIPPLE
:
10243 fprintf(f
, "LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
10245 case OPCODE_LINE_WIDTH
:
10246 fprintf(f
, "LineWidth %f\n", n
[1].f
);
10248 case OPCODE_LOAD_IDENTITY
:
10249 fprintf(f
, "LoadIdentity\n");
10251 case OPCODE_LOAD_MATRIX
:
10252 fprintf(f
, "LoadMatrix\n");
10253 fprintf(f
, " %8f %8f %8f %8f\n",
10254 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
10255 fprintf(f
, " %8f %8f %8f %8f\n",
10256 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
10257 fprintf(f
, " %8f %8f %8f %8f\n",
10258 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
10259 fprintf(f
, " %8f %8f %8f %8f\n",
10260 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
10262 case OPCODE_MULT_MATRIX
:
10263 fprintf(f
, "MultMatrix (or Rotate)\n");
10264 fprintf(f
, " %8f %8f %8f %8f\n",
10265 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
10266 fprintf(f
, " %8f %8f %8f %8f\n",
10267 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
10268 fprintf(f
, " %8f %8f %8f %8f\n",
10269 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
10270 fprintf(f
, " %8f %8f %8f %8f\n",
10271 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
10274 fprintf(f
, "Ortho %g %g %g %g %g %g\n",
10275 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10277 case OPCODE_POINT_SIZE
:
10278 fprintf(f
, "PointSize %f\n", n
[1].f
);
10280 case OPCODE_POP_ATTRIB
:
10281 fprintf(f
, "PopAttrib\n");
10283 case OPCODE_POP_MATRIX
:
10284 fprintf(f
, "PopMatrix\n");
10286 case OPCODE_POP_NAME
:
10287 fprintf(f
, "PopName\n");
10289 case OPCODE_PUSH_ATTRIB
:
10290 fprintf(f
, "PushAttrib %x\n", n
[1].bf
);
10292 case OPCODE_PUSH_MATRIX
:
10293 fprintf(f
, "PushMatrix\n");
10295 case OPCODE_PUSH_NAME
:
10296 fprintf(f
, "PushName %d\n", (int) n
[1].ui
);
10298 case OPCODE_RASTER_POS
:
10299 fprintf(f
, "RasterPos %g %g %g %g\n",
10300 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10302 case OPCODE_ROTATE
:
10303 fprintf(f
, "Rotate %g %g %g %g\n",
10304 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
10307 fprintf(f
, "Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
10309 case OPCODE_TRANSLATE
:
10310 fprintf(f
, "Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
10312 case OPCODE_BIND_TEXTURE
:
10313 fprintf(f
, "BindTexture %s %d\n",
10314 _mesa_enum_to_string(n
[1].ui
), n
[2].ui
);
10316 case OPCODE_SHADE_MODEL
:
10317 fprintf(f
, "ShadeModel %s\n", _mesa_enum_to_string(n
[1].ui
));
10320 fprintf(f
, "Map1 %s %.3f %.3f %d %d\n",
10321 _mesa_enum_to_string(n
[1].ui
),
10322 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
10325 fprintf(f
, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
10326 _mesa_enum_to_string(n
[1].ui
),
10327 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
10328 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
10330 case OPCODE_MAPGRID1
:
10331 fprintf(f
, "MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
10333 case OPCODE_MAPGRID2
:
10334 fprintf(f
, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
10335 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
10337 case OPCODE_EVALMESH1
:
10338 fprintf(f
, "EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
10340 case OPCODE_EVALMESH2
:
10341 fprintf(f
, "EvalMesh2 %d %d %d %d\n",
10342 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
10345 case OPCODE_ATTR_1F_NV
:
10346 fprintf(f
, "ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
10348 case OPCODE_ATTR_2F_NV
:
10349 fprintf(f
, "ATTR_2F_NV attr %d: %f %f\n",
10350 n
[1].i
, n
[2].f
, n
[3].f
);
10352 case OPCODE_ATTR_3F_NV
:
10353 fprintf(f
, "ATTR_3F_NV attr %d: %f %f %f\n",
10354 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
10356 case OPCODE_ATTR_4F_NV
:
10357 fprintf(f
, "ATTR_4F_NV attr %d: %f %f %f %f\n",
10358 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
10360 case OPCODE_ATTR_1F_ARB
:
10361 fprintf(f
, "ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
10363 case OPCODE_ATTR_2F_ARB
:
10364 fprintf(f
, "ATTR_2F_ARB attr %d: %f %f\n",
10365 n
[1].i
, n
[2].f
, n
[3].f
);
10367 case OPCODE_ATTR_3F_ARB
:
10368 fprintf(f
, "ATTR_3F_ARB attr %d: %f %f %f\n",
10369 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
10371 case OPCODE_ATTR_4F_ARB
:
10372 fprintf(f
, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
10373 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
10376 case OPCODE_MATERIAL
:
10377 fprintf(f
, "MATERIAL %x %x: %f %f %f %f\n",
10378 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
10381 fprintf(f
, "BEGIN %x\n", n
[1].i
);
10384 fprintf(f
, "END\n");
10387 fprintf(f
, "RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
10390 case OPCODE_EVAL_C1
:
10391 fprintf(f
, "EVAL_C1 %f\n", n
[1].f
);
10393 case OPCODE_EVAL_C2
:
10394 fprintf(f
, "EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
10396 case OPCODE_EVAL_P1
:
10397 fprintf(f
, "EVAL_P1 %d\n", n
[1].i
);
10399 case OPCODE_EVAL_P2
:
10400 fprintf(f
, "EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
10403 case OPCODE_PROVOKING_VERTEX
:
10404 fprintf(f
, "ProvokingVertex %s\n",
10405 _mesa_enum_to_string(n
[1].ui
));
10409 * meta opcodes/commands
10412 fprintf(f
, "Error: %s %s\n", enum_string(n
[1].e
),
10413 (const char *) get_pointer(&n
[2]));
10415 case OPCODE_CONTINUE
:
10416 fprintf(f
, "DISPLAY-LIST-CONTINUE\n");
10417 n
= (Node
*) get_pointer(&n
[1]);
10420 fprintf(f
, "NOP\n");
10422 case OPCODE_END_OF_LIST
:
10423 fprintf(f
, "END-LIST %u\n", list
);
10427 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
10429 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
10430 opcode
, (void *) n
);
10434 fprintf(f
, "command %d, %u operands\n", opcode
,
10438 /* increment n to point to next compiled command */
10439 if (opcode
!= OPCODE_CONTINUE
) {
10440 assert(InstSize
[opcode
] > 0);
10441 n
+= InstSize
[opcode
];
10455 * Clients may call this function to help debug display list problems.
10456 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
10457 * changed, or break in the future without notice.
10460 mesa_print_display_list(GLuint list
)
10462 GET_CURRENT_CONTEXT(ctx
);
10463 print_list(ctx
, list
, NULL
);
10467 /**********************************************************************/
10468 /***** Initialization *****/
10469 /**********************************************************************/
10472 save_vtxfmt_init(GLvertexformat
* vfmt
)
10474 vfmt
->ArrayElement
= _ae_ArrayElement
;
10476 vfmt
->Begin
= save_Begin
;
10478 vfmt
->CallList
= save_CallList
;
10479 vfmt
->CallLists
= save_CallLists
;
10481 vfmt
->Color3f
= save_Color3f
;
10482 vfmt
->Color3fv
= save_Color3fv
;
10483 vfmt
->Color4f
= save_Color4f
;
10484 vfmt
->Color4fv
= save_Color4fv
;
10485 vfmt
->EdgeFlag
= save_EdgeFlag
;
10486 vfmt
->End
= save_End
;
10488 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
10489 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
10490 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
10491 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
10492 vfmt
->EvalPoint1
= save_EvalPoint1
;
10493 vfmt
->EvalPoint2
= save_EvalPoint2
;
10495 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
10496 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
10497 vfmt
->Indexf
= save_Indexf
;
10498 vfmt
->Indexfv
= save_Indexfv
;
10499 vfmt
->Materialfv
= save_Materialfv
;
10500 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
10501 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
10502 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
10503 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
10504 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
10505 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
10506 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
10507 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
10508 vfmt
->Normal3f
= save_Normal3f
;
10509 vfmt
->Normal3fv
= save_Normal3fv
;
10510 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
10511 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
10512 vfmt
->TexCoord1f
= save_TexCoord1f
;
10513 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
10514 vfmt
->TexCoord2f
= save_TexCoord2f
;
10515 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
10516 vfmt
->TexCoord3f
= save_TexCoord3f
;
10517 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
10518 vfmt
->TexCoord4f
= save_TexCoord4f
;
10519 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
10520 vfmt
->Vertex2f
= save_Vertex2f
;
10521 vfmt
->Vertex2fv
= save_Vertex2fv
;
10522 vfmt
->Vertex3f
= save_Vertex3f
;
10523 vfmt
->Vertex3fv
= save_Vertex3fv
;
10524 vfmt
->Vertex4f
= save_Vertex4f
;
10525 vfmt
->Vertex4fv
= save_Vertex4fv
;
10526 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
10527 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
10528 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
10529 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
10530 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
10531 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
10532 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
10533 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
10535 vfmt
->PrimitiveRestartNV
= save_PrimitiveRestartNV
;
10540 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
10541 const GLvertexformat
*vfmt
)
10543 SET_CallList(disp
, vfmt
->CallList
);
10544 SET_CallLists(disp
, vfmt
->CallLists
);
10549 * Initialize display list state for given context.
10552 _mesa_init_display_list(struct gl_context
*ctx
)
10554 static GLboolean tableInitialized
= GL_FALSE
;
10556 /* zero-out the instruction size table, just once */
10557 if (!tableInitialized
) {
10558 memset(InstSize
, 0, sizeof(InstSize
));
10559 tableInitialized
= GL_TRUE
;
10562 /* extension info */
10563 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
10566 ctx
->ListState
.CallDepth
= 0;
10567 ctx
->ExecuteFlag
= GL_TRUE
;
10568 ctx
->CompileFlag
= GL_FALSE
;
10569 ctx
->ListState
.CurrentBlock
= NULL
;
10570 ctx
->ListState
.CurrentPos
= 0;
10572 /* Display List group */
10573 ctx
->List
.ListBase
= 0;
10575 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
10577 InstSize
[OPCODE_NOP
] = 1;
10582 _mesa_free_display_list_data(struct gl_context
*ctx
)
10584 free(ctx
->ListExt
);
10585 ctx
->ListExt
= NULL
;